public class ExtendedSet<E> extends Object implements Set<E>
Constructor and Description |
---|
ExtendedSet(Map<E,E> map)
Constructs a new instance by backing it with the supplied Map.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(E e) |
boolean |
addAll(Collection<? extends E> c) |
void |
clear() |
boolean |
conditionalRemove(E entry,
Predicate<E> entryTest)
Removes the entry if the supplied predicate evaluates to true.
|
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
E |
get(Object o)
Returns set element that is equal to the specified object.
|
boolean |
insertOrReplace(E entry,
Predicate<E> entryTest)
Inserts the entry if it is not already in the set otherwise replaces the existing entry
if the supplied predicate evaluates to true.
|
boolean |
isEmpty() |
Iterator<E> |
iterator() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, hashCode, spliterator
parallelStream, removeIf, stream
public E get(Object o)
o
- objectpublic boolean insertOrReplace(E entry, Predicate<E> entryTest)
entry
- entry to addentryTest
- predicate that is used to evaluate if the existing entry should be replacedpublic boolean conditionalRemove(E entry, Predicate<E> entryTest)
entry
- entry to removeentryTest
- predicate that is used to evaluated aginst the existing entry. Return value of
true implies value should be removed.public int size()
public boolean isEmpty()
public boolean contains(Object o)
public Object[] toArray()
public <T> T[] toArray(T[] a)
public boolean add(E e)
public boolean remove(Object o)
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<E>
containsAll
in interface Set<E>
public boolean addAll(Collection<? extends E> c)
public boolean retainAll(Collection<?> c)
public boolean removeAll(Collection<?> c)