Klasse FloatOpenCustomHashSet

Alle implementierten Schnittstellen:
Iterable<Float>, Collection<Float>, Set<Float>, FloatCollection, FloatIterable, FloatSet, ISizeProvider, ITrimmable
Bekannte direkte Unterklassen:
FloatLinkedOpenCustomHashSet

public class FloatOpenCustomHashSet extends AbstractFloatSet implements ITrimmable
A Type Specific HashSet that allows for custom HashControl. For cases where Objects/primitive do not allow hashcoding this can be really useful and provide a lot of control.
  • Konstruktordetails

    • FloatOpenCustomHashSet

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

      public FloatOpenCustomHashSet(int minCapacity, FloatStrategy 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
    • FloatOpenCustomHashSet

      public FloatOpenCustomHashSet(int minCapacity, float loadFactor, FloatStrategy 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
    • FloatOpenCustomHashSet

      public FloatOpenCustomHashSet(float[] array, FloatStrategy 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
    • FloatOpenCustomHashSet

      public FloatOpenCustomHashSet(float[] array, float loadFactor, FloatStrategy 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
    • FloatOpenCustomHashSet

      public FloatOpenCustomHashSet(float[] array, int offset, int length, FloatStrategy 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
    • FloatOpenCustomHashSet

      public FloatOpenCustomHashSet(float[] array, int offset, int length, float loadFactor, FloatStrategy 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
    • FloatOpenCustomHashSet

      @Deprecated public FloatOpenCustomHashSet(Collection<? extends Float> collection, FloatStrategy 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
    • FloatOpenCustomHashSet

      @Deprecated public FloatOpenCustomHashSet(Collection<? extends Float> collection, float loadFactor, FloatStrategy 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
    • FloatOpenCustomHashSet

      public FloatOpenCustomHashSet(FloatCollection collection, FloatStrategy 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
    • FloatOpenCustomHashSet

      public FloatOpenCustomHashSet(FloatCollection collection, float loadFactor, FloatStrategy 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
    • FloatOpenCustomHashSet

      public FloatOpenCustomHashSet(Iterator<Float> iterator, FloatStrategy 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
    • FloatOpenCustomHashSet

      public FloatOpenCustomHashSet(Iterator<Float> iterator, float loadFactor, FloatStrategy 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
    • FloatOpenCustomHashSet

      public FloatOpenCustomHashSet(FloatIterator iterator, FloatStrategy 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
    • FloatOpenCustomHashSet

      public FloatOpenCustomHashSet(FloatIterator iterator, float loadFactor, FloatStrategy 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

    • getStrategy

      public FloatStrategy getStrategy()
      Helper getter function to get the current strategy
      Gibt zurück:
      the current strategy
    • add

      public boolean add(float o)
      Beschreibung aus Schnittstelle kopiert: FloatCollection
      A Type-Specific add function to reduce (un)boxing
      Angegeben von:
      add in Schnittstelle FloatCollection
      Parameter:
      o - the element that should be added
      Gibt zurück:
      true if the element was added to the collection
    • addAll

      @Deprecated public boolean addAll(Collection<? extends Float> c)
      Veraltet.
      Beschreibung aus Klasse kopiert: AbstractFloatCollection

      This default implementation delegates to the corresponding type-specific function.

      Angegeben von:
      addAll in Schnittstelle Collection<Float>
      Angegeben von:
      addAll in Schnittstelle Set<Float>
      Setzt außer Kraft:
      addAll in Klasse AbstractFloatCollection
    • addAll

      public boolean addAll(FloatCollection c)
      Beschreibung aus Schnittstelle kopiert: FloatCollection
      A Type-Specific addAll function to reduce (un)boxing
      Angegeben von:
      addAll in Schnittstelle FloatCollection
      Setzt außer Kraft:
      addAll in Klasse AbstractFloatCollection
      Parameter:
      c - the collection of elements that should be added
      Gibt zurück:
      true if elements were added into the collection
    • contains

      public boolean contains(float o)
      Beschreibung aus Klasse kopiert: AbstractFloatCollection
      A Type-Specific implementation of contains. This implementation iterates over the elements and returns true if the value match.
      Angegeben von:
      contains in Schnittstelle FloatCollection
      Setzt außer Kraft:
      contains in Klasse AbstractFloatCollection
      Parameter:
      o - the element that should be searched for.
      Gibt zurück:
      true if the value was found.
    • remove

      public boolean remove(float o)
      Beschreibung aus Schnittstelle kopiert: FloatSet
      A Type Specific remove function to reduce boxing/unboxing
      Angegeben von:
      remove in Schnittstelle FloatSet
      Parameter:
      o - the element that should be removed
      Gibt zurück:
      true if the element was removed
    • trim

      public boolean trim(int size)
      Beschreibung aus Schnittstelle kopiert: ITrimmable
      Trims the original collection down to the size of the current elements or the requested size depending which is bigger
      Angegeben von:
      trim in Schnittstelle ITrimmable
      Parameter:
      size - the requested trim size.
      Gibt zurück:
      if the internal array has been trimmed.
    • 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
      Parameter:
      size - the amount of elements that should be allowed
    • iterator

      public FloatIterator iterator()
      Beschreibung aus Schnittstelle kopiert: FloatCollection
      Returns a Type-Specific Iterator to reduce (un)boxing
      Angegeben von:
      iterator in Schnittstelle Collection<Float>
      Angegeben von:
      iterator in Schnittstelle FloatCollection
      Angegeben von:
      iterator in Schnittstelle FloatIterable
      Angegeben von:
      iterator in Schnittstelle FloatSet
      Angegeben von:
      iterator in Schnittstelle Iterable<Float>
      Angegeben von:
      iterator in Schnittstelle Set<Float>
      Angegeben von:
      iterator in Klasse AbstractFloatSet
      Gibt zurück:
      a iterator of the collection
      Siehe auch:
    • toFloatArray

      public float[] toFloatArray(float[] a)
      Beschreibung aus Klasse kopiert: AbstractFloatCollection
      A Type-Specific implementation of toArray. This implementation iterates over all elements and unwraps them into primitive type.
      Angegeben von:
      toFloatArray in Schnittstelle FloatCollection
      Setzt außer Kraft:
      toFloatArray in Klasse AbstractFloatCollection
      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<Float>
      Angegeben von:
      toArray in Schnittstelle Set<Float>
      Setzt außer Kraft:
      toArray in Klasse AbstractCollection<Float>
    • toArray

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

      public FloatOpenCustomHashSet copy()
      Beschreibung aus Schnittstelle kopiert: FloatCollection
      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 FloatCollection
      Angegeben von:
      copy in Schnittstelle FloatSet
      Setzt außer Kraft:
      copy in Klasse AbstractFloatSet
      Gibt zurück:
      a Shallow Copy of the collection
    • clear

      public void clear()
      Angegeben von:
      clear in Schnittstelle Collection<Float>
      Angegeben von:
      clear in Schnittstelle Set<Float>
      Setzt außer Kraft:
      clear in Klasse AbstractCollection<Float>
    • size

      public int size()
      Angegeben von:
      size in Schnittstelle Collection<Float>
      Angegeben von:
      size in Schnittstelle ISizeProvider
      Angegeben von:
      size in Schnittstelle Set<Float>
      Angegeben von:
      size in Klasse AbstractCollection<Float>
      Gibt zurück:
      the size of the implementing Collection
    • forEach

      public void forEach(FloatConsumer action)
      Beschreibung aus Schnittstelle kopiert: FloatIterable
      A Type Specific foreach function that reduces (un)boxing
      Angegeben von:
      forEach in Schnittstelle FloatIterable
      Parameter:
      action - The action to be performed for each element
      Siehe auch:
    • forEachIndexed

      public void forEachIndexed(IntFloatConsumer action)
      Beschreibung aus Schnittstelle kopiert: FloatIterable
      A Indexed forEach implementation that allows you to keep track of how many elements were already iterated over.
      Angegeben von:
      forEachIndexed in Schnittstelle FloatIterable
      Parameter:
      action - The action to be performed for each element
    • forEach

      public <E> void forEach(E input, ObjectFloatConsumer<E> action)
      Beschreibung aus Schnittstelle kopiert: FloatIterable
      Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
      Angegeben von:
      forEach in Schnittstelle FloatIterable
      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(FloatPredicate filter)
      Beschreibung aus Schnittstelle kopiert: FloatIterable
      Helper function to reduce stream usage that allows to filter for any matches.
      Angegeben von:
      matchesAny in Schnittstelle FloatIterable
      Parameter:
      filter - that should be applied
      Gibt zurück:
      true if any matches were found
    • matchesNone

      public boolean matchesNone(FloatPredicate filter)
      Beschreibung aus Schnittstelle kopiert: FloatIterable
      Helper function to reduce stream usage that allows to filter for no matches.
      Angegeben von:
      matchesNone in Schnittstelle FloatIterable
      Parameter:
      filter - that should be applied
      Gibt zurück:
      true if no matches were found
    • matchesAll

      public boolean matchesAll(FloatPredicate filter)
      Beschreibung aus Schnittstelle kopiert: FloatIterable
      Helper function to reduce stream usage that allows to filter for all matches.
      Angegeben von:
      matchesAll in Schnittstelle FloatIterable
      Parameter:
      filter - that should be applied
      Gibt zurück:
      true if all matches.
    • reduce

      public float reduce(float identity, FloatFloatUnaryOperator operator)
      Beschreibung aus Schnittstelle kopiert: FloatIterable
      Performs a reduction on the elements of this Iterable
      Angegeben von:
      reduce in Schnittstelle FloatIterable
      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 float reduce(FloatFloatUnaryOperator operator)
      Beschreibung aus Schnittstelle kopiert: FloatIterable
      Performs a reduction on the elements of this Iterable
      Angegeben von:
      reduce in Schnittstelle FloatIterable
      Parameter:
      operator - the operation that should be applied
      Gibt zurück:
      the reduction result, returns null value if nothing was found
    • findFirst

      public float findFirst(FloatPredicate filter)
      Beschreibung aus Schnittstelle kopiert: FloatIterable
      Helper function to reduce stream usage that allows to filter for the first match.
      Angegeben von:
      findFirst in Schnittstelle FloatIterable
      Parameter:
      filter - that should be applied
      Gibt zurück:
      the found value or the null equivalent variant.
    • count

      public int count(FloatPredicate filter)
      Beschreibung aus Schnittstelle kopiert: FloatIterable
      Helper function to reduce stream usage that allows to count the valid elements.
      Angegeben von:
      count in Schnittstelle FloatIterable
      Parameter:
      filter - that should be applied
      Gibt zurück:
      the amount of Valid Elements