public class SimpleLongArrayList extends AbstractLongList
long
elements; implemented with arrays; not efficient; just to
demonstrate which methods you must override to implement a fully functional list.size
Constructor and Description |
---|
SimpleLongArrayList()
Constructs an empty list.
|
SimpleLongArrayList(long[] elements)
Constructs a list containing the specified elements.
|
Modifier and Type | Method and Description |
---|---|
void |
ensureCapacity(int minCapacity)
Ensures that the receiver can hold at least the specified number of elements without needing to allocate new
internal memory.
|
protected long |
getQuick(int index)
Returns the element at the specified position in the receiver; WARNING: Does not check preconditions.
|
protected void |
setQuick(int index,
long element)
Replaces the element at the specified position in the receiver with the specified element; WARNING: Does not
check preconditions.
|
void |
trimToSize()
Trims the capacity of the receiver to be the receiver's current size.
|
add, addAllOf, addAllOf, addAllOfFromTo, beforeInsert, beforeInsertAllOfFromTo, beforeInsertDummies, binarySearch, binarySearchFromTo, clone, contains, delete, elements, elements, equals, fillFromToWith, forEach, get, indexOf, indexOfFromTo, lastIndexOf, lastIndexOfFromTo, mergeSortFromTo, mergeSortFromTo, partFromTo, quickSortFromTo, quickSortFromTo, removeAll, removeFromTo, replaceFromToWithFrom, replaceFromToWithFromTo, retainAll, reverse, set, setSizeRaw, size, times, toArray, toList, toString
checkRange, checkRangeFromTo, clear, isEmpty, mergeSort, quickSort, remove, setSize, sort, sortFromTo
public SimpleLongArrayList()
public SimpleLongArrayList(long[] elements)
elements
- the array to be backed by the the constructed listpublic void ensureCapacity(int minCapacity)
ensureCapacity
in class AbstractLongList
minCapacity
- the desired minimum capacity.protected long getQuick(int index)
getQuick
in class AbstractLongList
index
- index of element to return.protected void setQuick(int index, long element)
setQuick
in class AbstractLongList
index
- index of element to replace.element
- element to be stored at the specified position.public void trimToSize()
trimToSize
in class AbstractList
Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.