Java EnumSet Create createEnumSet(Class elementType)

Here you can find the source of createEnumSet(Class elementType)

Description

create Enum Set

License

Open Source License

Declaration

public static <E extends Enum<E>> EnumSet<E> createEnumSet(Class<E> elementType) 

Method Source Code

//package com.java2s;

import java.util.Collection;

import java.util.EnumSet;

public class Main {
    public static <E extends Enum<E>> EnumSet<E> createEnumSet(Collection<E> c) {
        if (c == null) {
            return null;
        }//from   w w  w. j  a  v  a2s. c o m

        return EnumSet.copyOf(c);
    }

    public static <E extends Enum<E>> EnumSet<E> createEnumSet(Class<E> elementType) {
        if (elementType == null) {
            return null;
        }

        return EnumSet.allOf(elementType);
    }
}

Related

  1. asSet(E[] array)
  2. enumFromSet(EnumSet theSet)
  3. enumSet(T... elements)
  4. enumSetOf(long bitSet, Class eClass)
  5. fromString(Class enumType, String value)