Klasse ImmutableObjectOpenHashSet<T>

Typparameter:
T - the keyType of elements maintained by this Collection
Alle implementierten Schnittstellen:
Iterable<T>, Collection<T>, Set<T>, ObjectCollection<T>, ObjectIterable<T>, ObjectOrderedSet<T>, ObjectSet<T>, ISizeProvider

public class ImmutableObjectOpenHashSet<T> extends AbstractObjectSet<T> implements ObjectOrderedSet<T>
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

    • ImmutableObjectOpenHashSet

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

      public ImmutableObjectOpenHashSet(T[] 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
    • ImmutableObjectOpenHashSet

      public ImmutableObjectOpenHashSet(T[] 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
    • ImmutableObjectOpenHashSet

      public ImmutableObjectOpenHashSet(T[] 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
    • ImmutableObjectOpenHashSet

      public ImmutableObjectOpenHashSet(Collection<? extends T> 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
    • ImmutableObjectOpenHashSet

      public ImmutableObjectOpenHashSet(Collection<? extends T> 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
    • ImmutableObjectOpenHashSet

      public ImmutableObjectOpenHashSet(ObjectCollection<T> 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
    • ImmutableObjectOpenHashSet

      public ImmutableObjectOpenHashSet(ObjectCollection<T> 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
    • ImmutableObjectOpenHashSet

      public ImmutableObjectOpenHashSet(Iterator<T> 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
    • ImmutableObjectOpenHashSet

      public ImmutableObjectOpenHashSet(Iterator<T> 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
    • ImmutableObjectOpenHashSet

      public ImmutableObjectOpenHashSet(ObjectIterator<T> 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
    • ImmutableObjectOpenHashSet

      public ImmutableObjectOpenHashSet(ObjectIterator<T> 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(T o)
      Angegeben von:
      add in Schnittstelle Collection<T>
      Angegeben von:
      add in Schnittstelle Set<T>
      Setzt außer Kraft:
      add in Klasse AbstractCollection<T>
    • addOrGet

      public T addOrGet(T o)
      Beschreibung aus Schnittstelle kopiert: ObjectSet
      A Helper method that allows to add a element or getting the already present implement. Allowing to make unique references reuseable.
      Angegeben von:
      addOrGet in Schnittstelle ObjectSet<T>
      Setzt außer Kraft:
      addOrGet in Klasse AbstractObjectSet<T>
      Parameter:
      o - the element to add
      Gibt zurück:
      either the inserted element or the present element.
    • addAll

      public boolean addAll(Collection<? extends T> c)
      Angegeben von:
      addAll in Schnittstelle Collection<T>
      Angegeben von:
      addAll in Schnittstelle Set<T>
      Setzt außer Kraft:
      addAll in Klasse AbstractCollection<T>
    • addAll

      public boolean addAll(ObjectCollection<T> c)
      Beschreibung aus Schnittstelle kopiert: ObjectCollection
      A Type-Specific addAll function to reduce (un)boxing
      Angegeben von:
      addAll in Schnittstelle ObjectCollection<T>
      Setzt außer Kraft:
      addAll in Klasse AbstractObjectCollection<T>
      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(T o)
      Beschreibung aus Schnittstelle kopiert: ObjectOrderedSet
      A customized add method that allows you to insert into the first index.
      Angegeben von:
      addAndMoveToFirst in Schnittstelle ObjectOrderedSet<T>
      Parameter:
      o - the element that should be inserted
      Gibt zurück:
      true if it was added
      Siehe auch:
    • addAndMoveToLast

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

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

      public boolean moveToLast(T o)
      Beschreibung aus Schnittstelle kopiert: ObjectOrderedSet
      A specific move method to move a given key to the last index.
      Angegeben von:
      moveToLast in Schnittstelle ObjectOrderedSet<T>
      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)
      Angegeben von:
      contains in Schnittstelle Collection<T>
      Angegeben von:
      contains in Schnittstelle Set<T>
      Setzt außer Kraft:
      contains in Klasse AbstractCollection<T>
    • first

      public T first()
      Beschreibung aus Schnittstelle kopiert: ObjectOrderedSet
      A method to get the first element in the set
      Angegeben von:
      first in Schnittstelle ObjectOrderedSet<T>
      Gibt zurück:
      first element in the set
    • pollFirst

      public T pollFirst()
      Beschreibung aus Schnittstelle kopiert: ObjectOrderedSet
      A method to get and remove the first element in the set
      Angegeben von:
      pollFirst in Schnittstelle ObjectOrderedSet<T>
      Gibt zurück:
      first element in the set
    • last

      public T last()
      Beschreibung aus Schnittstelle kopiert: ObjectOrderedSet
      A method to get the last element in the set
      Angegeben von:
      last in Schnittstelle ObjectOrderedSet<T>
      Gibt zurück:
      last element in the set
    • pollLast

      public T pollLast()
      Beschreibung aus Schnittstelle kopiert: ObjectOrderedSet
      A method to get and remove the last element in the set
      Angegeben von:
      pollLast in Schnittstelle ObjectOrderedSet<T>
      Gibt zurück:
      last element in the set
    • remove

      public boolean remove(Object o)
      Angegeben von:
      remove in Schnittstelle Collection<T>
      Angegeben von:
      remove in Schnittstelle Set<T>
      Setzt außer Kraft:
      remove in Klasse AbstractCollection<T>
    • forEach

      public void forEach(Consumer<? super T> action)
      Angegeben von:
      forEach in Schnittstelle Iterable<T>
    • forEachIndexed

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

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

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

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

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

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

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

      public ObjectListIterator<T> iterator()
      Beschreibung aus Schnittstelle kopiert: ObjectCollection
      Returns a Type-Specific Iterator to reduce (un)boxing
      Angegeben von:
      iterator in Schnittstelle Collection<T>
      Angegeben von:
      iterator in Schnittstelle Iterable<T>
      Angegeben von:
      iterator in Schnittstelle ObjectCollection<T>
      Angegeben von:
      iterator in Schnittstelle ObjectIterable<T>
      Angegeben von:
      iterator in Schnittstelle ObjectOrderedSet<T>
      Angegeben von:
      iterator in Schnittstelle ObjectSet<T>
      Angegeben von:
      iterator in Schnittstelle Set<T>
      Angegeben von:
      iterator in Klasse AbstractObjectSet<T>
      Gibt zurück:
      a iterator of the collection
      Siehe auch:
    • iterator

      public ObjectBidirectionalIterator<T> iterator(T fromElement)
      Beschreibung aus Schnittstelle kopiert: ObjectOrderedSet
      A type Specific Iterator starting from a given key
      Angegeben von:
      iterator in Schnittstelle ObjectOrderedSet<T>
      Parameter:
      fromElement - the element the iterator should start from
      Gibt zurück:
      a iterator starting from the given element
    • toArray

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

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

      public ImmutableObjectOpenHashSet<T> copy()
      Beschreibung aus Schnittstelle kopiert: ObjectCollection
      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 ObjectCollection<T>
      Angegeben von:
      copy in Schnittstelle ObjectOrderedSet<T>
      Angegeben von:
      copy in Schnittstelle ObjectSet<T>
      Setzt außer Kraft:
      copy in Klasse AbstractObjectSet<T>
      Gibt zurück:
      a Shallow Copy of the collection
    • clear

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

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