Class LongList


public class LongList extends ElementList
Resizable-array implementation for native long values.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected long[]
    Element container.

    Fields inherited from class org.basex.util.list.ElementList

    factor, size
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
    LongList(long capacity)
    Constructor with initial capacity.
  • Method Summary

    Modifier and Type
    Method
    Description
    final LongList
    add(long element)
    Adds an element to the array.
    final LongList
    add(long... elements)
    Adds elements to the array.
    Removes duplicate entries.
    boolean
     
    long[]
    Returns an array with all elements and invalidates the internal array.
    final long
    get(int index)
    Returns the element at the specified position.
    final long
    Returns the uppermost element from the stack.
    final long
    pop()
    Pops the uppermost element from the stack.
    final void
    push(long element)
    Pushes an element onto the stack.
    Sorts the data.
    final long[]
    Returns an array with all elements.
     

    Methods inherited from class org.basex.util.list.ElementList

    isEmpty, newCapacity, newCapacity, reset, size, size

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • list

      protected long[] list
      Element container.
  • Constructor Details

    • LongList

      public LongList()
      Default constructor.
    • LongList

      public LongList(long capacity)
      Constructor with initial capacity.
      Parameters:
      capacity - array capacity
  • Method Details

    • add

      public final LongList add(long element)
      Adds an element to the array.
      Parameters:
      element - element to be added
      Returns:
      self reference
    • add

      public final LongList add(long... elements)
      Adds elements to the array.
      Parameters:
      elements - elements to be added
      Returns:
      self reference
    • get

      public final long get(int index)
      Returns the element at the specified position.
      Parameters:
      index - index of the element to return
      Returns:
      element
    • peek

      public final long peek()
      Returns the uppermost element from the stack.
      Returns:
      the uppermost element
    • pop

      public final long pop()
      Pops the uppermost element from the stack.
      Returns:
      the popped element
    • push

      public final void push(long element)
      Pushes an element onto the stack.
      Parameters:
      element - element
    • toArray

      public final long[] toArray()
      Returns an array with all elements.
      Returns:
      array
    • finish

      public long[] finish()
      Returns an array with all elements and invalidates the internal array. Warning: the function must only be called if the list is discarded afterwards.
      Returns:
      array (internal representation!)
    • sort

      public LongList sort()
      Sorts the data.
      Returns:
      self reference
    • distinct

      public LongList distinct()
      Removes duplicate entries.
      Returns:
      self reference
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object