- Enclosing class:
public abstract static class Sets.SetView<E> extends AbstractSet<E>An unmodifiable view of a set which may be backed by other sets; this view will change as the backing sets do. Contains methods to copy the data into a new set which will then remain stable. There is usually no reason to retain a reference of type
SetView; typically, you either use it as a plain
Set, or immediately invoke
copyInto(S)and forget the
- 2.0 (imported from Google Collections Library)
All Methods Instance Methods Concrete Methods Modifier and Type Method Description
<S extends Set<E>>
copyInto(S set)Copies the current contents of this set view into an existing set.
immutableCopy()Returns an immutable copy of the current contents of this set view.
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, retainAll, size, toArray, toArray, toString
public ImmutableSet<E> immutableCopy()Returns an immutable copy of the current contents of this set view. Does not support null elements.
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
TreeSetusing a comparator that is inconsistent with
copyIntoCopies the current contents of this set view into an existing set. This method has equivalent behavior to
set.addAll(this), assuming that all the sets involved are based on the same notion of equivalence.
- a reference to
set, for convenience