E
- The type of elements in this set.public abstract class DelegateSet<E> extends AbstractSet<E>
DelegateSet
contains some other Set
, to which it delegates
its method calls, possibly transforming the data along the way or providing
additional functionality. The class DelegateSet
itself simply
overrides all methods of AbstractSet
with versions that pass all
requests to the target Set
. Subclasses of DelegateSet
may
further override some of these methods and may also provide additional
methods and fields.Modifier | Constructor and Description |
---|---|
protected |
DelegateSet()
Creates a new
DelegateSet with a null target. |
|
DelegateSet(Set<E> target)
Creates a new
DelegateSet with the specified target Set . |
Modifier and Type | Method and Description |
---|---|
boolean |
add(E e) |
boolean |
addAll(Collection<? extends E> c) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
boolean |
equals(Object obj) |
void |
forEach(Consumer<? super E> action) |
int |
hashCode() |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
Stream<E> |
parallelStream() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
removeIf(Predicate<? super E> filter) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
Spliterator<E> |
spliterator() |
Stream<E> |
stream() |
protected void |
superForEach(Consumer<? super E> action)
Protected method providing access to the default implementation of
Iterable.forEach(Consumer) . |
protected Stream<E> |
superParallelStream()
Protected method providing access to the default implementation of
Collection.parallelStream() . |
protected boolean |
superRemoveIf(Predicate<? super E> filter)
Protected method providing access to the default implementation of
Collection.removeIf(Predicate) . |
protected Spliterator<E> |
superSpliterator()
Protected method providing access to the default implementation of
Collection.spliterator() . |
protected Stream<E> |
superStream()
Protected method providing access to the default implementation of
Collection.stream() . |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
String |
toString() |
public DelegateSet(Set<E> target)
DelegateSet
with the specified target Set
.target
- The target Set
.NullPointerException
- If the target Set
is null.protected DelegateSet()
DelegateSet
with a null target.public int size()
size
in interface Collection<E>
size
in interface Set<E>
size
in class AbstractCollection<E>
public boolean isEmpty()
isEmpty
in interface Collection<E>
isEmpty
in interface Set<E>
isEmpty
in class AbstractCollection<E>
public boolean contains(Object o)
contains
in interface Collection<E>
contains
in interface Set<E>
contains
in class AbstractCollection<E>
public Object[] toArray()
toArray
in interface Collection<E>
toArray
in interface Set<E>
toArray
in class AbstractCollection<E>
public <T> T[] toArray(T[] a)
toArray
in interface Collection<E>
toArray
in interface Set<E>
toArray
in class AbstractCollection<E>
public boolean add(E e)
add
in interface Collection<E>
add
in interface Set<E>
add
in class AbstractCollection<E>
public boolean remove(Object o)
remove
in interface Collection<E>
remove
in interface Set<E>
remove
in class AbstractCollection<E>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<E>
containsAll
in interface Set<E>
containsAll
in class AbstractCollection<E>
public boolean addAll(Collection<? extends E> c)
addAll
in interface Collection<E>
addAll
in interface Set<E>
addAll
in class AbstractCollection<E>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<E>
removeAll
in interface Set<E>
removeAll
in class AbstractSet<E>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<E>
retainAll
in interface Set<E>
retainAll
in class AbstractCollection<E>
public void clear()
clear
in interface Collection<E>
clear
in interface Set<E>
clear
in class AbstractCollection<E>
protected final void superForEach(Consumer<? super E> action)
Iterable.forEach(Consumer)
.action
- The action to be performed for each element.NullPointerException
- If the specified action is nullprotected final boolean superRemoveIf(Predicate<? super E> filter)
Collection.removeIf(Predicate)
.filter
- A predicate which returns true
for elements to be
removed.true
if any elements were removed.NullPointerException
- If the specified filter is null.UnsupportedOperationException
- If elements cannot be removed from
this collection. Implementations may throw this exception if a
matching element cannot be removed or if, in general, removal is
not supported.protected final Spliterator<E> superSpliterator()
Collection.spliterator()
.Spliterator
over the elements in this collection.public Spliterator<E> spliterator()
protected final Stream<E> superStream()
Collection.stream()
.Stream
over the elements in this collection.protected final Stream<E> superParallelStream()
Collection.parallelStream()
.Stream
over the elements in this
collection.public boolean equals(Object obj)
equals
in interface Collection<E>
equals
in interface Set<E>
equals
in class AbstractSet<E>
public int hashCode()
hashCode
in interface Collection<E>
hashCode
in interface Set<E>
hashCode
in class AbstractSet<E>
public String toString()
toString
in class AbstractCollection<E>
Copyright © 2020 LibJ. All rights reserved.