Klasse ImmutableDoubleOpenHashSet

Alle implementierten Schnittstellen:
Iterable<Double>, Collection<Double>, Set<Double>, DoubleCollection, DoubleIterable, DoubleOrderedSet, DoubleSet, ISizeProvider

public class ImmutableDoubleOpenHashSet extends AbstractDoubleSet implements DoubleOrderedSet
A Type Specific Custom implementation of the HashSet Instead of using Wrapper Object Arrays for storing keys and values there is dedicated arrays for storing keys. Extra to that there is a couple quality of life functions provided
  • Konstruktordetails

    • ImmutableDoubleOpenHashSet

      public ImmutableDoubleOpenHashSet(double[] array)
      Helper constructor that allow to create a set from unboxed values
      Parameter:
      array - the elements that should be put into the set
    • ImmutableDoubleOpenHashSet

      public ImmutableDoubleOpenHashSet(double[] array, float loadFactor)
      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
      Löst aus:
      IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1
    • ImmutableDoubleOpenHashSet

      public ImmutableDoubleOpenHashSet(double[] array, int offset, int length)
      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
      Löst aus:
      IllegalStateException - if offset and length causes to step outside of the arrays range
    • ImmutableDoubleOpenHashSet

      public ImmutableDoubleOpenHashSet(double[] array, int offset, int length, float loadFactor)
      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
      Löst aus:
      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
    • ImmutableDoubleOpenHashSet

      @Deprecated public ImmutableDoubleOpenHashSet(Collection<? extends Double> 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 Set
    • ImmutableDoubleOpenHashSet

      @Deprecated public ImmutableDoubleOpenHashSet(Collection<? extends Double> collection, float loadFactor)
      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
      Löst aus:
      IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1
    • ImmutableDoubleOpenHashSet

      public ImmutableDoubleOpenHashSet(DoubleCollection 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 Set
    • ImmutableDoubleOpenHashSet

      public ImmutableDoubleOpenHashSet(DoubleCollection collection, float loadFactor)
      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
      Löst aus:
      IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1
    • ImmutableDoubleOpenHashSet

      public ImmutableDoubleOpenHashSet(Iterator<Double> 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
    • ImmutableDoubleOpenHashSet

      public ImmutableDoubleOpenHashSet(Iterator<Double> iterator, float loadFactor)
      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
      Löst aus:
      IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1
    • ImmutableDoubleOpenHashSet

      public ImmutableDoubleOpenHashSet(DoubleIterator 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
    • ImmutableDoubleOpenHashSet

      public ImmutableDoubleOpenHashSet(DoubleIterator iterator, float loadFactor)
      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
      Löst aus:
      IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1
  • Methodendetails

    • add

      public boolean add(double o)
      Beschreibung aus Schnittstelle kopiert: DoubleCollection
      A Type-Specific add function to reduce (un)boxing
      Angegeben von:
      add in Schnittstelle DoubleCollection
      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 Double> c)
      Veraltet.
      Beschreibung aus Klasse kopiert: AbstractDoubleCollection

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

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

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

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

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

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

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

      public boolean contains(Object o)
      Beschreibung aus Klasse kopiert: AbstractDoubleCollection

      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<Double>
      Angegeben von:
      contains in Schnittstelle DoubleCollection
      Angegeben von:
      contains in Schnittstelle DoubleSet
      Angegeben von:
      contains in Schnittstelle Set<Double>
      Setzt außer Kraft:
      contains in Klasse AbstractDoubleCollection
    • firstDouble

      public double firstDouble()
      Beschreibung aus Schnittstelle kopiert: DoubleOrderedSet
      A method to get the first element in the set
      Angegeben von:
      firstDouble in Schnittstelle DoubleOrderedSet
      Gibt zurück:
      first element in the set
    • pollFirstDouble

      public double pollFirstDouble()
      Beschreibung aus Schnittstelle kopiert: DoubleOrderedSet
      A method to get and remove the first element in the set
      Angegeben von:
      pollFirstDouble in Schnittstelle DoubleOrderedSet
      Gibt zurück:
      first element in the set
    • lastDouble

      public double lastDouble()
      Beschreibung aus Schnittstelle kopiert: DoubleOrderedSet
      A method to get the last element in the set
      Angegeben von:
      lastDouble in Schnittstelle DoubleOrderedSet
      Gibt zurück:
      last element in the set
    • pollLastDouble

      public double pollLastDouble()
      Beschreibung aus Schnittstelle kopiert: DoubleOrderedSet
      A method to get and remove the last element in the set
      Angegeben von:
      pollLastDouble in Schnittstelle DoubleOrderedSet
      Gibt zurück:
      last element in the set
    • remove

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

      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<Double>
      Angegeben von:
      remove in Schnittstelle DoubleCollection
      Angegeben von:
      remove in Schnittstelle DoubleSet
      Angegeben von:
      remove in Schnittstelle Set<Double>
      Setzt außer Kraft:
      remove in Klasse AbstractDoubleCollection
    • contains

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

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

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

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

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

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

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

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

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

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

      public DoubleListIterator iterator()
      Beschreibung aus Schnittstelle kopiert: DoubleCollection
      Returns a Type-Specific Iterator to reduce (un)boxing
      Angegeben von:
      iterator in Schnittstelle Collection<Double>
      Angegeben von:
      iterator in Schnittstelle DoubleCollection
      Angegeben von:
      iterator in Schnittstelle DoubleIterable
      Angegeben von:
      iterator in Schnittstelle DoubleOrderedSet
      Angegeben von:
      iterator in Schnittstelle DoubleSet
      Angegeben von:
      iterator in Schnittstelle Iterable<Double>
      Angegeben von:
      iterator in Schnittstelle Set<Double>
      Angegeben von:
      iterator in Klasse AbstractDoubleSet
      Gibt zurück:
      a iterator of the collection
      Siehe auch:
    • iterator

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

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

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

      Beschreibung aus Schnittstelle kopiert: DoubleCollection
      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 DoubleCollection
      Angegeben von:
      copy in Schnittstelle DoubleOrderedSet
      Angegeben von:
      copy in Schnittstelle DoubleSet
      Setzt außer Kraft:
      copy in Klasse AbstractDoubleSet
      Gibt zurück:
      a Shallow Copy of the collection
    • clear

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

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