Package frc.lib.util

Class LongArrayList

java.lang.Object
frc.lib.util.LongArrayList
All Implemented Interfaces:
Serializable, Cloneable, RandomAccess

public class LongArrayList extends Object implements RandomAccess, Cloneable, Serializable
An optimized long array. Used in lieu of an ArrayList<Long> to avoid boxing (and the performance implications that come with it).

Current interface is limited to the methods used by LoggingProfiler, though its interface may expand in the future to match the full List interface.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected long[]
     
    static final int
    During list creation, many reallocations at low capacities may be common, so we jump from 0 to 10 before our normal reallocation scheme.
    protected int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new array list with DEFAULT_INITIAL_CAPACITY capacity.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(long k)
    Appends k to the end of this list.
    void
     
    long
    get(int index)
    Get long element at index index.
    boolean
    Checks if the list has no elements.
    long
    remove(int index)
    Removes the element at the specified position in this list.
    int
    Returns the number of elements in this list.

    Methods inherited from class java.lang.Object

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

    • DEFAULT_INITIAL_CAPACITY

      public static final int DEFAULT_INITIAL_CAPACITY
      During list creation, many reallocations at low capacities may be common, so we jump from 0 to 10 before our normal reallocation scheme.
      See Also:
    • backing

      protected transient long[] backing
    • size

      protected int size
  • Constructor Details

  • Method Details

    • add

      public void add(long k)
      Appends k to the end of this list.
    • get

      public long get(int index)
      Get long element at index index.
    • isEmpty

      public boolean isEmpty()
      Checks if the list has no elements.
    • size

      public int size()
      Returns the number of elements in this list.
    • remove

      public long remove(int index)
      Removes the element at the specified position in this list.
    • clear

      public void clear()