Klasse ByteLinkedOpenCustomHashSet

Alle implementierten Schnittstellen:
Iterable<Byte>, Collection<Byte>, Set<Byte>, ByteCollection, ByteIterable, ByteOrderedSet, ByteSet, ISizeProvider, ITrimmable

public class ByteLinkedOpenCustomHashSet extends ByteOpenCustomHashSet implements ByteOrderedSet
A Type Specific LinkedHashSet that allows for custom HashControl. That uses arrays to create links between nodes. For cases where Objects/primitive do not allow hashcoding this can be really useful and provide a lot of control. This implementation of SortedSet does not support SubSet of any kind. It implements the interface due to sortability and first/last access
  • Konstruktordetails

    • ByteLinkedOpenCustomHashSet

      public ByteLinkedOpenCustomHashSet(ByteStrategy strategy)
      Default Contstructor
      Parameter:
      strategy - the strategy that allows hash control.
      Löst aus:
      NullPointerException - if Strategy is null
    • ByteLinkedOpenCustomHashSet

      public ByteLinkedOpenCustomHashSet(int minCapacity, ByteStrategy strategy)
      Constructor that defines the minimum capacity
      Parameter:
      minCapacity - the minimum capacity the HashSet is allowed to be.
      strategy - the strategy that allows hash control.
      Löst aus:
      NullPointerException - if Strategy is null
      IllegalStateException - if the minimum capacity is negative
    • ByteLinkedOpenCustomHashSet

      public ByteLinkedOpenCustomHashSet(int minCapacity, float loadFactor, ByteStrategy strategy)
      Constructor that defines the minimum capacity and load factor
      Parameter:
      minCapacity - the minimum capacity the HashSet is allowed to be.
      loadFactor - the percentage of how full the backing array can be before they resize
      strategy - the strategy that allows hash control.
      Löst aus:
      NullPointerException - if Strategy is null
      IllegalStateException - if the minimum capacity is negative
      IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1
    • ByteLinkedOpenCustomHashSet

      public ByteLinkedOpenCustomHashSet(byte[] array, ByteStrategy strategy)
      Helper constructor that allow to create a set from unboxed values
      Parameter:
      array - the elements that should be put into the set
      strategy - the strategy that allows hash control.
      Löst aus:
      NullPointerException - if Strategy is null
    • ByteLinkedOpenCustomHashSet

      public ByteLinkedOpenCustomHashSet(byte[] array, float loadFactor, ByteStrategy strategy)
      Helper constructor that allow to create a set from unboxed values
      Parameter:
      array - the elements that should be put into the set
      loadFactor - the percentage of how full the backing array can be before they resize
      strategy - the strategy that allows hash control.
      Löst aus:
      NullPointerException - if Strategy is null
      IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1
    • ByteLinkedOpenCustomHashSet

      public ByteLinkedOpenCustomHashSet(byte[] array, int offset, int length, ByteStrategy strategy)
      Helper constructor that allow to create a set from unboxed values
      Parameter:
      array - the elements that should be put into the set
      offset - the starting index within the array that should be used
      length - the amount of elements used from the array
      strategy - the strategy that allows hash control.
      Löst aus:
      NullPointerException - if Strategy is null
      IllegalStateException - if offset and length causes to step outside of the arrays range
    • ByteLinkedOpenCustomHashSet

      public ByteLinkedOpenCustomHashSet(byte[] array, int offset, int length, float loadFactor, ByteStrategy strategy)
      Helper constructor that allow to create a set from unboxed values
      Parameter:
      array - the elements that should be put into the set
      offset - the starting index within the array that should be used
      length - the amount of elements used from the array
      loadFactor - the percentage of how full the backing array can be before they resize
      strategy - the strategy that allows hash control.
      Löst aus:
      NullPointerException - if Strategy is null
      IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1
      IllegalStateException - if offset and length causes to step outside of the arrays range
    • ByteLinkedOpenCustomHashSet

      @Deprecated public ByteLinkedOpenCustomHashSet(Collection<? extends Byte> collection, ByteStrategy strategy)
      Veraltet.
      A Helper constructor that allows to create a Set with exactly the same values as the provided collection.
      Parameter:
      collection - the set the elements should be added to the Set
      strategy - the strategy that allows hash control.
      Löst aus:
      NullPointerException - if Strategy is null
    • ByteLinkedOpenCustomHashSet

      @Deprecated public ByteLinkedOpenCustomHashSet(Collection<? extends Byte> collection, float loadFactor, ByteStrategy strategy)
      Veraltet.
      A Helper constructor that allows to create a Set with exactly the same values as the provided collection.
      Parameter:
      collection - the set the elements should be added to the Set
      loadFactor - the percentage of how full the backing array can be before they resize
      strategy - the strategy that allows hash control.
      Löst aus:
      NullPointerException - if Strategy is null
      IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1
    • ByteLinkedOpenCustomHashSet

      public ByteLinkedOpenCustomHashSet(ByteCollection collection, ByteStrategy strategy)
      A Helper constructor that allows to create a Set with exactly the same values as the provided collection.
      Parameter:
      collection - the set the elements should be added to the Set
      strategy - the strategy that allows hash control.
      Löst aus:
      NullPointerException - if Strategy is null
    • ByteLinkedOpenCustomHashSet

      public ByteLinkedOpenCustomHashSet(ByteCollection collection, float loadFactor, ByteStrategy strategy)
      A Helper constructor that allows to create a Set with exactly the same values as the provided collection.
      Parameter:
      collection - the set the elements should be added to the Set
      loadFactor - the percentage of how full the backing array can be before they resize
      strategy - the strategy that allows hash control.
      Löst aus:
      NullPointerException - if Strategy is null
      IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1
    • ByteLinkedOpenCustomHashSet

      public ByteLinkedOpenCustomHashSet(Iterator<Byte> iterator, ByteStrategy strategy)
      A Helper constructor that allows to create a set from a iterator of an unknown size
      Parameter:
      iterator - the elements that should be added to the set
      strategy - the strategy that allows hash control.
      Löst aus:
      NullPointerException - if Strategy is null
    • ByteLinkedOpenCustomHashSet

      public ByteLinkedOpenCustomHashSet(Iterator<Byte> iterator, float loadFactor, ByteStrategy strategy)
      A Helper constructor that allows to create a set from a iterator of an unknown size
      Parameter:
      iterator - the elements that should be added to the set
      loadFactor - the percentage of how full the backing array can be before they resize
      strategy - the strategy that allows hash control.
      Löst aus:
      NullPointerException - if Strategy is null
      IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1
    • ByteLinkedOpenCustomHashSet

      public ByteLinkedOpenCustomHashSet(ByteIterator iterator, ByteStrategy strategy)
      A Helper constructor that allows to create a set from a iterator of an unknown size
      Parameter:
      iterator - the elements that should be added to the set
      strategy - the strategy that allows hash control.
      Löst aus:
      NullPointerException - if Strategy is null
    • ByteLinkedOpenCustomHashSet

      public ByteLinkedOpenCustomHashSet(ByteIterator iterator, float loadFactor, ByteStrategy strategy)
      A Helper constructor that allows to create a set from a iterator of an unknown size
      Parameter:
      iterator - the elements that should be added to the set
      loadFactor - the percentage of how full the backing array can be before they resize
      strategy - the strategy that allows hash control.
      Löst aus:
      NullPointerException - if Strategy is null
      IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1
  • Methodendetails

    • addAndMoveToFirst

      public boolean addAndMoveToFirst(byte o)
      Beschreibung aus Schnittstelle kopiert: ByteOrderedSet
      A customized add method that allows you to insert into the first index.
      Angegeben von:
      addAndMoveToFirst in Schnittstelle ByteOrderedSet
      Parameter:
      o - the element that should be inserted
      Gibt zurück:
      true if it was added
      Siehe auch:
    • addAndMoveToLast

      public boolean addAndMoveToLast(byte o)
      Beschreibung aus Schnittstelle kopiert: ByteOrderedSet
      A customized add method that allows you to insert into the last index.
      Angegeben von:
      addAndMoveToLast in Schnittstelle ByteOrderedSet
      Parameter:
      o - the element that should be inserted
      Gibt zurück:
      true if it was added
      Siehe auch:
    • moveToFirst

      public boolean moveToFirst(byte o)
      Beschreibung aus Schnittstelle kopiert: ByteOrderedSet
      A specific move method to move a given key to the first index.
      Angegeben von:
      moveToFirst in Schnittstelle ByteOrderedSet
      Parameter:
      o - that should be moved to the first index
      Gibt zurück:
      true if the value was moved.
    • moveToLast

      public boolean moveToLast(byte o)
      Beschreibung aus Schnittstelle kopiert: ByteOrderedSet
      A specific move method to move a given key to the last index.
      Angegeben von:
      moveToLast in Schnittstelle ByteOrderedSet
      Parameter:
      o - that should be moved to the first last
      Gibt zurück:
      true if the value was moved.
    • firstByte

      public byte firstByte()
      Beschreibung aus Schnittstelle kopiert: ByteOrderedSet
      A method to get the first element in the set
      Angegeben von:
      firstByte in Schnittstelle ByteOrderedSet
      Gibt zurück:
      first element in the set
    • pollFirstByte

      public byte pollFirstByte()
      Beschreibung aus Schnittstelle kopiert: ByteOrderedSet
      A method to get and remove the first element in the set
      Angegeben von:
      pollFirstByte in Schnittstelle ByteOrderedSet
      Gibt zurück:
      first element in the set
    • lastByte

      public byte lastByte()
      Beschreibung aus Schnittstelle kopiert: ByteOrderedSet
      A method to get the last element in the set
      Angegeben von:
      lastByte in Schnittstelle ByteOrderedSet
      Gibt zurück:
      last element in the set
    • pollLastByte

      public byte pollLastByte()
      Beschreibung aus Schnittstelle kopiert: ByteOrderedSet
      A method to get and remove the last element in the set
      Angegeben von:
      pollLastByte in Schnittstelle ByteOrderedSet
      Gibt zurück:
      last element in the set
    • clear

      public void clear()
      Angegeben von:
      clear in Schnittstelle Collection<Byte>
      Angegeben von:
      clear in Schnittstelle Set<Byte>
      Setzt außer Kraft:
      clear in Klasse ByteOpenCustomHashSet
    • clearAndTrim

      public void clearAndTrim(int size)
      Beschreibung aus Schnittstelle kopiert: ITrimmable
      Trims the collection down to the requested size and clears all elements while doing so
      Angegeben von:
      clearAndTrim in Schnittstelle ITrimmable
      Setzt außer Kraft:
      clearAndTrim in Klasse ByteOpenCustomHashSet
      Parameter:
      size - the amount of elements that should be allowed
    • toByteArray

      public byte[] toByteArray(byte[] a)
      Beschreibung aus Klasse kopiert: AbstractByteCollection
      A Type-Specific implementation of toArray. This implementation iterates over all elements and unwraps them into primitive type.
      Angegeben von:
      toByteArray in Schnittstelle ByteCollection
      Setzt außer Kraft:
      toByteArray in Klasse ByteOpenCustomHashSet
      Parameter:
      a - array that the elements should be injected to. If null or to small a new array with the right size is created
      Gibt zurück:
      an array containing all of the elements in this collection
      Siehe auch:
    • toArray

      @Deprecated public Object[] toArray()
      Veraltet.
      Angegeben von:
      toArray in Schnittstelle Collection<Byte>
      Angegeben von:
      toArray in Schnittstelle Set<Byte>
      Setzt außer Kraft:
      toArray in Klasse ByteOpenCustomHashSet
    • toArray

      @Deprecated public <E> E[] toArray(E[] a)
      Veraltet.
      Angegeben von:
      toArray in Schnittstelle Collection<Byte>
      Angegeben von:
      toArray in Schnittstelle Set<Byte>
      Setzt außer Kraft:
      toArray in Klasse ByteOpenCustomHashSet
    • forEach

      public void forEach(ByteConsumer action)
      Beschreibung aus Schnittstelle kopiert: ByteIterable
      A Type Specific foreach function that reduces (un)boxing
      Angegeben von:
      forEach in Schnittstelle ByteIterable
      Setzt außer Kraft:
      forEach in Klasse ByteOpenCustomHashSet
      Parameter:
      action - The action to be performed for each element
      Siehe auch:
    • forEachIndexed

      public void forEachIndexed(IntByteConsumer action)
      Beschreibung aus Schnittstelle kopiert: ByteIterable
      A Indexed forEach implementation that allows you to keep track of how many elements were already iterated over.
      Angegeben von:
      forEachIndexed in Schnittstelle ByteIterable
      Setzt außer Kraft:
      forEachIndexed in Klasse ByteOpenCustomHashSet
      Parameter:
      action - The action to be performed for each element
    • forEach

      public <E> void forEach(E input, ObjectByteConsumer<E> action)
      Beschreibung aus Schnittstelle kopiert: ByteIterable
      Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
      Angegeben von:
      forEach in Schnittstelle ByteIterable
      Setzt außer Kraft:
      forEach in Klasse ByteOpenCustomHashSet
      Typparameter:
      E - the generic type of the Object
      Parameter:
      input - the object that should be included
      action - The action to be performed for each element
    • matchesAny

      public boolean matchesAny(BytePredicate filter)
      Beschreibung aus Schnittstelle kopiert: ByteIterable
      Helper function to reduce stream usage that allows to filter for any matches.
      Angegeben von:
      matchesAny in Schnittstelle ByteIterable
      Setzt außer Kraft:
      matchesAny in Klasse ByteOpenCustomHashSet
      Parameter:
      filter - that should be applied
      Gibt zurück:
      true if any matches were found
    • matchesNone

      public boolean matchesNone(BytePredicate filter)
      Beschreibung aus Schnittstelle kopiert: ByteIterable
      Helper function to reduce stream usage that allows to filter for no matches.
      Angegeben von:
      matchesNone in Schnittstelle ByteIterable
      Setzt außer Kraft:
      matchesNone in Klasse ByteOpenCustomHashSet
      Parameter:
      filter - that should be applied
      Gibt zurück:
      true if no matches were found
    • matchesAll

      public boolean matchesAll(BytePredicate filter)
      Beschreibung aus Schnittstelle kopiert: ByteIterable
      Helper function to reduce stream usage that allows to filter for all matches.
      Angegeben von:
      matchesAll in Schnittstelle ByteIterable
      Setzt außer Kraft:
      matchesAll in Klasse ByteOpenCustomHashSet
      Parameter:
      filter - that should be applied
      Gibt zurück:
      true if all matches.
    • reduce

      public byte reduce(byte identity, ByteByteUnaryOperator operator)
      Beschreibung aus Schnittstelle kopiert: ByteIterable
      Performs a reduction on the elements of this Iterable
      Angegeben von:
      reduce in Schnittstelle ByteIterable
      Setzt außer Kraft:
      reduce in Klasse ByteOpenCustomHashSet
      Parameter:
      identity - the start value
      operator - the operation that should be applied
      Gibt zurück:
      the reduction result, returns identity if nothing was found
    • reduce

      public byte reduce(ByteByteUnaryOperator operator)
      Beschreibung aus Schnittstelle kopiert: ByteIterable
      Performs a reduction on the elements of this Iterable
      Angegeben von:
      reduce in Schnittstelle ByteIterable
      Setzt außer Kraft:
      reduce in Klasse ByteOpenCustomHashSet
      Parameter:
      operator - the operation that should be applied
      Gibt zurück:
      the reduction result, returns null value if nothing was found
    • findFirst

      public byte findFirst(BytePredicate filter)
      Beschreibung aus Schnittstelle kopiert: ByteIterable
      Helper function to reduce stream usage that allows to filter for the first match.
      Angegeben von:
      findFirst in Schnittstelle ByteIterable
      Setzt außer Kraft:
      findFirst in Klasse ByteOpenCustomHashSet
      Parameter:
      filter - that should be applied
      Gibt zurück:
      the found value or the null equivalent variant.
    • count

      public int count(BytePredicate filter)
      Beschreibung aus Schnittstelle kopiert: ByteIterable
      Helper function to reduce stream usage that allows to count the valid elements.
      Angegeben von:
      count in Schnittstelle ByteIterable
      Setzt außer Kraft:
      count in Klasse ByteOpenCustomHashSet
      Parameter:
      filter - that should be applied
      Gibt zurück:
      the amount of Valid Elements
    • iterator

      public ByteListIterator iterator()
      Beschreibung aus Schnittstelle kopiert: ByteCollection
      Returns a Type-Specific Iterator to reduce (un)boxing
      Angegeben von:
      iterator in Schnittstelle ByteCollection
      Angegeben von:
      iterator in Schnittstelle ByteIterable
      Angegeben von:
      iterator in Schnittstelle ByteOrderedSet
      Angegeben von:
      iterator in Schnittstelle ByteSet
      Angegeben von:
      iterator in Schnittstelle Collection<Byte>
      Angegeben von:
      iterator in Schnittstelle Iterable<Byte>
      Angegeben von:
      iterator in Schnittstelle Set<Byte>
      Setzt außer Kraft:
      iterator in Klasse ByteOpenCustomHashSet
      Gibt zurück:
      a iterator of the collection
      Siehe auch:
    • iterator

      public ByteBidirectionalIterator iterator(byte fromElement)
      Beschreibung aus Schnittstelle kopiert: ByteOrderedSet
      A type Specific Iterator starting from a given key
      Angegeben von:
      iterator in Schnittstelle ByteOrderedSet
      Parameter:
      fromElement - the element the iterator should start from
      Gibt zurück:
      a iterator starting from the given element
    • copy

      Beschreibung aus Schnittstelle kopiert: ByteCollection
      A Function that does a shallow clone of the Collection itself. This function is more optimized then a copy constructor since the Collection does not have to be unsorted/resorted. It can be compared to Cloneable but with less exception risk
      Angegeben von:
      copy in Schnittstelle ByteCollection
      Angegeben von:
      copy in Schnittstelle ByteOrderedSet
      Angegeben von:
      copy in Schnittstelle ByteSet
      Setzt außer Kraft:
      copy in Klasse ByteOpenCustomHashSet
      Gibt zurück:
      a Shallow Copy of the collection