Java EnumSet Create enumFromSet(EnumSet theSet)

Here you can find the source of enumFromSet(EnumSet theSet)

Description

enum From Set

License

Open Source License

Declaration

public static <E extends Enum<E>> E enumFromSet(EnumSet<E> theSet) 

Method Source Code


//package com.java2s;
/*//from w ww  .jav a  2s  .  co m
 * Copyright (C) 2009 Emweb bvba, Leuven, Belgium.
 *
 * See the LICENSE file for terms of use.
 */

import java.util.EnumSet;

public class Main {
    public static <E extends Enum<E>> E enumFromSet(EnumSet<E> theSet) {
        if (theSet.isEmpty()) {
            return null;
        } else {
            return theSet.iterator().next();
        }
    }
}

Related

  1. asSet(E[] array)
  2. createEnumSet(Class elementType)
  3. enumSet(T... elements)
  4. enumSetOf(long bitSet, Class eClass)
  5. fromString(Class enumType, String value)
  6. fromString(Class enumClass, String name)