• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 java.util.Collections;
20 import java.util.EnumSet;
21 import java.util.Iterator;
22 import java.util.ListIterator;
23 import java.util.Set;
24 
25 /**
26  * A method supported by implementations of the {@link Iterator} or
27  * {@link ListIterator} interface.
28  *
29  * <p>This enum is GWT compatible.
30  *
31  * @author Chris Povirk
32  */
33 public enum IteratorFeature {
34   /**
35    * Support for {@link Iterator#remove()}.
36    */
37   SUPPORTS_REMOVE,
38   /**
39    * Support for {@link ListIterator#add(Object)}; ignored for plain
40    * {@link Iterator} implementations.
41    */
42   SUPPORTS_ADD,
43   /**
44    * Support for {@link ListIterator#set(Object)}; ignored for plain
45    * {@link Iterator} implementations.
46    */
47   SUPPORTS_SET;
48 
49   /**
50    * A set containing none of the optional features of the {@link Iterator} or
51    * {@link ListIterator} interfaces.
52    */
53   public static final Set<IteratorFeature> UNMODIFIABLE =
54       Collections.emptySet();
55 
56   /**
57    * A set containing all of the optional features of the {@link Iterator} and
58    * {@link ListIterator} interfaces.
59    */
60   public static final Set<IteratorFeature> MODIFIABLE =
61       Collections.unmodifiableSet(EnumSet.allOf(IteratorFeature.class));
62 }
63