jdk/src/share/classes/java/util/EnumSet.java
changeset 8151 88b01a6d5f51
parent 7803 56bc97d69d93
child 9035 1255eb81cc2f
equal deleted inserted replaced
8005:5bc99c45810a 8151:88b01a6d5f51
   315      * @param rest the remaining elements the set is to contain initially
   315      * @param rest the remaining elements the set is to contain initially
   316      * @throws NullPointerException if any of the specified elements are null,
   316      * @throws NullPointerException if any of the specified elements are null,
   317      *     or if <tt>rest</tt> is null
   317      *     or if <tt>rest</tt> is null
   318      * @return an enum set initially containing the specified elements
   318      * @return an enum set initially containing the specified elements
   319      */
   319      */
       
   320     @SafeVarargs
   320     public static <E extends Enum<E>> EnumSet<E> of(E first, E... rest) {
   321     public static <E extends Enum<E>> EnumSet<E> of(E first, E... rest) {
   321         EnumSet<E> result = noneOf(first.getDeclaringClass());
   322         EnumSet<E> result = noneOf(first.getDeclaringClass());
   322         result.add(first);
   323         result.add(first);
   323         for (E e : rest)
   324         for (E e : rest)
   324             result.add(e);
   325             result.add(e);