Klasse IntOpenHashSet

Alle implementierten Schnittstellen:
Iterable<Integer>, Collection<Integer>, Set<Integer>, IntCollection, IntIterable, IntSet, ISizeProvider, ITrimmable
Bekannte direkte Unterklassen:
IntLinkedOpenHashSet

public class IntOpenHashSet extends AbstractIntSet implements ITrimmable
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

    • IntOpenHashSet

      public IntOpenHashSet()
      Default Constructor
    • IntOpenHashSet

      public IntOpenHashSet(int minCapacity)
      Constructor that defines the minimum capacity
      Parameter:
      minCapacity - the minimum capacity the HashSet is allowed to be.
      Löst aus:
      IllegalStateException - if the minimum capacity is negative
    • IntOpenHashSet

      public IntOpenHashSet(int minCapacity, float loadFactor)
      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
      Löst aus:
      IllegalStateException - if the minimum capacity is negative
      IllegalStateException - if the loadfactor is either below/equal to 0 or above/equal to 1
    • IntOpenHashSet

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

      public IntOpenHashSet(int[] 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
    • IntOpenHashSet

      public IntOpenHashSet(int[] 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
    • IntOpenHashSet

      public IntOpenHashSet(int[] 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
    • IntOpenHashSet

      @Deprecated public IntOpenHashSet(Collection<? extends Integer> 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
    • IntOpenHashSet

      @Deprecated public IntOpenHashSet(Collection<? extends Integer> 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
    • IntOpenHashSet

      public IntOpenHashSet(IntCollection 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
    • IntOpenHashSet

      public IntOpenHashSet(IntCollection 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
    • IntOpenHashSet

      public IntOpenHashSet(Iterator<Integer> 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
    • IntOpenHashSet

      public IntOpenHashSet(Iterator<Integer> 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
    • IntOpenHashSet

      public IntOpenHashSet(IntIterator 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
    • IntOpenHashSet

      public IntOpenHashSet(IntIterator 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(int o)
      Beschreibung aus Schnittstelle kopiert: IntCollection
      A Type-Specific add function to reduce (un)boxing
      Angegeben von:
      add in Schnittstelle IntCollection
      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 Integer> c)
      Veraltet.
      Beschreibung aus Klasse kopiert: AbstractIntCollection

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

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

      public boolean addAll(IntCollection c)
      Beschreibung aus Schnittstelle kopiert: IntCollection
      A Type-Specific addAll function to reduce (un)boxing
      Angegeben von:
      addAll in Schnittstelle IntCollection
      Setzt außer Kraft:
      addAll in Klasse AbstractIntCollection
      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(Object o)
      Beschreibung aus Klasse kopiert: AbstractIntCollection

      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<Integer>
      Angegeben von:
      contains in Schnittstelle IntCollection
      Angegeben von:
      contains in Schnittstelle IntSet
      Angegeben von:
      contains in Schnittstelle Set<Integer>
      Setzt außer Kraft:
      contains in Klasse AbstractIntCollection
    • remove

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

      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<Integer>
      Angegeben von:
      remove in Schnittstelle IntCollection
      Angegeben von:
      remove in Schnittstelle IntSet
      Angegeben von:
      remove in Schnittstelle Set<Integer>
      Setzt außer Kraft:
      remove in Klasse AbstractIntCollection
    • contains

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

      public boolean remove(int o)
      Beschreibung aus Schnittstelle kopiert: IntSet
      A Type Specific remove function to reduce boxing/unboxing
      Angegeben von:
      remove in Schnittstelle IntSet
      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
    • toIntArray

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

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

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

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

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

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

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

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

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

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

      public IntIterator iterator()
      Beschreibung aus Schnittstelle kopiert: IntCollection
      Returns a Type-Specific Iterator to reduce (un)boxing
      Angegeben von:
      iterator in Schnittstelle Collection<Integer>
      Angegeben von:
      iterator in Schnittstelle IntCollection
      Angegeben von:
      iterator in Schnittstelle IntIterable
      Angegeben von:
      iterator in Schnittstelle IntSet
      Angegeben von:
      iterator in Schnittstelle Iterable<Integer>
      Angegeben von:
      iterator in Schnittstelle Set<Integer>
      Angegeben von:
      iterator in Klasse AbstractIntSet
      Gibt zurück:
      a iterator of the collection
      Siehe auch:
    • copy

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

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

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