Java Utililty Methods EnumSet to

List of utility methods to do EnumSet to

Description

The list of methods to do EnumSet to are organized into topic(s).

Method

intenumSetToInt(EnumSet enumSet)
Encode an enum set to an integer representing a bit array.
int b = 0;
for (Object o : enumSet) {
    b += 1 << ((Enum) o).ordinal();
return b;
SetenumSetToStringSet(EnumSet enumSet)
enum Set To String Set
Set<String> result = new HashSet<String>();
for (Enum<?> enumValue : enumSet) {
    result.add(enumValue.name());
return result;
StringenumsToString(EnumSet elems)
enums To String
if (elems != null) {
    StringBuilder buf = new StringBuilder();
    for (ENUM e : elems) {
        if (buf.length() > 0) {
            buf.append(",");
        buf.append(e.name());
    return buf.toString();
} else {
    return null;