2
* Copyright (C) 2008 The Guava Authors
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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
17
package com.google.common.collect.testing;
19
import static java.util.Arrays.asList;
20
import static java.util.Collections.emptySet;
21
import static java.util.Collections.unmodifiableSet;
23
import com.google.common.annotations.GwtCompatible;
24
import java.util.Iterator;
25
import java.util.LinkedHashSet;
26
import java.util.ListIterator;
30
* A method supported by implementations of the {@link Iterator} or {@link ListIterator} interface.
32
* <p>This enum is GWT compatible.
34
* @author Chris Povirk
37
public enum IteratorFeature {
38
/** Support for {@link Iterator#remove()}. */
41
* Support for {@link ListIterator#add(Object)}; ignored for plain {@link Iterator}
46
* Support for {@link ListIterator#set(Object)}; ignored for plain {@link Iterator}
52
* A set containing none of the optional features of the {@link Iterator} or {@link ListIterator}
55
public static final Set<IteratorFeature> UNMODIFIABLE = emptySet();
58
* A set containing all of the optional features of the {@link Iterator} and {@link ListIterator}
61
public static final Set<IteratorFeature> MODIFIABLE =
62
unmodifiableSet(new LinkedHashSet<>(asList(values())));