Class TShortLinkedList

java.lang.Object
gnu.trove.list.linked.TShortLinkedList
All Implemented Interfaces:
gnu.trove.list.TShortList, gnu.trove.TShortCollection, Externalizable, Serializable

public class TShortLinkedList extends Object implements gnu.trove.list.TShortList, Externalizable
A resizable, double linked list of short primitives.
See Also:
  • Constructor Details

    • TShortLinkedList

      public TShortLinkedList()
    • TShortLinkedList

      public TShortLinkedList(short no_entry_value)
    • TShortLinkedList

      public TShortLinkedList(gnu.trove.list.TShortList list)
  • Method Details

    • getNoEntryValue

      public short getNoEntryValue()
      Specified by:
      getNoEntryValue in interface gnu.trove.TShortCollection
      Specified by:
      getNoEntryValue in interface gnu.trove.list.TShortList
    • size

      public int size()
      Specified by:
      size in interface gnu.trove.TShortCollection
      Specified by:
      size in interface gnu.trove.list.TShortList
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface gnu.trove.TShortCollection
      Specified by:
      isEmpty in interface gnu.trove.list.TShortList
    • add

      public boolean add(short val)
      Specified by:
      add in interface gnu.trove.TShortCollection
      Specified by:
      add in interface gnu.trove.list.TShortList
    • add

      public void add(short[] vals)
      Specified by:
      add in interface gnu.trove.list.TShortList
    • add

      public void add(short[] vals, int offset, int length)
      Specified by:
      add in interface gnu.trove.list.TShortList
    • insert

      public void insert(int offset, short value)
      Specified by:
      insert in interface gnu.trove.list.TShortList
    • insert

      public void insert(int offset, short[] values)
      Specified by:
      insert in interface gnu.trove.list.TShortList
    • insert

      public void insert(int offset, short[] values, int valOffset, int len)
      Specified by:
      insert in interface gnu.trove.list.TShortList
    • get

      public short get(int offset)
      Specified by:
      get in interface gnu.trove.list.TShortList
    • getLinkAt

      public gnu.trove.list.linked.TShortLinkedList.TShortLink getLinkAt(int offset)

      Returns the link at the given offset.

      A simple bisection criteria is used to keep the worst case complexity equal to O(n/2) where n = size(). Simply start from head of list or tail depending on offset and list size.

      Parameters:
      offset - of the link
      Returns:
      link or null if non-existent
    • set

      public short set(int offset, short val)
      Specified by:
      set in interface gnu.trove.list.TShortList
    • set

      public void set(int offset, short[] values)
      Specified by:
      set in interface gnu.trove.list.TShortList
    • set

      public void set(int offset, short[] values, int valOffset, int length)
      Specified by:
      set in interface gnu.trove.list.TShortList
    • replace

      public short replace(int offset, short val)
      Specified by:
      replace in interface gnu.trove.list.TShortList
    • clear

      public void clear()
      Specified by:
      clear in interface gnu.trove.TShortCollection
      Specified by:
      clear in interface gnu.trove.list.TShortList
    • remove

      public boolean remove(short value)
      Specified by:
      remove in interface gnu.trove.TShortCollection
      Specified by:
      remove in interface gnu.trove.list.TShortList
    • containsAll

      public boolean containsAll(Collection<?> collection)
      Specified by:
      containsAll in interface gnu.trove.TShortCollection
    • containsAll

      public boolean containsAll(gnu.trove.TShortCollection collection)
      Specified by:
      containsAll in interface gnu.trove.TShortCollection
    • containsAll

      public boolean containsAll(short[] array)
      Specified by:
      containsAll in interface gnu.trove.TShortCollection
    • addAll

      public boolean addAll(Collection<? extends Short> collection)
      Specified by:
      addAll in interface gnu.trove.TShortCollection
    • addAll

      public boolean addAll(gnu.trove.TShortCollection collection)
      Specified by:
      addAll in interface gnu.trove.TShortCollection
    • addAll

      public boolean addAll(short[] array)
      Specified by:
      addAll in interface gnu.trove.TShortCollection
    • retainAll

      public boolean retainAll(Collection<?> collection)
      Specified by:
      retainAll in interface gnu.trove.TShortCollection
    • retainAll

      public boolean retainAll(gnu.trove.TShortCollection collection)
      Specified by:
      retainAll in interface gnu.trove.TShortCollection
    • retainAll

      public boolean retainAll(short[] array)
      Specified by:
      retainAll in interface gnu.trove.TShortCollection
    • removeAll

      public boolean removeAll(Collection<?> collection)
      Specified by:
      removeAll in interface gnu.trove.TShortCollection
    • removeAll

      public boolean removeAll(gnu.trove.TShortCollection collection)
      Specified by:
      removeAll in interface gnu.trove.TShortCollection
    • removeAll

      public boolean removeAll(short[] array)
      Specified by:
      removeAll in interface gnu.trove.TShortCollection
    • removeAt

      public short removeAt(int offset)
      Specified by:
      removeAt in interface gnu.trove.list.TShortList
    • remove

      public void remove(int offset, int length)
      Specified by:
      remove in interface gnu.trove.list.TShortList
    • transformValues

      public void transformValues(gnu.trove.function.TShortFunction function)
      Specified by:
      transformValues in interface gnu.trove.list.TShortList
    • reverse

      public void reverse()
      Specified by:
      reverse in interface gnu.trove.list.TShortList
    • reverse

      public void reverse(int from, int to)
      Specified by:
      reverse in interface gnu.trove.list.TShortList
    • shuffle

      public void shuffle(Random rand)
      Specified by:
      shuffle in interface gnu.trove.list.TShortList
    • subList

      public gnu.trove.list.TShortList subList(int begin, int end)
      Specified by:
      subList in interface gnu.trove.list.TShortList
    • toArray

      public short[] toArray()
      Specified by:
      toArray in interface gnu.trove.TShortCollection
      Specified by:
      toArray in interface gnu.trove.list.TShortList
    • toArray

      public short[] toArray(int offset, int len)
      Specified by:
      toArray in interface gnu.trove.list.TShortList
    • toArray

      public short[] toArray(short[] dest)
      Specified by:
      toArray in interface gnu.trove.TShortCollection
      Specified by:
      toArray in interface gnu.trove.list.TShortList
    • toArray

      public short[] toArray(short[] dest, int offset, int len)
      Specified by:
      toArray in interface gnu.trove.list.TShortList
    • toArray

      public short[] toArray(short[] dest, int source_pos, int dest_pos, int len)
      Specified by:
      toArray in interface gnu.trove.list.TShortList
    • forEach

      public boolean forEach(gnu.trove.procedure.TShortProcedure procedure)
      Specified by:
      forEach in interface gnu.trove.TShortCollection
      Specified by:
      forEach in interface gnu.trove.list.TShortList
    • forEachDescending

      public boolean forEachDescending(gnu.trove.procedure.TShortProcedure procedure)
      Specified by:
      forEachDescending in interface gnu.trove.list.TShortList
    • sort

      public void sort()
      Specified by:
      sort in interface gnu.trove.list.TShortList
    • sort

      public void sort(int fromIndex, int toIndex)
      Specified by:
      sort in interface gnu.trove.list.TShortList
    • fill

      public void fill(short val)
      Specified by:
      fill in interface gnu.trove.list.TShortList
    • fill

      public void fill(int fromIndex, int toIndex, short val)
      Specified by:
      fill in interface gnu.trove.list.TShortList
    • binarySearch

      public int binarySearch(short value)
      Specified by:
      binarySearch in interface gnu.trove.list.TShortList
    • binarySearch

      public int binarySearch(short value, int fromIndex, int toIndex)
      Specified by:
      binarySearch in interface gnu.trove.list.TShortList
    • indexOf

      public int indexOf(short value)
      Specified by:
      indexOf in interface gnu.trove.list.TShortList
    • indexOf

      public int indexOf(int offset, short value)
      Specified by:
      indexOf in interface gnu.trove.list.TShortList
    • lastIndexOf

      public int lastIndexOf(short value)
      Specified by:
      lastIndexOf in interface gnu.trove.list.TShortList
    • lastIndexOf

      public int lastIndexOf(int offset, short value)
      Specified by:
      lastIndexOf in interface gnu.trove.list.TShortList
    • contains

      public boolean contains(short value)
      Specified by:
      contains in interface gnu.trove.TShortCollection
      Specified by:
      contains in interface gnu.trove.list.TShortList
    • iterator

      public gnu.trove.iterator.TShortIterator iterator()
      Specified by:
      iterator in interface gnu.trove.TShortCollection
    • grep

      public gnu.trove.list.TShortList grep(gnu.trove.procedure.TShortProcedure condition)
      Specified by:
      grep in interface gnu.trove.list.TShortList
    • inverseGrep

      public gnu.trove.list.TShortList inverseGrep(gnu.trove.procedure.TShortProcedure condition)
      Specified by:
      inverseGrep in interface gnu.trove.list.TShortList
    • max

      public short max()
      Specified by:
      max in interface gnu.trove.list.TShortList
    • min

      public short min()
      Specified by:
      min in interface gnu.trove.list.TShortList
    • sum

      public short sum()
      Specified by:
      sum in interface gnu.trove.list.TShortList
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
      ClassNotFoundException
    • equals

      public boolean equals(Object other)
      Specified by:
      equals in interface gnu.trove.TShortCollection
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface gnu.trove.TShortCollection
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object