T - the type of elements maintained by this Collectionpublic class ObjectArraySet<T> extends AbstractObjectSet<T> implements ObjectOrderedSet<T>
List.indexOf(Object) for no duplication.
Unless a array constructor is used the ArraySet does not allow for duplication.
This implementation does not shrink the backing array| Constructor and Description |
|---|
ObjectArraySet()
Default Constructor
|
ObjectArraySet(java.util.Collection<? extends T> c)
A Helper constructor that allows to create a Set with exactly the same values as the provided collection.
|
ObjectArraySet(int capacity)
Minimum Capacity Constructor
|
ObjectArraySet(ObjectCollection<T> c)
A Helper constructor that allows to create a Set with exactly the same values as the provided collection.
|
ObjectArraySet(ObjectSet<T> s)
A Helper constructor that fast copies the element out of a set into the ArraySet.
|
ObjectArraySet(java.util.Set<? extends T> s)
A Helper constructor that fast copies the element out of a set into the ArraySet.
|
ObjectArraySet(T[] array)
Constructur using initial Array
|
ObjectArraySet(T[] array,
int length)
Constructur using initial Array
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T o) |
boolean |
addAndMoveToFirst(T o)
A customized add method that allows you to insert into the first index.
|
boolean |
addAndMoveToLast(T o)
A customized add method that allows you to insert into the last index.
|
T |
addOrGet(T o)
A Helper method that allows to add a element or getting the already present implement.
|
void |
clear() |
boolean |
contains(java.lang.Object e) |
ObjectArraySet<T> |
copy()
A Function that does a shallow clone of the Collection itself.
|
int |
count(Object2BooleanFunction<T> filter)
Helper function to reduce stream usage that allows to count the valid elements.
|
T |
findFirst(Object2BooleanFunction<T> filter)
Helper function to reduce stream usage that allows to filter for the first match.
|
T |
first()
A method to get the first element in the set
|
void |
forEach(java.util.function.Consumer<? super T> action) |
<E> void |
forEach(E input,
ObjectObjectConsumer<E,T> action)
Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
ObjectBidirectionalIterator<T> |
iterator()
Returns a Type-Specific Iterator to reduce (un)boxing
|
ObjectBidirectionalIterator<T> |
iterator(T fromElement)
A type Specific Iterator starting from a given key
|
T |
last()
A method to get the last element in the set
|
boolean |
matchesAll(Object2BooleanFunction<T> filter)
Helper function to reduce stream usage that allows to filter for all matches.
|
boolean |
matchesAny(Object2BooleanFunction<T> filter)
Helper function to reduce stream usage that allows to filter for any matches.
|
boolean |
matchesNone(Object2BooleanFunction<T> filter)
Helper function to reduce stream usage that allows to filter for no matches.
|
boolean |
moveToFirst(T o)
A specific move method to move a given key to the first index.
|
boolean |
moveToLast(T o)
A specific move method to move a given key to the last index.
|
T |
pollFirst()
A method to get and remove the first element in the set
|
T |
pollLast()
A method to get and remove the last element in the set
|
<E> E |
reduce(E identity,
java.util.function.BiFunction<E,T,E> operator)
Performs a reduction on the
elements of this Iterable
|
T |
reduce(ObjectObjectUnaryOperator<T,T> operator)
Performs a reduction on the
elements of this Iterable
|
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
removeAll(ObjectCollection<T> c)
A Type-Specific implementation of removeAll.
|
boolean |
removeAll(ObjectCollection<T> c,
java.util.function.Consumer<T> r)
A Type-Specific removeAll function that reduces (un)boxing.
|
boolean |
retainAll(java.util.Collection<?> c) |
boolean |
retainAll(ObjectCollection<T> c)
A Type-Specific implementation of retainAll.
|
boolean |
retainAll(ObjectCollection<T> c,
java.util.function.Consumer<T> r)
A Type-Specific retainAll function that reduces (un)boxing.
|
int |
size() |
java.lang.Object[] |
toArray()
Deprecated.
|
<E> E[] |
toArray(E[] a) |
equals, hashCodeaddAll, containsAll, containsAll, containsAny, containsAnyspliterator, synchronize, synchronize, unmodifiableaddAll, addAll, addAll, addAll, containsAll, containsAny, containsAny, pour, toArrayarrayflatMap, asAsync, distinct, filter, flatMap, limit, map, peek, pourAsList, pourAsSet, sortedpublic ObjectArraySet()
public ObjectArraySet(int capacity)
capacity - the minimum capacity of the internal arrayjava.lang.NegativeArraySizeException - if the capacity is negativepublic ObjectArraySet(T[] array)
array - the array that should be used for set.public ObjectArraySet(T[] array, int length)
array - the array that should be used for set.length - the amount of elements present within the arrayjava.lang.NegativeArraySizeException - if the length is negativepublic ObjectArraySet(java.util.Collection<? extends T> c)
c - the elements that should be added to the set.public ObjectArraySet(ObjectCollection<T> c)
c - the elements that should be added to the set.public ObjectArraySet(java.util.Set<? extends T> s)
s - the set the element should be taken frompublic boolean add(T o)
public T addOrGet(T o)
ObjectSetpublic boolean addAndMoveToFirst(T o)
ObjectOrderedSetaddAndMoveToFirst in interface ObjectOrderedSet<T>o - the element that should be insertedSet.add(Object)public boolean addAndMoveToLast(T o)
ObjectOrderedSetaddAndMoveToLast in interface ObjectOrderedSet<T>o - the element that should be insertedSet.add(Object)public boolean moveToFirst(T o)
ObjectOrderedSetmoveToFirst in interface ObjectOrderedSet<T>o - that should be moved to the first indexpublic boolean moveToLast(T o)
ObjectOrderedSetmoveToLast in interface ObjectOrderedSet<T>o - that should be moved to the first lastpublic boolean contains(java.lang.Object e)
public T first()
ObjectOrderedSetfirst in interface ObjectOrderedSet<T>public T last()
ObjectOrderedSetlast in interface ObjectOrderedSet<T>public boolean removeAll(ObjectCollection<T> c)
AbstractObjectCollectionremoveAll in interface ObjectCollection<T>removeAll in class AbstractObjectCollection<T>c - the elements that should be deletedCollection.removeAll(Collection)public boolean removeAll(ObjectCollection<T> c, java.util.function.Consumer<T> r)
ObjectCollectionremoveAll in interface ObjectCollection<T>removeAll in class AbstractObjectCollection<T>c - the collection of elements that should be removedr - elements that got removedCollection.removeAll(Collection)public boolean retainAll(ObjectCollection<T> c)
AbstractObjectCollectionretainAll in interface ObjectCollection<T>retainAll in class AbstractObjectCollection<T>c - the elements that should be keptCollection.retainAll(Collection)public boolean retainAll(ObjectCollection<T> c, java.util.function.Consumer<T> r)
ObjectCollectionretainAll in interface ObjectCollection<T>retainAll in class AbstractObjectCollection<T>c - the collection of elements that should be keptr - elements that got removedCollection.retainAll(Collection)public boolean removeAll(java.util.Collection<?> c)
public boolean retainAll(java.util.Collection<?> c)
public boolean remove(java.lang.Object o)
public T pollFirst()
ObjectOrderedSetpollFirst in interface ObjectOrderedSet<T>public T pollLast()
ObjectOrderedSetpollLast in interface ObjectOrderedSet<T>public void forEach(java.util.function.Consumer<? super T> action)
forEach in interface java.lang.Iterable<T>public <E> void forEach(E input,
ObjectObjectConsumer<E,T> action)
ObjectIterableforEach in interface ObjectIterable<T>E - the generic type of the Objectinput - the object that should be includedaction - The action to be performed for each elementpublic boolean matchesAny(Object2BooleanFunction<T> filter)
ObjectIterablematchesAny in interface ObjectIterable<T>filter - that should be appliedpublic boolean matchesNone(Object2BooleanFunction<T> filter)
ObjectIterablematchesNone in interface ObjectIterable<T>filter - that should be appliedpublic boolean matchesAll(Object2BooleanFunction<T> filter)
ObjectIterablematchesAll in interface ObjectIterable<T>filter - that should be appliedpublic T findFirst(Object2BooleanFunction<T> filter)
ObjectIterablefindFirst in interface ObjectIterable<T>filter - that should be appliedpublic <E> E reduce(E identity,
java.util.function.BiFunction<E,T,E> operator)
ObjectIterablereduce in interface ObjectIterable<T>E - the type of elements maintained by this Collectionidentity - the start valueoperator - the operation that should be appliedpublic T reduce(ObjectObjectUnaryOperator<T,T> operator)
ObjectIterablereduce in interface ObjectIterable<T>operator - the operation that should be appliedpublic int count(Object2BooleanFunction<T> filter)
ObjectIterablecount in interface ObjectIterable<T>filter - that should be appliedpublic ObjectBidirectionalIterator<T> iterator()
ObjectCollectioniterator in interface java.lang.Iterable<T>iterator in interface java.util.Collection<T>iterator in interface java.util.Set<T>iterator in interface ObjectCollection<T>iterator in interface ObjectIterable<T>iterator in interface ObjectOrderedSet<T>iterator in interface ObjectSet<T>iterator in class AbstractObjectSet<T>Collection.iterator()public ObjectBidirectionalIterator<T> iterator(T fromElement)
ObjectOrderedSetiterator in interface ObjectOrderedSet<T>fromElement - the element the iterator should start frompublic ObjectArraySet<T> copy()
ObjectCollectioncopy in interface ObjectCollection<T>copy in interface ObjectOrderedSet<T>copy in interface ObjectSet<T>copy in class AbstractObjectSet<T>public void clear()
public int size()
@Deprecated public java.lang.Object[] toArray()