Klasse CharArraySet

Alle implementierten Schnittstellen:
Iterable<Character>, Collection<Character>, Set<Character>, CharCollection, CharIterable, CharOrderedSet, CharSet, ISizeProvider

public class CharArraySet extends AbstractCharSet implements CharOrderedSet
A Type Specific ArraySet implementation. That is based around the idea of List.indexOf(Object) for no duplication. Unless a array constructor is used the ArraySet does not allow for duplication. This implementation does not shrink the backing array
  • Konstruktordetails

    • CharArraySet

      public CharArraySet()
      Default Constructor
    • CharArraySet

      public CharArraySet(int capacity)
      Minimum Capacity Constructor
      Parameter:
      capacity - the minimum capacity of the internal array
      Löst aus:
      NegativeArraySizeException - if the capacity is negative
    • CharArraySet

      public CharArraySet(char[] array)
      Constructur using initial Array
      Parameter:
      array - the array that should be used for set.
    • CharArraySet

      public CharArraySet(char[] array, int length)
      Constructur using initial Array
      Parameter:
      array - the array that should be used for set.
      length - the amount of elements present within the array
      Löst aus:
      NegativeArraySizeException - if the length is negative
    • CharArraySet

      @Deprecated public CharArraySet(Collection<? extends Character> c)
      Veraltet.
      A Helper constructor that allows to create a Set with exactly the same values as the provided collection.
      Parameter:
      c - the elements that should be added to the set.
      Note:
      this slowly checks every element to remove duplicates
    • CharArraySet

      public CharArraySet(CharCollection c)
      A Helper constructor that allows to create a Set with exactly the same values as the provided collection.
      Parameter:
      c - the elements that should be added to the set.
      Note:
      this slowly checks every element to remove duplicates
    • CharArraySet

      @Deprecated public CharArraySet(Set<? extends Character> s)
      Veraltet.
      A Helper constructor that fast copies the element out of a set into the ArraySet. Since it is assumed that there is no duplication in the first place
      Parameter:
      s - the set the element should be taken from
    • CharArraySet

      public CharArraySet(CharSet s)
      A Helper constructor that fast copies the element out of a set into the ArraySet. Since it is assumed that there is no duplication in the first place
      Parameter:
      s - the set the element should be taken from
  • Methodendetails

    • add

      public boolean add(char o)
      Beschreibung aus Schnittstelle kopiert: CharCollection
      A Type-Specific add function to reduce (un)boxing
      Angegeben von:
      add in Schnittstelle CharCollection
      Parameter:
      o - the element that should be added
      Gibt zurück:
      true if the element was added to the collection
    • addAndMoveToFirst

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

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

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

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

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

      public char firstChar()
      Beschreibung aus Schnittstelle kopiert: CharOrderedSet
      A method to get the first element in the set
      Angegeben von:
      firstChar in Schnittstelle CharOrderedSet
      Gibt zurück:
      first element in the set
    • lastChar

      public char lastChar()
      Beschreibung aus Schnittstelle kopiert: CharOrderedSet
      A method to get the last element in the set
      Angegeben von:
      lastChar in Schnittstelle CharOrderedSet
      Gibt zurück:
      last element in the set
    • removeAll

      public boolean removeAll(CharCollection c)
      Beschreibung aus Klasse kopiert: AbstractCharCollection
      A Type-Specific implementation of removeAll. This Implementation iterates over all elements and removes them as they were found in the other collection.
      Angegeben von:
      removeAll in Schnittstelle CharCollection
      Setzt außer Kraft:
      removeAll in Klasse AbstractCharCollection
      Parameter:
      c - the elements that should be deleted
      Gibt zurück:
      true if the collection was modified.
      Siehe auch:
    • removeAll

      public boolean removeAll(CharCollection c, CharConsumer r)
      Beschreibung aus Schnittstelle kopiert: CharCollection
      A Type-Specific removeAll function that reduces (un)boxing. It also notifies the remover of which exact element is going to be removed.
      Angegeben von:
      removeAll in Schnittstelle CharCollection
      Setzt außer Kraft:
      removeAll in Klasse AbstractCharCollection
      Parameter:
      c - the collection of elements that should be removed
      r - elements that got removed
      Gibt zurück:
      true if any element was removed
      Siehe auch:
    • retainAll

      public boolean retainAll(CharCollection c)
      Beschreibung aus Klasse kopiert: AbstractCharCollection
      A Type-Specific implementation of retainAll. This Implementation iterates over all elements and removes them as they were not found in the other collection.
      Angegeben von:
      retainAll in Schnittstelle CharCollection
      Setzt außer Kraft:
      retainAll in Klasse AbstractCharCollection
      Parameter:
      c - the elements that should be kept
      Gibt zurück:
      true if the collection was modified.
      Siehe auch:
    • retainAll

      public boolean retainAll(CharCollection c, CharConsumer r)
      Beschreibung aus Schnittstelle kopiert: CharCollection
      A Type-Specific retainAll function that reduces (un)boxing. It also notifies the remover of which exact element is going to be removed.
      Angegeben von:
      retainAll in Schnittstelle CharCollection
      Setzt außer Kraft:
      retainAll in Klasse AbstractCharCollection
      Parameter:
      c - the collection of elements that should be kept
      r - elements that got removed
      Gibt zurück:
      true if any element was removed
      Siehe auch:
    • removeAll

      @Deprecated public boolean removeAll(Collection<?> c)
      Veraltet.
      Angegeben von:
      removeAll in Schnittstelle Collection<Character>
      Angegeben von:
      removeAll in Schnittstelle Set<Character>
      Setzt außer Kraft:
      removeAll in Klasse AbstractCollection<Character>
    • retainAll

      @Deprecated public boolean retainAll(Collection<?> c)
      Veraltet.
      Angegeben von:
      retainAll in Schnittstelle Collection<Character>
      Angegeben von:
      retainAll in Schnittstelle Set<Character>
      Setzt außer Kraft:
      retainAll in Klasse AbstractCollection<Character>
    • remove

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

      public char pollFirstChar()
      Beschreibung aus Schnittstelle kopiert: CharOrderedSet
      A method to get and remove the first element in the set
      Angegeben von:
      pollFirstChar in Schnittstelle CharOrderedSet
      Gibt zurück:
      first element in the set
    • pollLastChar

      public char pollLastChar()
      Beschreibung aus Schnittstelle kopiert: CharOrderedSet
      A method to get and remove the last element in the set
      Angegeben von:
      pollLastChar in Schnittstelle CharOrderedSet
      Gibt zurück:
      last element in the set
    • remIf

      public boolean remIf(IntPredicate filter)
      Beschreibung aus Schnittstelle kopiert: CharCollection
      A Type-Specific removeIf function to reduce (un)boxing.

      Removes elements that were selected by the filter

      Angegeben von:
      remIf in Schnittstelle CharCollection
      Parameter:
      filter - Filters the elements that should be removed
      Gibt zurück:
      true if the collection was modified
      Siehe auch:
    • forEach

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

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

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

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

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

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

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

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

      public CharBidirectionalIterator iterator()
      Beschreibung aus Schnittstelle kopiert: CharCollection
      Returns a Type-Specific Iterator to reduce (un)boxing
      Angegeben von:
      iterator in Schnittstelle CharCollection
      Angegeben von:
      iterator in Schnittstelle CharIterable
      Angegeben von:
      iterator in Schnittstelle CharOrderedSet
      Angegeben von:
      iterator in Schnittstelle CharSet
      Angegeben von:
      iterator in Schnittstelle Collection<Character>
      Angegeben von:
      iterator in Schnittstelle Iterable<Character>
      Angegeben von:
      iterator in Schnittstelle Set<Character>
      Angegeben von:
      iterator in Klasse AbstractCharSet
      Gibt zurück:
      a iterator of the collection
      Siehe auch:
    • iterator

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

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

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

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

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

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