public abstract static class Sets.SetView<E>
extends java.util.AbstractSet<E>
SetView; typically, you either use it
as a plain Set, or immediately invoke immutableCopy() or
copyInto(S) and forget the SetView itself.| Modifier | Constructor and Description |
|---|---|
private |
SetView() |
| Modifier and Type | Method and Description |
|---|---|
<S extends java.util.Set<E>> |
copyInto(S set)
Copies the current contents of this set view into an existing set.
|
ImmutableSet<E> |
immutableCopy()
Returns an immutable copy of the current contents of this set view.
|
abstract UnmodifiableIterator<E> |
iterator()
Scope the return type to
UnmodifiableIterator to ensure this is an unmodifiable view. |
add, addAll, clear, contains, containsAll, isEmpty, remove, retainAll, size, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic ImmutableSet<E> immutableCopy()
Warning: this may have unexpected results if a backing set of
this view uses a nonstandard notion of equivalence, for example if it is
a TreeSet using a comparator that is inconsistent with Object.equals(Object).
public <S extends java.util.Set<E>> S copyInto(S set)
set.addAll(this), assuming that
all the sets involved are based on the same notion of equivalence.set, for conveniencepublic abstract UnmodifiableIterator<E> iterator()
UnmodifiableIterator to ensure this is an unmodifiable view.