Package frc.lib.util
Class LongArrayList
java.lang.Object
frc.lib.util.LongArrayList
- All Implemented Interfaces:
Serializable,Cloneable,RandomAccess
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
FieldsModifier and TypeFieldDescriptionprotected long[]static final intDuring 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(long k) Appendskto the end of this list.voidclear()longget(int index) Get long element at indexindex.booleanisEmpty()Checks if the list has no elements.longremove(int index) Removes the element at the specified position in this list.intsize()Returns the number of elements in this list.
-
Field Details
-
DEFAULT_INITIAL_CAPACITY
public static final int DEFAULT_INITIAL_CAPACITYDuring 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
-
LongArrayList
public LongArrayList()Creates a new array list withDEFAULT_INITIAL_CAPACITYcapacity.
-
-
Method Details
-
add
public void add(long k) Appendskto the end of this list. -
get
public long get(int index) Get long element at indexindex. -
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()
-