Package org.apache.commons.collections4
Class SetUtils.SetView<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- org.apache.commons.collections4.SetUtils.SetView<E>
-
- Type Parameters:
E
- the element type
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,Set<E>
- Enclosing class:
- SetUtils
public abstract static class SetUtils.SetView<E> extends AbstractSet<E>
An unmodifiable view of a set that may be backed by other sets.If the decorated sets change, this view will change as well. The contents of this view can be transferred to another instance via the
copyInto(Set)
andtoSet()
methods.- Since:
- 4.1
-
-
Constructor Summary
Constructors Constructor Description SetView()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <S extends Set<E>>
voidcopyInto(S set)
Copies the contents of this view into the provided set.protected abstract Iterator<E>
createIterator()
Return an iterator for this view; the returned iterator is not required to be unmodifiable.Iterator<E>
iterator()
int
size()
Set<E>
toSet()
Returns a new set containing the contents of this view.-
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
-
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
-
-
-
Method Detail
-
createIterator
protected abstract Iterator<E> createIterator()
Return an iterator for this view; the returned iterator is not required to be unmodifiable.- Returns:
- a new iterator for this view
-
size
public int size()
- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceSet<E>
- Specified by:
size
in classAbstractCollection<E>
-
copyInto
public <S extends Set<E>> void copyInto(S set)
Copies the contents of this view into the provided set.- Type Parameters:
S
- the set type- Parameters:
set
- the set for copying the contents
-
-