public class LongArraySet extends AbstractLongSet implements LongOrderedSet
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 |
|---|
LongArraySet()
Default Constructor
|
LongArraySet(java.util.Collection<? extends java.lang.Long> c)
Deprecated.
|
LongArraySet(int capacity)
Minimum Capacity Constructor
|
LongArraySet(long[] array)
Constructur using initial Array
|
LongArraySet(long[] array,
int length)
Constructur using initial Array
|
LongArraySet(LongCollection c)
A Helper constructor that allows to create a Set with exactly the same values as the provided collection.
|
LongArraySet(LongSet s)
A Helper constructor that fast copies the element out of a set into the ArraySet.
|
LongArraySet(java.util.Set<? extends java.lang.Long> s)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(long o)
A Type-Specific add function to reduce (un)boxing
|
boolean |
addAndMoveToFirst(long o)
A customized add method that allows you to insert into the first index.
|
boolean |
addAndMoveToLast(long o)
A customized add method that allows you to insert into the last index.
|
void |
clear() |
boolean |
contains(long e)
A Type-Specific implementation of contains.
|
LongArraySet |
copy()
A Function that does a shallow clone of the Collection itself.
|
int |
count(Long2BooleanFunction filter)
Helper function to reduce stream usage that allows to count the valid elements.
|
long |
findFirst(Long2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for the first match.
|
long |
firstLong()
A method to get the first element in the set
|
<E> void |
forEach(E input,
ObjectLongConsumer<E> action)
Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
void |
forEach(LongConsumer action)
A Type Specific foreach function that reduces (un)boxing
|
LongBidirectionalIterator |
iterator()
Returns a Type-Specific Iterator to reduce (un)boxing
|
LongBidirectionalIterator |
iterator(long fromElement)
A type Specific Iterator starting from a given key
|
long |
lastLong()
A method to get the last element in the set
|
boolean |
matchesAll(Long2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for all matches.
|
boolean |
matchesAny(Long2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for any matches.
|
boolean |
matchesNone(Long2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for no matches.
|
boolean |
moveToFirst(long o)
A specific move method to move a given key to the first index.
|
boolean |
moveToLast(long o)
A specific move method to move a given key to the last index.
|
long |
pollFirstLong()
A method to get and remove the first element in the set
|
long |
pollLastLong()
A method to get and remove the last element in the set
|
long |
reduce(long identity,
LongLongUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
long |
reduce(LongLongUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
boolean |
remIf(java.util.function.LongPredicate filter)
A Type-Specific removeIf function to reduce (un)boxing.
|
boolean |
remove(long o)
A Type Specific remove function to reduce boxing/unboxing
|
boolean |
removeAll(java.util.Collection<?> c)
Deprecated.
|
boolean |
removeAll(LongCollection c)
A Type-Specific implementation of removeAll.
|
boolean |
removeAll(LongCollection c,
LongConsumer r)
A Type-Specific removeAll function that reduces (un)boxing.
|
boolean |
retainAll(java.util.Collection<?> c)
Deprecated.
|
boolean |
retainAll(LongCollection c)
A Type-Specific implementation of retainAll.
|
boolean |
retainAll(LongCollection c,
LongConsumer r)
A Type-Specific retainAll function that reduces (un)boxing.
|
int |
size() |
java.lang.Object[] |
toArray()
Deprecated.
|
<E> E[] |
toArray(E[] a)
Deprecated.
|
long[] |
toLongArray(long[] a)
A Type-Specific implementation of toArray.
|
equals, hashCodeadd, addAll, addAll, contains, containsAll, containsAll, containsAny, containsAny, remLong, remove, toLongArrayspliterator, synchronize, synchronize, unmodifiableadd, contains, remLong, removeaddAll, addAll, addAll, addAll, containsAll, containsAny, containsAny, parallelPrimitiveStream, pour, primitiveStream, removeIf, toLongArrayarrayflatMap, asAsync, distinct, filter, flatMap, forEach, limit, map, peek, pourAsList, pourAsSet, sortedpublic LongArraySet()
public LongArraySet(int capacity)
capacity - the minimum capacity of the internal arrayjava.lang.NegativeArraySizeException - if the capacity is negativepublic LongArraySet(long[] array)
array - the array that should be used for set.public LongArraySet(long[] 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 negative@Deprecated public LongArraySet(java.util.Collection<? extends java.lang.Long> c)
c - the elements that should be added to the set.public LongArraySet(LongCollection c)
c - the elements that should be added to the set.@Deprecated public LongArraySet(java.util.Set<? extends java.lang.Long> s)
s - the set the element should be taken frompublic LongArraySet(LongSet s)
s - the set the element should be taken frompublic boolean add(long o)
LongCollectionadd in interface LongCollectiono - the element that should be addedpublic boolean addAndMoveToFirst(long o)
LongOrderedSetaddAndMoveToFirst in interface LongOrderedSeto - the element that should be insertedSet.add(Object)public boolean addAndMoveToLast(long o)
LongOrderedSetaddAndMoveToLast in interface LongOrderedSeto - the element that should be insertedSet.add(Object)public boolean moveToFirst(long o)
LongOrderedSetmoveToFirst in interface LongOrderedSeto - that should be moved to the first indexpublic boolean moveToLast(long o)
LongOrderedSetmoveToLast in interface LongOrderedSeto - that should be moved to the first lastpublic boolean contains(long e)
AbstractLongCollectioncontains in interface LongCollectioncontains in class AbstractLongCollectione - the element that should be searched for.public long firstLong()
LongOrderedSetfirstLong in interface LongOrderedSetpublic long lastLong()
LongOrderedSetlastLong in interface LongOrderedSetpublic boolean removeAll(LongCollection c)
AbstractLongCollectionremoveAll in interface LongCollectionremoveAll in class AbstractLongCollectionc - the elements that should be deletedCollection.removeAll(Collection)public boolean removeAll(LongCollection c, LongConsumer r)
LongCollectionremoveAll in interface LongCollectionremoveAll in class AbstractLongCollectionc - the collection of elements that should be removedr - elements that got removedCollection.removeAll(Collection)public boolean retainAll(LongCollection c)
AbstractLongCollectionretainAll in interface LongCollectionretainAll in class AbstractLongCollectionc - the elements that should be keptCollection.retainAll(Collection)public boolean retainAll(LongCollection c, LongConsumer r)
LongCollectionretainAll in interface LongCollectionretainAll in class AbstractLongCollectionc - the collection of elements that should be keptr - elements that got removedCollection.retainAll(Collection)@Deprecated public boolean removeAll(java.util.Collection<?> c)
removeAll in interface java.util.Collection<java.lang.Long>removeAll in interface java.util.Set<java.lang.Long>removeAll in class java.util.AbstractCollection<java.lang.Long>@Deprecated public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<java.lang.Long>retainAll in interface java.util.Set<java.lang.Long>retainAll in class java.util.AbstractCollection<java.lang.Long>public boolean remove(long o)
LongSetpublic long pollFirstLong()
LongOrderedSetpollFirstLong in interface LongOrderedSetpublic long pollLastLong()
LongOrderedSetpollLastLong in interface LongOrderedSetpublic boolean remIf(java.util.function.LongPredicate filter)
LongCollectionRemoves elements that were selected by the filter
remIf in interface LongCollectionfilter - Filters the elements that should be removedCollection.removeIf(Predicate)public void forEach(LongConsumer action)
LongIterableforEach in interface LongIterableaction - The action to be performed for each elementIterable.forEach(Consumer)public <E> void forEach(E input,
ObjectLongConsumer<E> action)
LongIterableforEach in interface LongIterableE - the generic type of the Objectinput - the object that should be includedaction - The action to be performed for each elementpublic boolean matchesAny(Long2BooleanFunction filter)
LongIterablematchesAny in interface LongIterablefilter - that should be appliedpublic boolean matchesNone(Long2BooleanFunction filter)
LongIterablematchesNone in interface LongIterablefilter - that should be appliedpublic boolean matchesAll(Long2BooleanFunction filter)
LongIterablematchesAll in interface LongIterablefilter - that should be appliedpublic long findFirst(Long2BooleanFunction filter)
LongIterablefindFirst in interface LongIterablefilter - that should be appliedpublic long reduce(long identity,
LongLongUnaryOperator operator)
LongIterablereduce in interface LongIterableidentity - the start valueoperator - the operation that should be appliedpublic long reduce(LongLongUnaryOperator operator)
LongIterablereduce in interface LongIterableoperator - the operation that should be appliedpublic int count(Long2BooleanFunction filter)
LongIterablecount in interface LongIterablefilter - that should be appliedpublic LongBidirectionalIterator iterator()
LongCollectioniterator in interface java.lang.Iterable<java.lang.Long>iterator in interface java.util.Collection<java.lang.Long>iterator in interface java.util.Set<java.lang.Long>iterator in interface LongCollectioniterator in interface LongIterableiterator in interface LongOrderedSetiterator in interface LongSetiterator in class AbstractLongSetCollection.iterator()public LongBidirectionalIterator iterator(long fromElement)
LongOrderedSetiterator in interface LongOrderedSetfromElement - the element the iterator should start frompublic LongArraySet copy()
LongCollectioncopy in interface LongCollectioncopy in interface LongOrderedSetcopy in interface LongSetcopy in class AbstractLongSetpublic void clear()
clear in interface java.util.Collection<java.lang.Long>clear in interface java.util.Set<java.lang.Long>clear in class java.util.AbstractCollection<java.lang.Long>public int size()
size in interface java.util.Collection<java.lang.Long>size in interface java.util.Set<java.lang.Long>size in class java.util.AbstractCollection<java.lang.Long>public long[] toLongArray(long[] a)
AbstractLongCollectiontoLongArray in interface LongCollectiontoLongArray in class AbstractLongCollectiona - array that the elements should be injected to. If null or to small a new array with the right size is createdCollection.toArray(Object[])@Deprecated public java.lang.Object[] toArray()
toArray in interface java.util.Collection<java.lang.Long>toArray in interface java.util.Set<java.lang.Long>toArray in class java.util.AbstractCollection<java.lang.Long>@Deprecated public <E> E[] toArray(E[] a)
toArray in interface java.util.Collection<java.lang.Long>toArray in interface java.util.Set<java.lang.Long>toArray in class java.util.AbstractCollection<java.lang.Long>