public abstract static class Sets.SetView<E> extends 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 and Type | Method and Description |
---|---|
boolean |
add(E e)
Deprecated.
Unsupported operation.
|
boolean |
addAll(Collection<? extends E> newElements)
Deprecated.
Unsupported operation.
|
void |
clear()
Deprecated.
Unsupported operation.
|
<S extends 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. |
boolean |
remove(Object object)
Deprecated.
Unsupported operation.
|
boolean |
removeAll(Collection<?> oldElements)
Deprecated.
Unsupported operation.
|
boolean |
removeIf(Predicate<? super E> filter)
Deprecated.
Unsupported operation.
|
boolean |
retainAll(Collection<?> elementsToKeep)
Deprecated.
Unsupported operation.
|
equals, hashCode
contains, containsAll, isEmpty, size, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
contains, containsAll, isEmpty, size, spliterator, toArray, toArray
parallelStream, stream
public 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 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 convenience@Deprecated public final boolean add(E e)
add
in interface Collection<E>
add
in interface Set<E>
add
in class AbstractCollection<E>
UnsupportedOperationException
- always@Deprecated public final boolean remove(Object object)
remove
in interface Collection<E>
remove
in interface Set<E>
remove
in class AbstractCollection<E>
UnsupportedOperationException
- always@Deprecated public final boolean addAll(Collection<? extends E> newElements)
addAll
in interface Collection<E>
addAll
in interface Set<E>
addAll
in class AbstractCollection<E>
UnsupportedOperationException
- always@Deprecated public final boolean removeAll(Collection<?> oldElements)
removeAll
in interface Collection<E>
removeAll
in interface Set<E>
removeAll
in class AbstractSet<E>
UnsupportedOperationException
- always@Deprecated public final boolean removeIf(Predicate<? super E> filter)
UnsupportedOperationException
- always@Deprecated public final boolean retainAll(Collection<?> elementsToKeep)
retainAll
in interface Collection<E>
retainAll
in interface Set<E>
retainAll
in class AbstractCollection<E>
UnsupportedOperationException
- always@Deprecated public final void clear()
clear
in interface Collection<E>
clear
in interface Set<E>
clear
in class AbstractCollection<E>
UnsupportedOperationException
- alwayspublic abstract UnmodifiableIterator<E> iterator()
UnmodifiableIterator
to ensure this is an unmodifiable view.Copyright © 2010–2017. All rights reserved.