public class IntArraySet extends AbstractIntSet implements IntOrderedSet
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 |
|---|
IntArraySet()
Default Constructor
|
IntArraySet(java.util.Collection<? extends java.lang.Integer> c)
Deprecated.
|
IntArraySet(int capacity)
Minimum Capacity Constructor
|
IntArraySet(int[] array)
Constructur using initial Array
|
IntArraySet(int[] array,
int length)
Constructur using initial Array
|
IntArraySet(IntCollection c)
A Helper constructor that allows to create a Set with exactly the same values as the provided collection.
|
IntArraySet(IntSet s)
A Helper constructor that fast copies the element out of a set into the ArraySet.
|
IntArraySet(java.util.Set<? extends java.lang.Integer> s)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(int o)
A Type-Specific add function to reduce (un)boxing
|
boolean |
addAndMoveToFirst(int o)
A customized add method that allows you to insert into the first index.
|
boolean |
addAndMoveToLast(int o)
A customized add method that allows you to insert into the last index.
|
void |
clear() |
boolean |
contains(int e)
A Type-Specific implementation of contains.
|
IntArraySet |
copy()
A Function that does a shallow clone of the Collection itself.
|
int |
count(Int2BooleanFunction filter)
Helper function to reduce stream usage that allows to count the valid elements.
|
int |
findFirst(Int2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for the first match.
|
int |
firstInt()
A method to get the first element in the set
|
<E> void |
forEach(E input,
ObjectIntConsumer<E> action)
Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
void |
forEach(IntConsumer action)
A Type Specific foreach function that reduces (un)boxing
|
IntBidirectionalIterator |
iterator()
Returns a Type-Specific Iterator to reduce (un)boxing
|
IntBidirectionalIterator |
iterator(int fromElement)
A type Specific Iterator starting from a given key
|
int |
lastInt()
A method to get the last element in the set
|
boolean |
matchesAll(Int2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for all matches.
|
boolean |
matchesAny(Int2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for any matches.
|
boolean |
matchesNone(Int2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for no matches.
|
boolean |
moveToFirst(int o)
A specific move method to move a given key to the first index.
|
boolean |
moveToLast(int o)
A specific move method to move a given key to the last index.
|
int |
pollFirstInt()
A method to get and remove the first element in the set
|
int |
pollLastInt()
A method to get and remove the last element in the set
|
int |
reduce(int identity,
IntIntUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
int |
reduce(IntIntUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
boolean |
remIf(java.util.function.IntPredicate filter)
A Type-Specific removeIf function to reduce (un)boxing.
|
boolean |
remove(int o)
A Type Specific remove function to reduce boxing/unboxing
|
boolean |
removeAll(java.util.Collection<?> c)
Deprecated.
|
boolean |
removeAll(IntCollection c)
A Type-Specific implementation of removeAll.
|
boolean |
removeAll(IntCollection c,
IntConsumer r)
A Type-Specific removeAll function that reduces (un)boxing.
|
boolean |
retainAll(java.util.Collection<?> c)
Deprecated.
|
boolean |
retainAll(IntCollection c)
A Type-Specific implementation of retainAll.
|
boolean |
retainAll(IntCollection c,
IntConsumer r)
A Type-Specific retainAll function that reduces (un)boxing.
|
int |
size() |
java.lang.Object[] |
toArray()
Deprecated.
|
<E> E[] |
toArray(E[] a)
Deprecated.
|
int[] |
toIntArray(int[] a)
A Type-Specific implementation of toArray.
|
equals, hashCodeadd, addAll, addAll, contains, containsAll, containsAll, containsAny, containsAny, remInt, remove, toIntArrayspliterator, synchronize, synchronize, unmodifiableadd, contains, remInt, removeaddAll, addAll, addAll, addAll, containsAll, containsAny, containsAny, parallelPrimitiveStream, pour, primitiveStream, removeIf, toIntArrayarrayflatMap, asAsync, distinct, filter, flatMap, forEach, limit, map, peek, pourAsList, pourAsSet, sortedpublic IntArraySet()
public IntArraySet(int capacity)
capacity - the minimum capacity of the internal arrayjava.lang.NegativeArraySizeException - if the capacity is negativepublic IntArraySet(int[] array)
array - the array that should be used for set.public IntArraySet(int[] 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 IntArraySet(java.util.Collection<? extends java.lang.Integer> c)
c - the elements that should be added to the set.public IntArraySet(IntCollection c)
c - the elements that should be added to the set.@Deprecated public IntArraySet(java.util.Set<? extends java.lang.Integer> s)
s - the set the element should be taken frompublic IntArraySet(IntSet s)
s - the set the element should be taken frompublic boolean add(int o)
IntCollectionadd in interface IntCollectiono - the element that should be addedpublic boolean addAndMoveToFirst(int o)
IntOrderedSetaddAndMoveToFirst in interface IntOrderedSeto - the element that should be insertedSet.add(Object)public boolean addAndMoveToLast(int o)
IntOrderedSetaddAndMoveToLast in interface IntOrderedSeto - the element that should be insertedSet.add(Object)public boolean moveToFirst(int o)
IntOrderedSetmoveToFirst in interface IntOrderedSeto - that should be moved to the first indexpublic boolean moveToLast(int o)
IntOrderedSetmoveToLast in interface IntOrderedSeto - that should be moved to the first lastpublic boolean contains(int e)
AbstractIntCollectioncontains in interface IntCollectioncontains in class AbstractIntCollectione - the element that should be searched for.public int firstInt()
IntOrderedSetfirstInt in interface IntOrderedSetpublic int lastInt()
IntOrderedSetlastInt in interface IntOrderedSetpublic boolean removeAll(IntCollection c)
AbstractIntCollectionremoveAll in interface IntCollectionremoveAll in class AbstractIntCollectionc - the elements that should be deletedCollection.removeAll(Collection)public boolean removeAll(IntCollection c, IntConsumer r)
IntCollectionremoveAll in interface IntCollectionremoveAll in class AbstractIntCollectionc - the collection of elements that should be removedr - elements that got removedCollection.removeAll(Collection)public boolean retainAll(IntCollection c)
AbstractIntCollectionretainAll in interface IntCollectionretainAll in class AbstractIntCollectionc - the elements that should be keptCollection.retainAll(Collection)public boolean retainAll(IntCollection c, IntConsumer r)
IntCollectionretainAll in interface IntCollectionretainAll in class AbstractIntCollectionc - 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.Integer>removeAll in interface java.util.Set<java.lang.Integer>removeAll in class java.util.AbstractCollection<java.lang.Integer>@Deprecated public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<java.lang.Integer>retainAll in interface java.util.Set<java.lang.Integer>retainAll in class java.util.AbstractCollection<java.lang.Integer>public boolean remove(int o)
IntSetpublic int pollFirstInt()
IntOrderedSetpollFirstInt in interface IntOrderedSetpublic int pollLastInt()
IntOrderedSetpollLastInt in interface IntOrderedSetpublic boolean remIf(java.util.function.IntPredicate filter)
IntCollectionRemoves elements that were selected by the filter
remIf in interface IntCollectionfilter - Filters the elements that should be removedCollection.removeIf(Predicate)public void forEach(IntConsumer action)
IntIterableforEach in interface IntIterableaction - The action to be performed for each elementIterable.forEach(Consumer)public <E> void forEach(E input,
ObjectIntConsumer<E> action)
IntIterableforEach in interface IntIterableE - the generic type of the Objectinput - the object that should be includedaction - The action to be performed for each elementpublic boolean matchesAny(Int2BooleanFunction filter)
IntIterablematchesAny in interface IntIterablefilter - that should be appliedpublic boolean matchesNone(Int2BooleanFunction filter)
IntIterablematchesNone in interface IntIterablefilter - that should be appliedpublic boolean matchesAll(Int2BooleanFunction filter)
IntIterablematchesAll in interface IntIterablefilter - that should be appliedpublic int findFirst(Int2BooleanFunction filter)
IntIterablefindFirst in interface IntIterablefilter - that should be appliedpublic int reduce(int identity,
IntIntUnaryOperator operator)
IntIterablereduce in interface IntIterableidentity - the start valueoperator - the operation that should be appliedpublic int reduce(IntIntUnaryOperator operator)
IntIterablereduce in interface IntIterableoperator - the operation that should be appliedpublic int count(Int2BooleanFunction filter)
IntIterablecount in interface IntIterablefilter - that should be appliedpublic IntBidirectionalIterator iterator()
IntCollectioniterator in interface java.lang.Iterable<java.lang.Integer>iterator in interface java.util.Collection<java.lang.Integer>iterator in interface java.util.Set<java.lang.Integer>iterator in interface IntCollectioniterator in interface IntIterableiterator in interface IntOrderedSetiterator in interface IntSetiterator in class AbstractIntSetCollection.iterator()public IntBidirectionalIterator iterator(int fromElement)
IntOrderedSetiterator in interface IntOrderedSetfromElement - the element the iterator should start frompublic IntArraySet copy()
IntCollectioncopy in interface IntCollectioncopy in interface IntOrderedSetcopy in interface IntSetcopy in class AbstractIntSetpublic void clear()
clear in interface java.util.Collection<java.lang.Integer>clear in interface java.util.Set<java.lang.Integer>clear in class java.util.AbstractCollection<java.lang.Integer>public int size()
size in interface java.util.Collection<java.lang.Integer>size in interface java.util.Set<java.lang.Integer>size in class java.util.AbstractCollection<java.lang.Integer>public int[] toIntArray(int[] a)
AbstractIntCollectiontoIntArray in interface IntCollectiontoIntArray in class AbstractIntCollectiona - 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.Integer>toArray in interface java.util.Set<java.lang.Integer>toArray in class java.util.AbstractCollection<java.lang.Integer>@Deprecated public <E> E[] toArray(E[] a)
toArray in interface java.util.Collection<java.lang.Integer>toArray in interface java.util.Set<java.lang.Integer>toArray in class java.util.AbstractCollection<java.lang.Integer>