Home | History | Annotate | Download | only in testing
      1 /*
      2  * Copyright (C) 2008 The Guava Authors
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  * http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.google.common.collect.testing;
     18 
     19 import com.google.common.annotations.GwtCompatible;
     20 
     21 import java.util.Collections;
     22 import java.util.EnumSet;
     23 import java.util.Iterator;
     24 import java.util.ListIterator;
     25 import java.util.Set;
     26 
     27 /**
     28  * A method supported by implementations of the {@link Iterator} or
     29  * {@link ListIterator} interface.
     30  *
     31  * <p>This enum is GWT compatible.
     32  *
     33  * @author Chris Povirk
     34  */
     35 @GwtCompatible
     36 public enum IteratorFeature {
     37   /**
     38    * Support for {@link Iterator#remove()}.
     39    */
     40   SUPPORTS_REMOVE,
     41   /**
     42    * Support for {@link ListIterator#add(Object)}; ignored for plain
     43    * {@link Iterator} implementations.
     44    */
     45   SUPPORTS_ADD,
     46   /**
     47    * Support for {@link ListIterator#set(Object)}; ignored for plain
     48    * {@link Iterator} implementations.
     49    */
     50   SUPPORTS_SET;
     51 
     52   /**
     53    * A set containing none of the optional features of the {@link Iterator} or
     54    * {@link ListIterator} interfaces.
     55    */
     56   public static final Set<IteratorFeature> UNMODIFIABLE =
     57       Collections.emptySet();
     58 
     59   /**
     60    * A set containing all of the optional features of the {@link Iterator} and
     61    * {@link ListIterator} interfaces.
     62    */
     63   public static final Set<IteratorFeature> MODIFIABLE =
     64       Collections.unmodifiableSet(EnumSet.allOf(IteratorFeature.class));
     65 }
     66