Class AbstractCharBigList

java.lang.Object
java.util.AbstractCollection<Character>
it.unimi.dsi.fastutil.chars.AbstractCharCollection
it.unimi.dsi.fastutil.chars.AbstractCharBigList
All Implemented Interfaces:
it.unimi.dsi.fastutil.BigList<Character>, CharBigList, it.unimi.dsi.fastutil.chars.CharCollection, it.unimi.dsi.fastutil.chars.CharIterable, it.unimi.dsi.fastutil.chars.CharStack, it.unimi.dsi.fastutil.Size64, it.unimi.dsi.fastutil.Stack<Character>, Comparable<it.unimi.dsi.fastutil.BigList<? extends Character>>, Iterable<Character>, Collection<Character>
Direct Known Subclasses:
AbstractCharBigList.CharSubList, CharBigArrayBigList, CharBigLists.ListBigList, CharBigLists.Singleton, CharMappedBigList

public abstract class AbstractCharBigList extends it.unimi.dsi.fastutil.chars.AbstractCharCollection implements CharBigList, it.unimi.dsi.fastutil.chars.CharStack
An abstract class providing basic methods for big lists implementing a type-specific big list interface.

Most of the methods in this class are optimized with the assumption that the List will have have constant-time random access. If this is not the case, you should probably at least override listIterator(long) and the xAll() methods (such as addAll(long, java.util.Collection<? extends java.lang.Character>)) with a more appropriate iteration scheme. Note the subList(long, long) method is cognizant of random-access or not, so that need not be reimplemented.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
    static class 
    A class implementing a sublist view.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(char k)
    void
    add(long index, char k)
    Inserts the specified element at the specified position in this type-specific big list (optional operation).
    void
    add(long index, Character ok)
    Deprecated.
    Please use the corresponding type-specific method instead.
    boolean
    addAll(long index, it.unimi.dsi.fastutil.chars.CharCollection c)
    Inserts all of the elements in the specified type-specific collection into this type-specific big list at the specified position (optional operation).
    boolean
    addAll(long index, Collection<? extends Character> c)
    Adds all of the elements in the specified collection to this list (optional operation).
    boolean
    addAll(it.unimi.dsi.fastutil.chars.CharCollection c)
    boolean
    addAll(Collection<? extends Character> c)
    void
    addElements(long index, char[][] a)
    Add (hopefully quickly) elements to this type-specific big list.
    void
    addElements(long index, char[][] a, long offset, long length)
    Add (hopefully quickly) elements to this type-specific big list.
    void
    int
    compareTo(it.unimi.dsi.fastutil.BigList<? extends Character> l)
    Compares this big list to another object.
    boolean
    contains(char k)
    Returns true if this list contains the specified element.
    protected void
    ensureIndex(long index)
    Ensures that the given index is nonnegative and not greater than this big-list size.
    protected void
    Ensures that the given index is nonnegative and smaller than this big-list size.
    boolean
     
    void
    forEach(it.unimi.dsi.fastutil.chars.CharConsumer action)
    get(long index)
    Deprecated.
    Please use the corresponding type-specific method instead.
    void
    getElements(long from, char[][] a, long offset, long length)
    Copies (hopefully quickly) elements of this type-specific big list into the given big array.
    int
    Returns the hash code for this big list, which is identical to List.hashCode().
    long
    indexOf(char k)
    Returns the index of the first occurrence of the specified element in this type-specific big list, or -1 if this big list does not contain the element.
    long
    Deprecated.
    Please use the corresponding type-specific method instead.
    it.unimi.dsi.fastutil.ints.IntSpliterator
     
    it.unimi.dsi.fastutil.chars.CharBigListIterator
    Returns a type-specific iterator on the elements of this list.
    long
    lastIndexOf(char k)
    Returns the index of the last occurrence of the specified element in this type-specific big list, or -1 if this big list does not contain the element.
    long
    Deprecated.
    Please use the corresponding type-specific method instead.
    it.unimi.dsi.fastutil.chars.CharBigListIterator
    Returns a type-specific big-list iterator on this type-specific big list.
    it.unimi.dsi.fastutil.chars.CharBigListIterator
    listIterator(long index)
    Returns a type-specific list iterator on this type-specific big list starting at a given index.
    peek(int i)
    Deprecated.
    Please use the corresponding type-specific method instead.
    char
    peekChar(int i)
     
    pop()
    Deprecated.
    Please use the corresponding type-specific method instead.
    char
     
    void
    push(char o)
     
    void
    Deprecated.
    Please use the corresponding type-specific method instead.
    boolean
    rem(char k)
    Removes a single instance of the specified element from this collection, if it is present (optional operation).
    remove(long index)
    Deprecated.
    Please use the corresponding type-specific method instead.
    char
    removeChar(long i)
    Removes the element at the specified position.
    void
    removeElements(long from, long to)
    Removes (hopefully quickly) elements of this type-specific big list.
    char
    set(long index, char k)
    Replaces the element at the specified position in this big list with the specified element (optional operation).
    set(long index, Character ok)
    Deprecated.
    Please use the corresponding type-specific method instead.
    void
    setElements(long index, char[][] a, long offset, long length)
    Set (hopefully quickly) elements to match the array given.
    int
    Deprecated.
    Please use Size64.size64() instead.
    void
    size(long size)
     
    subList(long from, long to)
    Returns a type-specific view of the portion of this type-specific big list from the index from, inclusive, to the index to, exclusive.
    top()
    Deprecated.
    Please use the corresponding type-specific method instead.
    char
     
     

    Methods inherited from class it.unimi.dsi.fastutil.chars.AbstractCharCollection

    add, contains, containsAll, containsAll, remove, removeAll, removeAll, retainAll, retainAll, toArray, toCharArray, toCharArray

    Methods inherited from class java.util.AbstractCollection

    isEmpty, toArray, toArray

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface it.unimi.dsi.fastutil.chars.CharBigList

    addAll, addAll, addAll, addAll, getChar, getElements, setElements, setElements, spliterator

    Methods inherited from interface it.unimi.dsi.fastutil.chars.CharCollection

    add, contains, containsAll, intIterator, intParallelStream, intStream, parallelStream, remove, removeAll, removeIf, removeIf, removeIf, retainAll, stream, toArray, toCharArray, toCharArray

    Methods inherited from interface it.unimi.dsi.fastutil.chars.CharIterable

    forEach, forEach

    Methods inherited from interface java.util.Collection

    containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toArray

    Methods inherited from interface it.unimi.dsi.fastutil.Size64

    size64

    Methods inherited from interface it.unimi.dsi.fastutil.Stack

    isEmpty
  • Constructor Details

    • AbstractCharBigList

      protected AbstractCharBigList()
  • Method Details

    • ensureIndex

      protected void ensureIndex(long index)
      Ensures that the given index is nonnegative and not greater than this big-list size.
      Parameters:
      index - an index.
      Throws:
      IndexOutOfBoundsException - if the given index is negative or greater than this big-list size.
    • ensureRestrictedIndex

      protected void ensureRestrictedIndex(long index)
      Ensures that the given index is nonnegative and smaller than this big-list size.
      Parameters:
      index - an index.
      Throws:
      IndexOutOfBoundsException - if the given index is negative or not smaller than this big-list size.
    • add

      public void add(long index, char k)
      Inserts the specified element at the specified position in this type-specific big list (optional operation).
      Specified by:
      add in interface CharBigList
      See Also:
      • BigList.add(long,Object)
    • add

      public boolean add(char k)
      Specified by:
      add in interface it.unimi.dsi.fastutil.chars.CharCollection
      Overrides:
      add in class it.unimi.dsi.fastutil.chars.AbstractCharCollection
    • removeChar

      public char removeChar(long i)
      Removes the element at the specified position.
      Specified by:
      removeChar in interface CharBigList
      See Also:
      • BigList.remove(long)
    • set

      public char set(long index, char k)
      Replaces the element at the specified position in this big list with the specified element (optional operation).
      Specified by:
      set in interface CharBigList
      See Also:
      • BigList.set(long,Object)
    • addAll

      public boolean addAll(long index, Collection<? extends Character> c)
      Adds all of the elements in the specified collection to this list (optional operation).
      Specified by:
      addAll in interface it.unimi.dsi.fastutil.BigList<Character>
    • addAll

      public boolean addAll(Collection<? extends Character> c)
      Specified by:
      addAll in interface Collection<Character>
      Overrides:
      addAll in class it.unimi.dsi.fastutil.chars.AbstractCharCollection
    • iterator

      public it.unimi.dsi.fastutil.chars.CharBigListIterator iterator()
      Returns a type-specific iterator on the elements of this list.
      Specified by:
      iterator in interface CharBigList
      Specified by:
      iterator in interface it.unimi.dsi.fastutil.chars.CharCollection
      Specified by:
      iterator in interface it.unimi.dsi.fastutil.chars.CharIterable
      Specified by:
      iterator in interface Collection<Character>
      Specified by:
      iterator in interface Iterable<Character>
      Specified by:
      iterator in class it.unimi.dsi.fastutil.chars.AbstractCharCollection
      See Also:
    • listIterator

      public it.unimi.dsi.fastutil.chars.CharBigListIterator listIterator()
      Returns a type-specific big-list iterator on this type-specific big list.
      Specified by:
      listIterator in interface it.unimi.dsi.fastutil.BigList<Character>
      Specified by:
      listIterator in interface CharBigList
      See Also:
      • BigList.listIterator()
    • listIterator

      public it.unimi.dsi.fastutil.chars.CharBigListIterator listIterator(long index)
      Returns a type-specific list iterator on this type-specific big list starting at a given index.
      Specified by:
      listIterator in interface it.unimi.dsi.fastutil.BigList<Character>
      Specified by:
      listIterator in interface CharBigList
      See Also:
      • BigList.listIterator(long)
    • intSpliterator

      public it.unimi.dsi.fastutil.ints.IntSpliterator intSpliterator()
      Specified by:
      intSpliterator in interface it.unimi.dsi.fastutil.chars.CharCollection
      Specified by:
      intSpliterator in interface it.unimi.dsi.fastutil.chars.CharIterable
    • contains

      public boolean contains(char k)
      Returns true if this list contains the specified element.
      Specified by:
      contains in interface it.unimi.dsi.fastutil.chars.CharCollection
      Overrides:
      contains in class it.unimi.dsi.fastutil.chars.AbstractCharCollection
      See Also:
    • indexOf

      public long indexOf(char k)
      Description copied from interface: CharBigList
      Returns the index of the first occurrence of the specified element in this type-specific big list, or -1 if this big list does not contain the element.
      Specified by:
      indexOf in interface CharBigList
      See Also:
      • BigList.indexOf(Object)
    • lastIndexOf

      public long lastIndexOf(char k)
      Description copied from interface: CharBigList
      Returns the index of the last occurrence of the specified element in this type-specific big list, or -1 if this big list does not contain the element.
      Specified by:
      lastIndexOf in interface CharBigList
      See Also:
      • BigList.lastIndexOf(Object)
    • size

      public void size(long size)
      Specified by:
      size in interface it.unimi.dsi.fastutil.BigList<Character>
    • subList

      public CharBigList subList(long from, long to)
      Description copied from interface: CharBigList
      Returns a type-specific view of the portion of this type-specific big list from the index from, inclusive, to the index to, exclusive.
      Specified by:
      subList in interface it.unimi.dsi.fastutil.BigList<Character>
      Specified by:
      subList in interface CharBigList
      See Also:
      • BigList.subList(long,long)
    • forEach

      public void forEach(it.unimi.dsi.fastutil.chars.CharConsumer action)
      Specified by:
      forEach in interface it.unimi.dsi.fastutil.chars.CharIterable
    • removeElements

      public void removeElements(long from, long to)
      Removes (hopefully quickly) elements of this type-specific big list.

      This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.

      Specified by:
      removeElements in interface CharBigList
      Parameters:
      from - the start index (inclusive).
      to - the end index (exclusive).
    • addElements

      public void addElements(long index, char[][] a, long offset, long length)
      Add (hopefully quickly) elements to this type-specific big list.

      This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.

      Specified by:
      addElements in interface CharBigList
      Parameters:
      index - the index at which to add elements.
      a - the big array containing the elements.
      offset - the offset of the first element to add.
      length - the number of elements to add.
    • addElements

      public void addElements(long index, char[][] a)
      Add (hopefully quickly) elements to this type-specific big list.
      Specified by:
      addElements in interface CharBigList
      Parameters:
      index - the index at which to add elements.
      a - the big array containing the elements.
    • getElements

      public void getElements(long from, char[][] a, long offset, long length)
      Copies (hopefully quickly) elements of this type-specific big list into the given big array.

      This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.

      Specified by:
      getElements in interface CharBigList
      Parameters:
      from - the start index (inclusive).
      a - the destination big array.
      offset - the offset into the destination big array where to store the first element copied.
      length - the number of elements to be copied.
    • setElements

      public void setElements(long index, char[][] a, long offset, long length)
      Description copied from interface: CharBigList
      Set (hopefully quickly) elements to match the array given. Sets each in this list to the corresponding elements in the array, as if by
       ListIterator iter = listIterator(index);
       long i = 0;
       while (i < length) {
         iter.next();
         iter.set(BigArrays.get(a, offset + i++);
       }
       
      However, the exact implementation may be more efficient, taking into account whether random access is faster or not, or at the discretion of subclasses, abuse internals.
      Specified by:
      setElements in interface CharBigList
      Parameters:
      index - the index at which to start setting elements.
      a - the big array containing the elements.
      offset - the offset of the first element to add.
      length - the number of elements to add.
    • clear

      public void clear()
      Specified by:
      clear in interface Collection<Character>
      Overrides:
      clear in class AbstractCollection<Character>
    • size

      @Deprecated public int size()
      Deprecated.
      Please use Size64.size64() instead.
      Specified by:
      size in interface it.unimi.dsi.fastutil.BigList<Character>
      Specified by:
      size in interface Collection<Character>
      Specified by:
      size in interface it.unimi.dsi.fastutil.Size64
      Specified by:
      size in class AbstractCollection<Character>
    • hashCode

      public int hashCode()
      Returns the hash code for this big list, which is identical to List.hashCode().
      Specified by:
      hashCode in interface Collection<Character>
      Overrides:
      hashCode in class Object
      Returns:
      the hash code for this big list.
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Collection<Character>
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(it.unimi.dsi.fastutil.BigList<? extends Character> l)
      Compares this big list to another object. If the argument is a BigList, this method performs a lexicographical comparison; otherwise, it throws a ClassCastException.
      Specified by:
      compareTo in interface Comparable<it.unimi.dsi.fastutil.BigList<? extends Character>>
      Parameters:
      l - a big list.
      Returns:
      if the argument is a BigList, a negative integer, zero, or a positive integer as this list is lexicographically less than, equal to, or greater than the argument.
      Throws:
      ClassCastException - if the argument is not a big list.
    • push

      public void push(char o)
      Specified by:
      push in interface it.unimi.dsi.fastutil.chars.CharStack
    • popChar

      public char popChar()
      Specified by:
      popChar in interface it.unimi.dsi.fastutil.chars.CharStack
    • topChar

      public char topChar()
      Specified by:
      topChar in interface it.unimi.dsi.fastutil.chars.CharStack
    • peekChar

      public char peekChar(int i)
      Specified by:
      peekChar in interface it.unimi.dsi.fastutil.chars.CharStack
    • rem

      public boolean rem(char k)
      Removes a single instance of the specified element from this collection, if it is present (optional operation).
      Specified by:
      rem in interface it.unimi.dsi.fastutil.chars.CharCollection
      Overrides:
      rem in class it.unimi.dsi.fastutil.chars.AbstractCharCollection
      See Also:
    • addAll

      public boolean addAll(long index, it.unimi.dsi.fastutil.chars.CharCollection c)
      Inserts all of the elements in the specified type-specific collection into this type-specific big list at the specified position (optional operation).
      Specified by:
      addAll in interface CharBigList
      See Also:
    • addAll

      public boolean addAll(it.unimi.dsi.fastutil.chars.CharCollection c)
      Specified by:
      addAll in interface it.unimi.dsi.fastutil.chars.CharCollection
      Overrides:
      addAll in class it.unimi.dsi.fastutil.chars.AbstractCharCollection
    • add

      @Deprecated public void add(long index, Character ok)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      add in interface it.unimi.dsi.fastutil.BigList<Character>
      Specified by:
      add in interface CharBigList
    • set

      @Deprecated public Character set(long index, Character ok)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      set in interface it.unimi.dsi.fastutil.BigList<Character>
      Specified by:
      set in interface CharBigList
    • get

      @Deprecated public Character get(long index)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      get in interface it.unimi.dsi.fastutil.BigList<Character>
      Specified by:
      get in interface CharBigList
    • indexOf

      @Deprecated public long indexOf(Object ok)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      indexOf in interface it.unimi.dsi.fastutil.BigList<Character>
      Specified by:
      indexOf in interface CharBigList
    • lastIndexOf

      @Deprecated public long lastIndexOf(Object ok)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      lastIndexOf in interface it.unimi.dsi.fastutil.BigList<Character>
      Specified by:
      lastIndexOf in interface CharBigList
    • remove

      @Deprecated public Character remove(long index)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      remove in interface it.unimi.dsi.fastutil.BigList<Character>
      Specified by:
      remove in interface CharBigList
    • push

      @Deprecated public void push(Character o)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      push in interface it.unimi.dsi.fastutil.chars.CharStack
      Specified by:
      push in interface it.unimi.dsi.fastutil.Stack<Character>
    • pop

      @Deprecated public Character pop()
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      pop in interface it.unimi.dsi.fastutil.chars.CharStack
      Specified by:
      pop in interface it.unimi.dsi.fastutil.Stack<Character>
    • top

      @Deprecated public Character top()
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      top in interface it.unimi.dsi.fastutil.chars.CharStack
      Specified by:
      top in interface it.unimi.dsi.fastutil.Stack<Character>
    • peek

      @Deprecated public Character peek(int i)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      peek in interface it.unimi.dsi.fastutil.chars.CharStack
      Specified by:
      peek in interface it.unimi.dsi.fastutil.Stack<Character>
    • toString

      public String toString()
      Overrides:
      toString in class it.unimi.dsi.fastutil.chars.AbstractCharCollection