Klasse FloatRBTreeSet

Alle implementierten Schnittstellen:
Iterable<Float>, Collection<Float>, NavigableSet<Float>, Set<Float>, SortedSet<Float>, FloatCollection, FloatIterable, FloatNavigableSet, FloatSet, FloatSortedSet, ISizeProvider

public class FloatRBTreeSet extends AbstractFloatSet implements FloatNavigableSet
A Simple Type Specific RB TreeSet implementation that reduces boxing/unboxing. It is using a bit more memory then FastUtil, but it saves a lot of Performance on the Optimized removal and iteration logic. Which makes the implementation actually useable and does not get outperformed by Javas default implementation.
  • Konstruktordetails

    • FloatRBTreeSet

      public FloatRBTreeSet()
      Default Constructor
    • FloatRBTreeSet

      public FloatRBTreeSet(FloatComparator comp)
      Constructor that allows to define the sorter
      Parameter:
      comp - the function that decides how the tree is sorted, can be null
    • FloatRBTreeSet

      public FloatRBTreeSet(float[] array)
      Helper constructor that allow to create a set from an array
      Parameter:
      array - the elements that should be used
    • FloatRBTreeSet

      public FloatRBTreeSet(float[] array, int offset, int length)
      Helper constructor that allow to create a set from an array
      Parameter:
      array - the elements that should be used
      offset - the starting index within the array
      length - the amount of elements that are within the array
      Löst aus:
      IllegalStateException - if offset and length causes to step outside of the arrays range
    • FloatRBTreeSet

      public FloatRBTreeSet(float[] array, FloatComparator comp)
      Helper constructor that allow to create a set from an array
      Parameter:
      array - the elements that should be used
      comp - the sorter of the tree, can be null
    • FloatRBTreeSet

      public FloatRBTreeSet(float[] array, int offset, int length, FloatComparator comp)
      Helper constructor that allow to create a set from an array
      Parameter:
      array - the elements that should be used
      offset - the starting index within the array
      length - the amount of elements that are within the array
      comp - the sorter of the tree, can be null
      Löst aus:
      IllegalStateException - if offset and length causes to step outside of the arrays range
    • FloatRBTreeSet

      public FloatRBTreeSet(FloatSortedSet sortedSet)
      A Helper constructor that allows to create a Set with exactly the same values as the provided SortedSet.
      Parameter:
      sortedSet - the set the elements should be added to the TreeSet
      Note:
      this also includes the Comparator if present
    • FloatRBTreeSet

      @Deprecated public FloatRBTreeSet(Collection<? extends Float> collection)
      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 TreeSet
    • FloatRBTreeSet

      @Deprecated public FloatRBTreeSet(Collection<? extends Float> collection, FloatComparator comp)
      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 TreeSet
      comp - the sorter of the tree, can be null
    • FloatRBTreeSet

      public FloatRBTreeSet(FloatCollection collection)
      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 TreeSet
    • FloatRBTreeSet

      public FloatRBTreeSet(FloatCollection collection, FloatComparator comp)
      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 TreeSet
      comp - the sorter of the tree, can be null
    • FloatRBTreeSet

      public FloatRBTreeSet(Iterator<Float> iterator)
      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
    • FloatRBTreeSet

      public FloatRBTreeSet(Iterator<Float> iterator, FloatComparator comp)
      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
      comp - the sorter of the tree, can be null
    • FloatRBTreeSet

      public FloatRBTreeSet(FloatIterator iterator)
      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
    • FloatRBTreeSet

      public FloatRBTreeSet(FloatIterator iterator, FloatComparator comp)
      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
      comp - the sorter of the tree, can be null
  • Methodendetails

    • setDefaultMaxValue

      public void setDefaultMaxValue(float value)
      Beschreibung aus Schnittstelle kopiert: FloatNavigableSet
      A Helper method to set the max value for SubSets. (Default: float.MIN_VALUE)
      Angegeben von:
      setDefaultMaxValue in Schnittstelle FloatNavigableSet
      Parameter:
      value - the new max value
    • getDefaultMaxValue

      public float getDefaultMaxValue()
      Beschreibung aus Schnittstelle kopiert: FloatNavigableSet
      A Helper method to get the max value for SubSets.
      Angegeben von:
      getDefaultMaxValue in Schnittstelle FloatNavigableSet
      Gibt zurück:
      the default max value.
    • setDefaultMinValue

      public void setDefaultMinValue(float value)
      Beschreibung aus Schnittstelle kopiert: FloatNavigableSet
      A Helper method to set the min value for SubSets. (Default: float.MAX_VALUE)
      Angegeben von:
      setDefaultMinValue in Schnittstelle FloatNavigableSet
      Parameter:
      value - the new min value
    • getDefaultMinValue

      public float getDefaultMinValue()
      Beschreibung aus Schnittstelle kopiert: FloatNavigableSet
      A Helper method to get the min value for SubSets.
      Angegeben von:
      getDefaultMinValue in Schnittstelle FloatNavigableSet
      Gibt zurück:
      the default min value.
    • 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
    • lower

      public float lower(float e)
      Beschreibung aus Schnittstelle kopiert: FloatNavigableSet
      A Type Specific lower method to reduce boxing/unboxing.
      Angegeben von:
      lower in Schnittstelle FloatNavigableSet
      Parameter:
      e - that should be compared with.
      Gibt zurück:
      the greatest lower key that can be found
    • floor

      public float floor(float e)
      Beschreibung aus Schnittstelle kopiert: FloatNavigableSet
      A Type Specific floor method to reduce boxing/unboxing.
      Angegeben von:
      floor in Schnittstelle FloatNavigableSet
      Parameter:
      e - that should be compared with.
      Gibt zurück:
      the greatest lower or equal key that can be found
    • higher

      public float higher(float e)
      Beschreibung aus Schnittstelle kopiert: FloatNavigableSet
      A Type Specific higher method to reduce boxing/unboxing.
      Angegeben von:
      higher in Schnittstelle FloatNavigableSet
      Parameter:
      e - that should be compared with.
      Gibt zurück:
      the lowest higher key that can be found
    • ceiling

      public float ceiling(float e)
      Beschreibung aus Schnittstelle kopiert: FloatNavigableSet
      A Type Specific ceiling method to reduce boxing/unboxing.
      Angegeben von:
      ceiling in Schnittstelle FloatNavigableSet
      Parameter:
      e - that should be compared with.
      Gibt zurück:
      the lowest higher or equal key that can be found
    • lower

      public Float lower(Float e)
      Angegeben von:
      lower in Schnittstelle FloatNavigableSet
      Angegeben von:
      lower in Schnittstelle NavigableSet<Float>
    • floor

      public Float floor(Float e)
      Angegeben von:
      floor in Schnittstelle FloatNavigableSet
      Angegeben von:
      floor in Schnittstelle NavigableSet<Float>
    • higher

      public Float higher(Float e)
      Angegeben von:
      higher in Schnittstelle FloatNavigableSet
      Angegeben von:
      higher in Schnittstelle NavigableSet<Float>
    • ceiling

      public Float ceiling(Float e)
      Angegeben von:
      ceiling in Schnittstelle FloatNavigableSet
      Angegeben von:
      ceiling in Schnittstelle NavigableSet<Float>
    • 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
    • contains

      public boolean contains(float e)
      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:
      e - the element that should be searched for.
      Gibt zurück:
      true if the value was found.
    • contains

      public boolean contains(Object e)
      Beschreibung aus Klasse kopiert: AbstractFloatCollection

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

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

      Angegeben von:
      contains in Schnittstelle Collection<Float>
      Angegeben von:
      contains in Schnittstelle FloatCollection
      Angegeben von:
      contains in Schnittstelle FloatSet
      Angegeben von:
      contains in Schnittstelle Set<Float>
      Setzt außer Kraft:
      contains in Klasse AbstractFloatCollection
    • firstFloat

      public float firstFloat()
      Beschreibung aus Schnittstelle kopiert: FloatSortedSet
      A method to get the first element in the set
      Angegeben von:
      firstFloat in Schnittstelle FloatSortedSet
      Gibt zurück:
      first element in the set
    • lastFloat

      public float lastFloat()
      Beschreibung aus Schnittstelle kopiert: FloatSortedSet
      A method to get the last element in the set
      Angegeben von:
      lastFloat in Schnittstelle FloatSortedSet
      Gibt zurück:
      last element in the set
    • 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
    • remove

      public boolean remove(Object o)
      Beschreibung aus Klasse kopiert: AbstractFloatCollection

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

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

      Angegeben von:
      remove in Schnittstelle Collection<Float>
      Angegeben von:
      remove in Schnittstelle FloatCollection
      Angegeben von:
      remove in Schnittstelle FloatSet
      Angegeben von:
      remove in Schnittstelle Set<Float>
      Setzt außer Kraft:
      remove in Klasse AbstractFloatCollection
    • pollFirstFloat

      public float pollFirstFloat()
      Beschreibung aus Schnittstelle kopiert: FloatSortedSet
      A method to get and remove the first element in the set
      Angegeben von:
      pollFirstFloat in Schnittstelle FloatSortedSet
      Gibt zurück:
      first element in the set
    • pollLastFloat

      public float pollLastFloat()
      Beschreibung aus Schnittstelle kopiert: FloatSortedSet
      A method to get and remove the last element in the set
      Angegeben von:
      pollLastFloat in Schnittstelle FloatSortedSet
      Gibt zurück:
      last element in the set
    • 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
    • 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>
    • 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 FloatRBTreeSet 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 FloatNavigableSet
      Angegeben von:
      copy in Schnittstelle FloatSet
      Angegeben von:
      copy in Schnittstelle FloatSortedSet
      Setzt außer Kraft:
      copy in Klasse AbstractFloatSet
      Gibt zurück:
      a Shallow Copy of the collection
    • comparator

      public FloatComparator comparator()
      Beschreibung aus Schnittstelle kopiert: FloatSortedSet
      A Type Specific Comparator method
      Angegeben von:
      comparator in Schnittstelle FloatSortedSet
      Angegeben von:
      comparator in Schnittstelle SortedSet<Float>
      Gibt zurück:
      the type specific comparator
    • iterator

      public FloatBidirectionalIterator 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 FloatNavigableSet
      Angegeben von:
      iterator in Schnittstelle FloatSet
      Angegeben von:
      iterator in Schnittstelle FloatSortedSet
      Angegeben von:
      iterator in Schnittstelle Iterable<Float>
      Angegeben von:
      iterator in Schnittstelle NavigableSet<Float>
      Angegeben von:
      iterator in Schnittstelle Set<Float>
      Angegeben von:
      iterator in Klasse AbstractFloatSet
      Gibt zurück:
      a iterator of the collection
      Siehe auch:
    • iterator

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

      public FloatBidirectionalIterator descendingIterator()
      Angegeben von:
      descendingIterator in Schnittstelle FloatNavigableSet
      Angegeben von:
      descendingIterator in Schnittstelle NavigableSet<Float>
      Gibt zurück:
      a Type Specific desendingIterator
    • subSet

      public FloatNavigableSet subSet(float fromElement, boolean fromInclusive, float toElement, boolean toInclusive)
      Beschreibung aus Schnittstelle kopiert: FloatNavigableSet
      A Type Specific SubSet method to reduce boxing/unboxing
      Angegeben von:
      subSet in Schnittstelle FloatNavigableSet
      Parameter:
      fromElement - where the SubSet should start
      fromInclusive - if the fromElement is inclusive or not
      toElement - where the SubSet should end
      toInclusive - if the toElement is inclusive or not
      Gibt zurück:
      a SubSet that is within the range of the desired range
    • headSet

      public FloatNavigableSet headSet(float toElement, boolean inclusive)
      Beschreibung aus Schnittstelle kopiert: FloatNavigableSet
      A Type Specific HeadSet method to reduce boxing/unboxing
      Angegeben von:
      headSet in Schnittstelle FloatNavigableSet
      Parameter:
      toElement - where the HeadSet should end
      inclusive - if the toElement is inclusive or not
      Gibt zurück:
      a HeadSet that is within the range of the desired range
    • tailSet

      public FloatNavigableSet tailSet(float fromElement, boolean inclusive)
      Beschreibung aus Schnittstelle kopiert: FloatNavigableSet
      A Type Specific TailSet method to reduce boxing/unboxing
      Angegeben von:
      tailSet in Schnittstelle FloatNavigableSet
      Parameter:
      fromElement - where the TailSet should start
      inclusive - if the fromElement is inclusive or not
      Gibt zurück:
      a TailSet that is within the range of the desired range
    • descendingSet

      public FloatNavigableSet descendingSet()
      Angegeben von:
      descendingSet in Schnittstelle FloatNavigableSet
      Angegeben von:
      descendingSet in Schnittstelle NavigableSet<Float>
      Gibt zurück:
      a Type Specific desendingSet