Class LongArrayList

java.lang.Object
smile.util.LongArrayList
All Implemented Interfaces:
Serializable

public final class LongArrayList extends Object implements Serializable
A resizeable, array-backed list of long primitives.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an empty list with initial capacity 10.
    LongArrayList(int capacity)
    Constructs an empty list with the specified initial capacity.
    LongArrayList(long[] values)
    Constructs a list containing the values of the specified array.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(long val)
    Appends the specified value to the end of this list.
    void
    add(long[] vals)
    Appends all values in the specified array.
    void
    Removes all elements from the list.
    void
    ensureCapacity(int capacity)
    Ensures capacity is at least capacity.
    long
    get(int index)
    Returns the element at the specified index.
    boolean
    Returns true if this list contains no elements.
    void
    set(int index, long val)
    Sets the element at the specified index.
    int
    Returns the number of elements.
    Returns the stream of elements.
    long[]
    Returns an array containing all elements in proper sequence.
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • LongArrayList

      public LongArrayList()
      Constructs an empty list with initial capacity 10.
    • LongArrayList

      public LongArrayList(int capacity)
      Constructs an empty list with the specified initial capacity.
      Parameters:
      capacity - the initial capacity.
    • LongArrayList

      public LongArrayList(long[] values)
      Constructs a list containing the values of the specified array.
      Parameters:
      values - the initial values.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • stream

      public LongStream stream()
      Returns the stream of elements.
      Returns:
      the stream.
    • ensureCapacity

      public void ensureCapacity(int capacity)
      Ensures capacity is at least capacity.
      Parameters:
      capacity - the minimum required capacity.
    • size

      public int size()
      Returns the number of elements.
      Returns:
      the number of elements.
    • isEmpty

      public boolean isEmpty()
      Returns true if this list contains no elements.
      Returns:
      true if empty.
    • get

      public long get(int index)
      Returns the element at the specified index.
      Parameters:
      index - the index.
      Returns:
      the element.
    • set

      public void set(int index, long val)
      Sets the element at the specified index.
      Parameters:
      index - the index.
      val - the new value.
    • add

      public void add(long val)
      Appends the specified value to the end of this list.
      Parameters:
      val - the value.
    • add

      public void add(long[] vals)
      Appends all values in the specified array.
      Parameters:
      vals - the values.
    • clear

      public void clear()
      Removes all elements from the list.
    • toArray

      public long[] toArray()
      Returns an array containing all elements in proper sequence.
      Returns:
      a copy of the backing array trimmed to size.