Klasse ImmutableCharList

Alle implementierten Schnittstellen:
Iterable<Character>, Collection<Character>, List<Character>, CharCollection, CharIterable, CharList, ISizeProvider

public class ImmutableCharList extends AbstractCharList
A Type-Specific Immutable implementation of list that is written to reduce (un)boxing
  • Konstruktordetails

    • ImmutableCharList

      @Deprecated public ImmutableCharList(Collection<? extends Character> c)
      Veraltet.
      Creates a new Immutable copy of the contents of the Collection.
      Parameter:
      c - the elements that should be added into the list
    • ImmutableCharList

      public ImmutableCharList(CharCollection c)
      Creates a new Immutable copy of the contents of the Collection.
      Parameter:
      c - the elements that should be added into the list
    • ImmutableCharList

      public ImmutableCharList(CharList l)
      Creates a new Immutable copy of the contents of the List.
      Parameter:
      l - the elements that should be added into the list
    • ImmutableCharList

      public ImmutableCharList(char... a)
      Creates a new Immutable copy of the contents of the Array.
      Parameter:
      a - the array that should be copied
    • ImmutableCharList

      public ImmutableCharList(char[] a, int length)
      Creates a new ImmutableList copy of the array with a custom length
      Parameter:
      a - the array that should be copied
      length - the desired length that should be copied
    • ImmutableCharList

      public ImmutableCharList(char[] a, int offset, int length)
      Creates a new ImmutableList copy of the array with in the custom range.
      Parameter:
      a - the array that should be copied
      offset - the starting offset of where the array should be copied from
      length - the desired length that should be copied
      Löst aus:
      IllegalStateException - if offset is smaller then 0
      IllegalStateException - if the offset + length exceeds the array length
  • Methodendetails

    • add

      public boolean add(char e)
      Beschreibung aus Klasse kopiert: AbstractCharList
      A Type-Specific implementation of add function that delegates to List.add(int, Object)
      Angegeben von:
      add in Schnittstelle CharCollection
      Angegeben von:
      add in Schnittstelle CharList
      Setzt außer Kraft:
      add in Klasse AbstractCharList
      Parameter:
      e - the element to add
      Gibt zurück:
      true if the list was modified
      Siehe auch:
    • add

      public void add(int index, char e)
      Beschreibung aus Schnittstelle kopiert: CharList
      A Type-Specific add Function to reduce (un)boxing
      Parameter:
      index - index at which the specified element is to be inserted
      e - the element to add
      Siehe auch:
    • addAll

      @Deprecated public boolean addAll(int index, Collection<? extends Character> c)
      Veraltet.
    • addAll

      public boolean addAll(int index, CharCollection c)
      Beschreibung aus Schnittstelle kopiert: CharList
      A Type-Specific addAll Function to reduce (un)boxing
      Parameter:
      index - index at which the specified elements is to be inserted
      c - the elements that need to be added
      Gibt zurück:
      true if the list was modified
      Siehe auch:
    • addAll

      public boolean addAll(int index, CharList c)
      Beschreibung aus Schnittstelle kopiert: CharList
      A Type-Specific and optimized addAll function that allows a faster transfer of elements
      Parameter:
      index - index at which the specified elements is to be inserted
      c - the elements that need to be added
      Gibt zurück:
      true if the list was modified
    • addAll

      public boolean addAll(char[] e, int offset, int length)
      Beschreibung aus Schnittstelle kopiert: CharCollection
      A Type-Specific Array based addAll method to reduce the amount of Wrapping
      Parameter:
      e - the elements that should be added
      offset - where to start within the array
      length - how many elements of the array should be added
      Gibt zurück:
      if the collection was modified
    • addElements

      public void addElements(int from, char[] a, int offset, int length)
      Beschreibung aus Schnittstelle kopiert: CharList
      A function to fast add elements to the list
      Parameter:
      from - the index where the elements should be added into the list
      a - the elements that should be added
      offset - the start index of the array should be read from
      length - how many elements should be read from
    • getElements

      public char[] getElements(int from, char[] a, int offset, int length)
      Beschreibung aus Schnittstelle kopiert: CharList
      A function to fast fetch elements from the list
      Parameter:
      from - index where the list should be fetching elements from
      a - the array where the values should be inserted to
      offset - the startIndex of where the array should be written to
      length - the number of elements the values should be fetched from
      Gibt zurück:
      the inputArray
    • removeElements

      public void removeElements(int from, int to)
      Beschreibung aus Schnittstelle kopiert: CharList
      a function to fast remove elements from the list.
      Parameter:
      from - the start index of where the elements should be removed from (inclusive)
      to - the end index of where the elements should be removed to (exclusive)
    • extractElements

      public char[] extractElements(int from, int to)
      Beschreibung aus Schnittstelle kopiert: CharList
      A function to fast extract elements out of the list, this removes the elements that were fetched.
      Parameter:
      from - the start index of where the elements should be fetched from (inclusive)
      to - the end index of where the elements should be fetched to (exclusive)
      Gibt zurück:
      a array of the elements that were fetched
    • contains

      @Deprecated public boolean contains(Object o)
      Veraltet.
      A function to find if the Element is present in this list.
      Angegeben von:
      contains in Schnittstelle CharCollection
      Angegeben von:
      contains in Schnittstelle CharList
      Angegeben von:
      contains in Schnittstelle Collection<Character>
      Angegeben von:
      contains in Schnittstelle List<Character>
      Setzt außer Kraft:
      contains in Klasse AbstractCharCollection
      Parameter:
      o - the element that is searched for
      Gibt zurück:
      if the element was found.
    • indexOf

      @Deprecated public int indexOf(Object o)
      Veraltet.
      A function to find the index of a given element
      Angegeben von:
      indexOf in Schnittstelle CharList
      Angegeben von:
      indexOf in Schnittstelle List<Character>
      Setzt außer Kraft:
      indexOf in Klasse AbstractCharList
      Parameter:
      o - the element that is searched for
      Gibt zurück:
      the index of the element if found. (if not found then -1)
    • lastIndexOf

      @Deprecated public int lastIndexOf(Object o)
      Veraltet.
      A function to find the last index of a given element
      Angegeben von:
      lastIndexOf in Schnittstelle CharList
      Angegeben von:
      lastIndexOf in Schnittstelle List<Character>
      Setzt außer Kraft:
      lastIndexOf in Klasse AbstractCharList
      Parameter:
      o - the element that is searched for
      Gibt zurück:
      the last index of the element if found. (if not found then -1)
    • contains

      public boolean contains(char e)
      A Type Specific implementation of the Collection#contains function.
      Angegeben von:
      contains in Schnittstelle CharCollection
      Setzt außer Kraft:
      contains in Klasse AbstractCharCollection
      Parameter:
      e - the element that is searched for.
      Gibt zurück:
      if the element was found
    • indexOf

      public int indexOf(char e)
      A Type-Specific function to find the index of a given element
      Angegeben von:
      indexOf in Schnittstelle CharList
      Setzt außer Kraft:
      indexOf in Klasse AbstractCharList
      Parameter:
      e - the element that is searched for
      Gibt zurück:
      the index of the element if found. (if not found then -1)
    • lastIndexOf

      public int lastIndexOf(char e)
      A Type-Specific function to find the last index of a given element
      Angegeben von:
      lastIndexOf in Schnittstelle CharList
      Setzt außer Kraft:
      lastIndexOf in Klasse AbstractCharList
      Parameter:
      e - the element that is searched for
      Gibt zurück:
      the last index of the element if found. (if not found then -1)
    • sort

      public void sort(CharComparator c)
      Beschreibung aus Schnittstelle kopiert: CharList
      Sorts the elements specified by the Natural order either by using the Comparator or the elements
      Parameter:
      c - the sorter of the elements, can be null
      Siehe auch:
    • unstableSort

      public void unstableSort(CharComparator c)
      Beschreibung aus Schnittstelle kopiert: CharList
      Sorts the elements specified by the Natural order either by using the Comparator or the elements using a unstable sort
      Parameter:
      c - the sorter of the elements, can be null
      Siehe auch:
    • getChar

      public char getChar(int index)
      A Type-Specific get function to reduce (un)boxing
      Parameter:
      index - the index of the element to fetch
      Gibt zurück:
      the value of the requested index
      Löst aus:
      IndexOutOfBoundsException - if the index is out of range
      Siehe auch:
    • copy

      public ImmutableCharList 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 CharList
      Setzt außer Kraft:
      copy in Klasse AbstractCharList
      Gibt zurück:
      a Shallow Copy of the collection
    • forEach

      public void forEach(CharConsumer action)
      A Type Specific foreach function that reduces (un)boxing
      Parameter:
      action - The action to be performed for each element
      Löst aus:
      NullPointerException - if the specified action is null
      Siehe auch:
      ImplSpec:

      The default implementation behaves as if:

      
       	for(int i = 0;i<size;i++)
       		action.accept(data[i]);
       
    • 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.
      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.
      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.
      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.
      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.
      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
      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
      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.
      Parameter:
      filter - that should be applied
      Gibt zurück:
      the amount of Valid Elements
    • listIterator

      public CharListIterator listIterator(int index)
      Beschreibung aus Schnittstelle kopiert: CharList
      A Type-Specific Iterator of listIterator
      Angegeben von:
      listIterator in Schnittstelle CharList
      Angegeben von:
      listIterator in Schnittstelle List<Character>
      Setzt außer Kraft:
      listIterator in Klasse AbstractCharList
      Siehe auch:
    • set

      public char set(int index, char e)
      Beschreibung aus Schnittstelle kopiert: CharList
      A Type-Specific set function to reduce (un)boxing
      Parameter:
      index - index of the element to replace
      e - element to be stored at the specified position
      Gibt zurück:
      the element previously at the specified position
      Siehe auch:
    • replaceAll

      @Deprecated public void replaceAll(UnaryOperator<Character> o)
      Veraltet.
      Beschreibung aus Schnittstelle kopiert: CharList

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

    • replaceChars

      public void replaceChars(IntUnaryOperator o)
      Beschreibung aus Schnittstelle kopiert: CharList
      A Type-Specific replace function to reduce (un)boxing
      Parameter:
      o - the action to replace the values
    • removeChar

      public char removeChar(int index)
      Beschreibung aus Schnittstelle kopiert: CharList
      A Type-Specific remove function to reduce (un)boxing
      Parameter:
      index - the index of the element to be removed
      Gibt zurück:
      the element previously at the specified position
      Siehe auch:
    • swapRemove

      public char swapRemove(int index)
      Beschreibung aus Schnittstelle kopiert: CharList
      A Highly Optimized remove function that removes the desired element. But instead of shifting the elements to the left it moves the last element to the removed space.
      Parameter:
      index - the index of the element to be removed
      Gibt zurück:
      the element previously at the specified position
    • remChar

      public boolean remChar(char type)
      Beschreibung aus Klasse kopiert: AbstractCharCollection
      A Type-Specific implementation of remove. This implementation iterates over the elements until it finds the element that is searched for or it runs out of elements. It stops after finding the first element
      Angegeben von:
      remChar in Schnittstelle CharCollection
      Setzt außer Kraft:
      remChar in Klasse AbstractCharCollection
      Parameter:
      type - the element that is searched for
      Gibt zurück:
      true if the element was found and removed.
      Siehe auch:
    • removeAll

      @Deprecated public boolean removeAll(Collection<?> c)
      Veraltet.
      Angegeben von:
      removeAll in Schnittstelle Collection<Character>
      Angegeben von:
      removeAll in Schnittstelle List<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 List<Character>
      Setzt außer Kraft:
      retainAll in Klasse AbstractCollection<Character>
    • removeIf

      @Deprecated public boolean removeIf(Predicate<? super Character> filter)
      Veraltet.
      Beschreibung aus Schnittstelle kopiert: CharCollection

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

    • 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:
    • 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:
    • 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, 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:
    • 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

      Parameter:
      filter - Filters the elements that should be removed
      Gibt zurück:
      true if the collection was modified
      Siehe auch:
    • toArray

      @Deprecated public Object[] toArray()
      Veraltet.
      A toArray implementation that ensures the Array itself is a Object.
      Angegeben von:
      toArray in Schnittstelle Collection<Character>
      Angegeben von:
      toArray in Schnittstelle List<Character>
      Setzt außer Kraft:
      toArray in Klasse AbstractCollection<Character>
      Gibt zurück:
      a Array of the elements in the list
    • toArray

      @Deprecated public <E> E[] toArray(E[] a)
      Veraltet.
      A toArray implementation that ensures the Array itself is a Object.
      Angegeben von:
      toArray in Schnittstelle Collection<Character>
      Angegeben von:
      toArray in Schnittstelle List<Character>
      Setzt außer Kraft:
      toArray in Klasse AbstractCollection<Character>
      Parameter:
      a - original array. If null a Object array with the right size is created. If to small the Array of the same type is created with the right size
      Gibt zurück:
      a Array of the elements in the list
    • 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:
    • size

      public int size()
      A function to return the size of the list
      Angegeben von:
      size in Schnittstelle Collection<Character>
      Angegeben von:
      size in Schnittstelle ISizeProvider
      Angegeben von:
      size in Schnittstelle List<Character>
      Angegeben von:
      size in Klasse AbstractCollection<Character>
      Gibt zurück:
      the size of elements in the list
    • size

      public void size(int size)
      Beschreibung aus Schnittstelle kopiert: CharList
      A function to ensure the elements are within the requested size. If smaller then the stored elements they get removed as needed. If bigger it is ensured that enough room is provided depending on the implementation
      Angegeben von:
      size in Schnittstelle CharList
      Setzt außer Kraft:
      size in Klasse AbstractCharList
      Parameter:
      size - the requested amount of elements/room for elements
    • clear

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

      public IntStream primitiveStream()
      Returns a Java-Type-Specific Stream to reduce boxing/unboxing.
      Gibt zurück:
      a Stream of the closest java type
      Note:
      characteristics are ordered, sized, subsized
    • spliterator

      public CharSplititerator spliterator()
      A Type Specific Type Splititerator to reduce boxing/unboxing
      Gibt zurück:
      type specific splititerator
      Note:
      characteristics are ordered, sized, subsized