public class ByteArraySet extends AbstractByteSet implements ByteOrderedSet
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 |
|---|
ByteArraySet()
Default Constructor
|
ByteArraySet(byte[] array)
Constructur using initial Array
|
ByteArraySet(byte[] array,
int length)
Constructur using initial Array
|
ByteArraySet(ByteCollection c)
A Helper constructor that allows to create a Set with exactly the same values as the provided collection.
|
ByteArraySet(ByteSet s)
A Helper constructor that fast copies the element out of a set into the ArraySet.
|
ByteArraySet(java.util.Collection<? extends java.lang.Byte> c)
Deprecated.
|
ByteArraySet(int capacity)
Minimum Capacity Constructor
|
ByteArraySet(java.util.Set<? extends java.lang.Byte> s)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(byte o)
A Type-Specific add function to reduce (un)boxing
|
boolean |
addAndMoveToFirst(byte o)
A customized add method that allows you to insert into the first index.
|
boolean |
addAndMoveToLast(byte o)
A customized add method that allows you to insert into the last index.
|
void |
clear() |
boolean |
contains(byte e)
A Type-Specific implementation of contains.
|
ByteArraySet |
copy()
A Function that does a shallow clone of the Collection itself.
|
int |
count(Byte2BooleanFunction filter)
Helper function to reduce stream usage that allows to count the valid elements.
|
byte |
findFirst(Byte2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for the first match.
|
byte |
firstByte()
A method to get the first element in the set
|
void |
forEach(ByteConsumer action)
A Type Specific foreach function that reduces (un)boxing
|
<E> void |
forEach(E input,
ObjectByteConsumer<E> action)
Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
ByteBidirectionalIterator |
iterator()
Returns a Type-Specific Iterator to reduce (un)boxing
|
ByteBidirectionalIterator |
iterator(byte fromElement)
A type Specific Iterator starting from a given key
|
byte |
lastByte()
A method to get the last element in the set
|
boolean |
matchesAll(Byte2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for all matches.
|
boolean |
matchesAny(Byte2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for any matches.
|
boolean |
matchesNone(Byte2BooleanFunction filter)
Helper function to reduce stream usage that allows to filter for no matches.
|
boolean |
moveToFirst(byte o)
A specific move method to move a given key to the first index.
|
boolean |
moveToLast(byte o)
A specific move method to move a given key to the last index.
|
byte |
pollFirstByte()
A method to get and remove the first element in the set
|
byte |
pollLastByte()
A method to get and remove the last element in the set
|
byte |
reduce(byte identity,
ByteByteUnaryOperator operator)
Performs a reduction on the
elements of this Iterable
|
byte |
reduce(ByteByteUnaryOperator 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(byte o)
A Type Specific remove function to reduce boxing/unboxing
|
boolean |
removeAll(ByteCollection c)
A Type-Specific implementation of removeAll.
|
boolean |
removeAll(ByteCollection c,
ByteConsumer r)
A Type-Specific removeAll function that reduces (un)boxing.
|
boolean |
removeAll(java.util.Collection<?> c)
Deprecated.
|
boolean |
retainAll(ByteCollection c)
A Type-Specific implementation of retainAll.
|
boolean |
retainAll(ByteCollection c,
ByteConsumer r)
A Type-Specific retainAll function that reduces (un)boxing.
|
boolean |
retainAll(java.util.Collection<?> c)
Deprecated.
|
int |
size() |
java.lang.Object[] |
toArray()
Deprecated.
|
<E> E[] |
toArray(E[] a)
Deprecated.
|
byte[] |
toByteArray(byte[] a)
A Type-Specific implementation of toArray.
|
equals, hashCodeadd, addAll, addAll, contains, containsAll, containsAll, containsAny, containsAny, remByte, remove, toByteArrayspliterator, synchronize, synchronize, unmodifiableadd, contains, remByte, removeaddAll, addAll, addAll, addAll, containsAll, containsAny, containsAny, parallelPrimitiveStream, pour, primitiveStream, removeIf, toByteArrayarrayflatMap, asAsync, distinct, filter, flatMap, forEach, limit, map, peek, pourAsList, pourAsSet, sortedpublic ByteArraySet()
public ByteArraySet(int capacity)
capacity - the minimum capacity of the internal arrayjava.lang.NegativeArraySizeException - if the capacity is negativepublic ByteArraySet(byte[] array)
array - the array that should be used for set.public ByteArraySet(byte[] 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 ByteArraySet(java.util.Collection<? extends java.lang.Byte> c)
c - the elements that should be added to the set.public ByteArraySet(ByteCollection c)
c - the elements that should be added to the set.@Deprecated public ByteArraySet(java.util.Set<? extends java.lang.Byte> s)
s - the set the element should be taken frompublic ByteArraySet(ByteSet s)
s - the set the element should be taken frompublic boolean add(byte o)
ByteCollectionadd in interface ByteCollectiono - the element that should be addedpublic boolean addAndMoveToFirst(byte o)
ByteOrderedSetaddAndMoveToFirst in interface ByteOrderedSeto - the element that should be insertedSet.add(Object)public boolean addAndMoveToLast(byte o)
ByteOrderedSetaddAndMoveToLast in interface ByteOrderedSeto - the element that should be insertedSet.add(Object)public boolean moveToFirst(byte o)
ByteOrderedSetmoveToFirst in interface ByteOrderedSeto - that should be moved to the first indexpublic boolean moveToLast(byte o)
ByteOrderedSetmoveToLast in interface ByteOrderedSeto - that should be moved to the first lastpublic boolean contains(byte e)
AbstractByteCollectioncontains in interface ByteCollectioncontains in class AbstractByteCollectione - the element that should be searched for.public byte firstByte()
ByteOrderedSetfirstByte in interface ByteOrderedSetpublic byte lastByte()
ByteOrderedSetlastByte in interface ByteOrderedSetpublic boolean removeAll(ByteCollection c)
AbstractByteCollectionremoveAll in interface ByteCollectionremoveAll in class AbstractByteCollectionc - the elements that should be deletedCollection.removeAll(Collection)public boolean removeAll(ByteCollection c, ByteConsumer r)
ByteCollectionremoveAll in interface ByteCollectionremoveAll in class AbstractByteCollectionc - the collection of elements that should be removedr - elements that got removedCollection.removeAll(Collection)public boolean retainAll(ByteCollection c)
AbstractByteCollectionretainAll in interface ByteCollectionretainAll in class AbstractByteCollectionc - the elements that should be keptCollection.retainAll(Collection)public boolean retainAll(ByteCollection c, ByteConsumer r)
ByteCollectionretainAll in interface ByteCollectionretainAll in class AbstractByteCollectionc - 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.Byte>removeAll in interface java.util.Set<java.lang.Byte>removeAll in class java.util.AbstractCollection<java.lang.Byte>@Deprecated public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<java.lang.Byte>retainAll in interface java.util.Set<java.lang.Byte>retainAll in class java.util.AbstractCollection<java.lang.Byte>public boolean remove(byte o)
ByteSetpublic byte pollFirstByte()
ByteOrderedSetpollFirstByte in interface ByteOrderedSetpublic byte pollLastByte()
ByteOrderedSetpollLastByte in interface ByteOrderedSetpublic boolean remIf(java.util.function.IntPredicate filter)
ByteCollectionRemoves elements that were selected by the filter
remIf in interface ByteCollectionfilter - Filters the elements that should be removedCollection.removeIf(Predicate)public void forEach(ByteConsumer action)
ByteIterableforEach in interface ByteIterableaction - The action to be performed for each elementIterable.forEach(Consumer)public <E> void forEach(E input,
ObjectByteConsumer<E> action)
ByteIterableforEach in interface ByteIterableE - the generic type of the Objectinput - the object that should be includedaction - The action to be performed for each elementpublic boolean matchesAny(Byte2BooleanFunction filter)
ByteIterablematchesAny in interface ByteIterablefilter - that should be appliedpublic boolean matchesNone(Byte2BooleanFunction filter)
ByteIterablematchesNone in interface ByteIterablefilter - that should be appliedpublic boolean matchesAll(Byte2BooleanFunction filter)
ByteIterablematchesAll in interface ByteIterablefilter - that should be appliedpublic byte findFirst(Byte2BooleanFunction filter)
ByteIterablefindFirst in interface ByteIterablefilter - that should be appliedpublic byte reduce(byte identity,
ByteByteUnaryOperator operator)
ByteIterablereduce in interface ByteIterableidentity - the start valueoperator - the operation that should be appliedpublic byte reduce(ByteByteUnaryOperator operator)
ByteIterablereduce in interface ByteIterableoperator - the operation that should be appliedpublic int count(Byte2BooleanFunction filter)
ByteIterablecount in interface ByteIterablefilter - that should be appliedpublic ByteBidirectionalIterator iterator()
ByteCollectioniterator in interface java.lang.Iterable<java.lang.Byte>iterator in interface java.util.Collection<java.lang.Byte>iterator in interface java.util.Set<java.lang.Byte>iterator in interface ByteCollectioniterator in interface ByteIterableiterator in interface ByteOrderedSetiterator in interface ByteSetiterator in class AbstractByteSetCollection.iterator()public ByteBidirectionalIterator iterator(byte fromElement)
ByteOrderedSetiterator in interface ByteOrderedSetfromElement - the element the iterator should start frompublic ByteArraySet copy()
ByteCollectioncopy in interface ByteCollectioncopy in interface ByteOrderedSetcopy in interface ByteSetcopy in class AbstractByteSetpublic void clear()
clear in interface java.util.Collection<java.lang.Byte>clear in interface java.util.Set<java.lang.Byte>clear in class java.util.AbstractCollection<java.lang.Byte>public int size()
size in interface java.util.Collection<java.lang.Byte>size in interface java.util.Set<java.lang.Byte>size in class java.util.AbstractCollection<java.lang.Byte>public byte[] toByteArray(byte[] a)
AbstractByteCollectiontoByteArray in interface ByteCollectiontoByteArray in class AbstractByteCollectiona - 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.Byte>toArray in interface java.util.Set<java.lang.Byte>toArray in class java.util.AbstractCollection<java.lang.Byte>@Deprecated public <E> E[] toArray(E[] a)
toArray in interface java.util.Collection<java.lang.Byte>toArray in interface java.util.Set<java.lang.Byte>toArray in class java.util.AbstractCollection<java.lang.Byte>