Java EnumSet to enumsToString(EnumSet elems)

Here you can find the source of enumsToString(EnumSet elems)

Description

enums To String

License

Apache License

Declaration

public static <ENUM extends Enum<ENUM>> String enumsToString(EnumSet<ENUM> elems) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.EnumSet;

public class Main {
    public static <ENUM extends Enum<ENUM>> String enumsToString(EnumSet<ENUM> elems) {
        if (elems != null) {
            StringBuilder buf = new StringBuilder();
            for (ENUM e : elems) {
                if (buf.length() > 0) {
                    buf.append(",");
                }/*ww  w . ja  v a2s. c  o  m*/
                buf.append(e.name());
            }
            return buf.toString();
        } else {
            return null;
        }
    }
}

Related

  1. enumSetToInt(EnumSet enumSet)
  2. enumSetToStringSet(EnumSet enumSet)