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 and Type | Method and Description |
---|---|
boolean |
add(E e)
Deprecated.
Unsupported operation.
|
boolean |
addAll(java.util.Collection<? extends E> newElements)
Deprecated.
Unsupported operation.
|
void |
clear()
Deprecated.
Unsupported operation.
|
<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. |
boolean |
remove(java.lang.Object object)
Deprecated.
Unsupported operation.
|
boolean |
removeAll(java.util.Collection<?> oldElements)
Deprecated.
Unsupported operation.
|
boolean |
removeIf(java.util.function.Predicate<? super E> filter)
Deprecated.
Unsupported operation.
|
boolean |
retainAll(java.util.Collection<?> elementsToKeep)
Deprecated.
Unsupported operation.
|
contains, containsAll, isEmpty, size, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
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)
.
@CanIgnoreReturnValue 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 convenience@CanIgnoreReturnValue @Deprecated public final boolean add(E e)
@CanIgnoreReturnValue @Deprecated public final boolean remove(java.lang.Object object)
@CanIgnoreReturnValue @Deprecated public final boolean addAll(java.util.Collection<? extends E> newElements)
@CanIgnoreReturnValue @Deprecated public final boolean removeAll(java.util.Collection<?> oldElements)
@CanIgnoreReturnValue @Deprecated public final boolean removeIf(java.util.function.Predicate<? super E> filter)
java.lang.UnsupportedOperationException
- always@CanIgnoreReturnValue @Deprecated public final boolean retainAll(java.util.Collection<?> elementsToKeep)
@Deprecated public final void clear()
public abstract UnmodifiableIterator<E> iterator()
UnmodifiableIterator
to ensure this is an unmodifiable view.Copyright © 2010–2021 JBoss by Red Hat. All rights reserved.