Java EnumSet Create enumSet(T... elements)

Here you can find the source of enumSet(T... elements)

Description

Terse (especially as a static import) way to create an EnumSet.

License

Open Source License

Declaration

@SuppressWarnings("unchecked")
public static <T extends Enum<T>> EnumSet<T> enumSet(T... elements) 

Method Source Code

//package com.java2s;

import java.util.EnumSet;

public class Main {
    /**/*from  w  ww . j  a  v a2s .  co  m*/
     * Terse (especially as a static import) way to create an EnumSet.
     */
    @SuppressWarnings("unchecked")
    public static <T extends Enum<T>> EnumSet<T> enumSet(T... elements) {
        return EnumSet.<T>of(elements[0], elements);
    }
}

Related

  1. asSet(E[] array)
  2. createEnumSet(Class elementType)
  3. enumFromSet(EnumSet theSet)
  4. enumSetOf(long bitSet, Class eClass)
  5. fromString(Class enumType, String value)
  6. fromString(Class enumClass, String name)
  7. intToEnumSet(Class enumClass, int decoded)