Klasse IntLinkedOpenHashSet

Alle implementierten Schnittstellen:
Iterable<Integer>, Collection<Integer>, Set<Integer>, IntCollection, IntIterable, IntOrderedSet, IntSet, ISizeProvider, ITrimmable

public class IntLinkedOpenHashSet extends IntOpenHashSet implements IntOrderedSet
A Type Specific LinkedHashMap implementation that uses specific arrays to create links between nodes to remove the wrapping of elements to greatly reduce memory usage. In Addition adding some helper methods to move around elements. This implementation of SortedSet does not support SubSet of any kind. It implements the interface due to sortability and first/last access
  • Konstruktordetails

    • IntLinkedOpenHashSet

      public IntLinkedOpenHashSet()
      Default Constructor
    • IntLinkedOpenHashSet

      public IntLinkedOpenHashSet(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
    • IntLinkedOpenHashSet

      public IntLinkedOpenHashSet(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
    • IntLinkedOpenHashSet

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

      public IntLinkedOpenHashSet(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
    • IntLinkedOpenHashSet

      public IntLinkedOpenHashSet(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
    • IntLinkedOpenHashSet

      public IntLinkedOpenHashSet(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
    • IntLinkedOpenHashSet

      @Deprecated public IntLinkedOpenHashSet(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
    • IntLinkedOpenHashSet

      @Deprecated public IntLinkedOpenHashSet(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
    • IntLinkedOpenHashSet

      public IntLinkedOpenHashSet(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
    • IntLinkedOpenHashSet

      public IntLinkedOpenHashSet(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
    • IntLinkedOpenHashSet

      public IntLinkedOpenHashSet(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
    • IntLinkedOpenHashSet

      public IntLinkedOpenHashSet(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
    • IntLinkedOpenHashSet

      public IntLinkedOpenHashSet(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
    • IntLinkedOpenHashSet

      public IntLinkedOpenHashSet(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

    • addAndMoveToFirst

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

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

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

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

      public int firstInt()
      Beschreibung aus Schnittstelle kopiert: IntOrderedSet
      A method to get the first element in the set
      Angegeben von:
      firstInt in Schnittstelle IntOrderedSet
      Gibt zurück:
      first element in the set
    • pollFirstInt

      public int pollFirstInt()
      Beschreibung aus Schnittstelle kopiert: IntOrderedSet
      A method to get and remove the first element in the set
      Angegeben von:
      pollFirstInt in Schnittstelle IntOrderedSet
      Gibt zurück:
      first element in the set
    • lastInt

      public int lastInt()
      Beschreibung aus Schnittstelle kopiert: IntOrderedSet
      A method to get the last element in the set
      Angegeben von:
      lastInt in Schnittstelle IntOrderedSet
      Gibt zurück:
      last element in the set
    • pollLastInt

      public int pollLastInt()
      Beschreibung aus Schnittstelle kopiert: IntOrderedSet
      A method to get and remove the last element in the set
      Angegeben von:
      pollLastInt in Schnittstelle IntOrderedSet
      Gibt zurück:
      last element in the set
    • 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 IntOpenHashSet
      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 IntOpenHashSet
    • 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 IntOpenHashSet
    • 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
      Setzt außer Kraft:
      forEach in Klasse IntOpenHashSet
      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
      Setzt außer Kraft:
      forEachIndexed in Klasse IntOpenHashSet
      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
      Setzt außer Kraft:
      forEach in Klasse IntOpenHashSet
      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
      Setzt außer Kraft:
      matchesAny in Klasse IntOpenHashSet
      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
      Setzt außer Kraft:
      matchesNone in Klasse IntOpenHashSet
      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
      Setzt außer Kraft:
      matchesAll in Klasse IntOpenHashSet
      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
      Setzt außer Kraft:
      reduce in Klasse IntOpenHashSet
      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
      Setzt außer Kraft:
      reduce in Klasse IntOpenHashSet
      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
      Setzt außer Kraft:
      findFirst in Klasse IntOpenHashSet
      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
      Setzt außer Kraft:
      count in Klasse IntOpenHashSet
      Parameter:
      filter - that should be applied
      Gibt zurück:
      the amount of Valid Elements
    • 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 IntOpenHashSet
    • 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 IntOpenHashSet
      Parameter:
      size - the amount of elements that should be allowed
    • iterator

      public IntListIterator 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 IntOrderedSet
      Angegeben von:
      iterator in Schnittstelle IntSet
      Angegeben von:
      iterator in Schnittstelle Iterable<Integer>
      Angegeben von:
      iterator in Schnittstelle Set<Integer>
      Setzt außer Kraft:
      iterator in Klasse IntOpenHashSet
      Gibt zurück:
      a iterator of the collection
      Siehe auch:
    • iterator

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

      public IntLinkedOpenHashSet 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 IntOrderedSet
      Angegeben von:
      copy in Schnittstelle IntSet
      Setzt außer Kraft:
      copy in Klasse IntOpenHashSet
      Gibt zurück:
      a Shallow Copy of the collection