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