Class AbstractShortBigList

java.lang.Object
java.util.AbstractCollection<Short>
it.unimi.dsi.fastutil.shorts.AbstractShortCollection
it.unimi.dsi.fastutil.shorts.AbstractShortBigList
All Implemented Interfaces:
it.unimi.dsi.fastutil.BigList<Short>, ShortBigList, it.unimi.dsi.fastutil.shorts.ShortCollection, it.unimi.dsi.fastutil.shorts.ShortIterable, it.unimi.dsi.fastutil.shorts.ShortStack, it.unimi.dsi.fastutil.Size64, it.unimi.dsi.fastutil.Stack<Short>, Comparable<it.unimi.dsi.fastutil.BigList<? extends Short>>, Iterable<Short>, Collection<Short>
Direct Known Subclasses:
AbstractShortBigList.ShortSubList, ShortBigArrayBigList, ShortBigLists.ListBigList, ShortBigLists.Singleton, ShortMappedBigList

public abstract class AbstractShortBigList extends it.unimi.dsi.fastutil.shorts.AbstractShortCollection implements ShortBigList, it.unimi.dsi.fastutil.shorts.ShortStack
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.Short>)) 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
    void
    add(long index, short k)
    Inserts the specified element at the specified position in this type-specific big list (optional operation).
    void
    add(long index, Short ok)
    Deprecated.
    Please use the corresponding type-specific method instead.
    boolean
    add(short k)
    boolean
    addAll(long index, it.unimi.dsi.fastutil.shorts.ShortCollection 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 Short> c)
    Adds all of the elements in the specified collection to this list (optional operation).
    boolean
    addAll(it.unimi.dsi.fastutil.shorts.ShortCollection c)
    boolean
    addAll(Collection<? extends Short> c)
    void
    addElements(long index, short[][] a)
    Add (hopefully quickly) elements to this type-specific big list.
    void
    addElements(long index, short[][] a, long offset, long length)
    Add (hopefully quickly) elements to this type-specific big list.
    void
    int
    compareTo(it.unimi.dsi.fastutil.BigList<? extends Short> l)
    Compares this big list to another object.
    boolean
    contains(short 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.shorts.ShortConsumer action)
    get(long index)
    Deprecated.
    Please use the corresponding type-specific method instead.
    void
    getElements(long from, short[][] 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(short 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.shorts.ShortBigListIterator
    Returns a type-specific iterator on the elements of this list.
    long
    lastIndexOf(short 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.shorts.ShortBigListIterator
    Returns a type-specific big-list iterator on this type-specific big list.
    it.unimi.dsi.fastutil.shorts.ShortBigListIterator
    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.
    short
    peekShort(int i)
     
    pop()
    Deprecated.
    Please use the corresponding type-specific method instead.
    short
     
    void
    push(short o)
     
    void
    Deprecated.
    Please use the corresponding type-specific method instead.
    boolean
    rem(short 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.
    void
    removeElements(long from, long to)
    Removes (hopefully quickly) elements of this type-specific big list.
    short
    removeShort(long i)
    Removes the element at the specified position.
    short
    set(long index, short k)
    Replaces the element at the specified position in this big list with the specified element (optional operation).
    set(long index, Short ok)
    Deprecated.
    Please use the corresponding type-specific method instead.
    void
    setElements(long index, short[][] 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.
    short
     
     

    Methods inherited from class it.unimi.dsi.fastutil.shorts.AbstractShortCollection

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

    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 java.util.Collection

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

    Methods inherited from interface it.unimi.dsi.fastutil.shorts.ShortBigList

    addAll, addAll, addAll, addAll, getElements, getShort, setElements, setElements, spliterator

    Methods inherited from interface it.unimi.dsi.fastutil.shorts.ShortCollection

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

    Methods inherited from interface it.unimi.dsi.fastutil.shorts.ShortIterable

    forEach, forEach

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

    size64

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

    isEmpty
  • Constructor Details

    • AbstractShortBigList

      protected AbstractShortBigList()
  • 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, short k)
      Inserts the specified element at the specified position in this type-specific big list (optional operation).
      Specified by:
      add in interface ShortBigList
      See Also:
      • BigList.add(long,Object)
    • add

      public boolean add(short k)
      Specified by:
      add in interface it.unimi.dsi.fastutil.shorts.ShortCollection
      Overrides:
      add in class it.unimi.dsi.fastutil.shorts.AbstractShortCollection
    • removeShort

      public short removeShort(long i)
      Removes the element at the specified position.
      Specified by:
      removeShort in interface ShortBigList
      See Also:
      • BigList.remove(long)
    • set

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

      public boolean addAll(long index, Collection<? extends Short> 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<Short>
    • addAll

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

      public it.unimi.dsi.fastutil.shorts.ShortBigListIterator iterator()
      Returns a type-specific iterator on the elements of this list.
      Specified by:
      iterator in interface Collection<Short>
      Specified by:
      iterator in interface Iterable<Short>
      Specified by:
      iterator in interface ShortBigList
      Specified by:
      iterator in interface it.unimi.dsi.fastutil.shorts.ShortCollection
      Specified by:
      iterator in interface it.unimi.dsi.fastutil.shorts.ShortIterable
      Specified by:
      iterator in class it.unimi.dsi.fastutil.shorts.AbstractShortCollection
      See Also:
    • listIterator

      public it.unimi.dsi.fastutil.shorts.ShortBigListIterator listIterator()
      Returns a type-specific big-list iterator on this type-specific big list.
      Specified by:
      listIterator in interface it.unimi.dsi.fastutil.BigList<Short>
      Specified by:
      listIterator in interface ShortBigList
      See Also:
      • BigList.listIterator()
    • listIterator

      public it.unimi.dsi.fastutil.shorts.ShortBigListIterator 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<Short>
      Specified by:
      listIterator in interface ShortBigList
      See Also:
      • BigList.listIterator(long)
    • intSpliterator

      public it.unimi.dsi.fastutil.ints.IntSpliterator intSpliterator()
      Specified by:
      intSpliterator in interface it.unimi.dsi.fastutil.shorts.ShortCollection
      Specified by:
      intSpliterator in interface it.unimi.dsi.fastutil.shorts.ShortIterable
    • contains

      public boolean contains(short k)
      Returns true if this list contains the specified element.
      Specified by:
      contains in interface it.unimi.dsi.fastutil.shorts.ShortCollection
      Overrides:
      contains in class it.unimi.dsi.fastutil.shorts.AbstractShortCollection
      See Also:
    • indexOf

      public long indexOf(short k)
      Description copied from interface: ShortBigList
      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 ShortBigList
      See Also:
      • BigList.indexOf(Object)
    • lastIndexOf

      public long lastIndexOf(short k)
      Description copied from interface: ShortBigList
      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 ShortBigList
      See Also:
      • BigList.lastIndexOf(Object)
    • size

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

      public ShortBigList subList(long from, long to)
      Description copied from interface: ShortBigList
      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<Short>
      Specified by:
      subList in interface ShortBigList
      See Also:
      • BigList.subList(long,long)
    • forEach

      public void forEach(it.unimi.dsi.fastutil.shorts.ShortConsumer action)
      Specified by:
      forEach in interface it.unimi.dsi.fastutil.shorts.ShortIterable
    • 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 ShortBigList
      Parameters:
      from - the start index (inclusive).
      to - the end index (exclusive).
    • addElements

      public void addElements(long index, short[][] 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 ShortBigList
      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, short[][] a)
      Add (hopefully quickly) elements to this type-specific big list.
      Specified by:
      addElements in interface ShortBigList
      Parameters:
      index - the index at which to add elements.
      a - the big array containing the elements.
    • getElements

      public void getElements(long from, short[][] 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 ShortBigList
      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, short[][] a, long offset, long length)
      Description copied from interface: ShortBigList
      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 ShortBigList
      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<Short>
      Overrides:
      clear in class AbstractCollection<Short>
    • size

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

      public int hashCode()
      Returns the hash code for this big list, which is identical to List.hashCode().
      Specified by:
      hashCode in interface Collection<Short>
      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<Short>
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(it.unimi.dsi.fastutil.BigList<? extends Short> 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 Short>>
      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(short o)
      Specified by:
      push in interface it.unimi.dsi.fastutil.shorts.ShortStack
    • popShort

      public short popShort()
      Specified by:
      popShort in interface it.unimi.dsi.fastutil.shorts.ShortStack
    • topShort

      public short topShort()
      Specified by:
      topShort in interface it.unimi.dsi.fastutil.shorts.ShortStack
    • peekShort

      public short peekShort(int i)
      Specified by:
      peekShort in interface it.unimi.dsi.fastutil.shorts.ShortStack
    • rem

      public boolean rem(short 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.shorts.ShortCollection
      Overrides:
      rem in class it.unimi.dsi.fastutil.shorts.AbstractShortCollection
      See Also:
    • addAll

      public boolean addAll(long index, it.unimi.dsi.fastutil.shorts.ShortCollection 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 ShortBigList
      See Also:
    • addAll

      public boolean addAll(it.unimi.dsi.fastutil.shorts.ShortCollection c)
      Specified by:
      addAll in interface it.unimi.dsi.fastutil.shorts.ShortCollection
      Overrides:
      addAll in class it.unimi.dsi.fastutil.shorts.AbstractShortCollection
    • add

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

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

      @Deprecated public Short get(long index)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      get in interface it.unimi.dsi.fastutil.BigList<Short>
      Specified by:
      get in interface ShortBigList
    • 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<Short>
      Specified by:
      indexOf in interface ShortBigList
    • 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<Short>
      Specified by:
      lastIndexOf in interface ShortBigList
    • remove

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

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

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

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

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

      public String toString()
      Overrides:
      toString in class it.unimi.dsi.fastutil.shorts.AbstractShortCollection