final class LongArrayList extends AbstractProtobufList<java.lang.Long> implements Internal.LongList, java.util.RandomAccess, PrimitiveNonBoxingCollection
Internal.LongList
on top of a primitive array.Modifier and Type | Field and Description |
---|---|
private long[] |
array
The backing store for the list.
|
private static LongArrayList |
EMPTY_LIST |
private int |
size
The size of the list distinct from the length of the array.
|
DEFAULT_CAPACITY
Modifier | Constructor and Description |
---|---|
(package private) |
LongArrayList()
Constructs a new mutable
LongArrayList with default capacity. |
private |
LongArrayList(long[] other,
int size)
Constructs a new mutable
LongArrayList
containing the same elements as other . |
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
java.lang.Long element) |
boolean |
addAll(java.util.Collection<? extends java.lang.Long> collection) |
private void |
addLong(int index,
long element)
Like
add(int, Long) but more efficient in that it doesn't box the element. |
void |
addLong(long element)
Like
#add(Long) but more efficient in that it doesn't box the element. |
static LongArrayList |
emptyList() |
private void |
ensureIndexInRange(int index)
Ensures that the provided
index is within the range of [0, size] . |
boolean |
equals(java.lang.Object o) |
java.lang.Long |
get(int index) |
long |
getLong(int index)
Like
List.get(int) but more efficient in that it doesn't box the returned value. |
int |
hashCode() |
private java.lang.String |
makeOutOfBoundsExceptionMessage(int index) |
Internal.LongList |
mutableCopyWithCapacity(int capacity)
Returns a mutable clone of this list with the specified capacity.
|
java.lang.Long |
remove(int index) |
boolean |
remove(java.lang.Object o) |
protected void |
removeRange(int fromIndex,
int toIndex) |
java.lang.Long |
set(int index,
java.lang.Long element) |
long |
setLong(int index,
long element)
Like
List.set(int, Object) but more efficient in that it doesn't box the element. |
int |
size() |
add, addAll, clear, ensureIsMutable, isModifiable, makeImmutable, removeAll, retainAll
indexOf, iterator, lastIndexOf, listIterator, listIterator, subList
contains, containsAll, isEmpty, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isModifiable, makeImmutable
private static final LongArrayList EMPTY_LIST
private long[] array
private int size
LongArrayList()
LongArrayList
with default capacity.private LongArrayList(long[] other, int size)
LongArrayList
containing the same elements as other
.public static LongArrayList emptyList()
protected void removeRange(int fromIndex, int toIndex)
removeRange
in class java.util.AbstractList<java.lang.Long>
public boolean equals(java.lang.Object o)
equals
in interface java.util.Collection<java.lang.Long>
equals
in interface java.util.List<java.lang.Long>
equals
in class AbstractProtobufList<java.lang.Long>
public int hashCode()
hashCode
in interface java.util.Collection<java.lang.Long>
hashCode
in interface java.util.List<java.lang.Long>
hashCode
in class AbstractProtobufList<java.lang.Long>
public Internal.LongList mutableCopyWithCapacity(int capacity)
Internal.LongList
mutableCopyWithCapacity
in interface Internal.LongList
mutableCopyWithCapacity
in interface Internal.ProtobufList<java.lang.Long>
public java.lang.Long get(int index)
get
in interface java.util.List<java.lang.Long>
get
in class java.util.AbstractList<java.lang.Long>
public long getLong(int index)
Internal.LongList
List.get(int)
but more efficient in that it doesn't box the returned value.getLong
in interface Internal.LongList
public int size()
size
in interface java.util.Collection<java.lang.Long>
size
in interface java.util.List<java.lang.Long>
size
in class java.util.AbstractCollection<java.lang.Long>
public java.lang.Long set(int index, java.lang.Long element)
set
in interface java.util.List<java.lang.Long>
set
in class AbstractProtobufList<java.lang.Long>
public long setLong(int index, long element)
Internal.LongList
List.set(int, Object)
but more efficient in that it doesn't box the element.setLong
in interface Internal.LongList
public void add(int index, java.lang.Long element)
add
in interface java.util.List<java.lang.Long>
add
in class AbstractProtobufList<java.lang.Long>
public void addLong(long element)
#add(Long)
but more efficient in that it doesn't box the element.addLong
in interface Internal.LongList
private void addLong(int index, long element)
add(int, Long)
but more efficient in that it doesn't box the element.public boolean addAll(java.util.Collection<? extends java.lang.Long> collection)
addAll
in interface java.util.Collection<java.lang.Long>
addAll
in interface java.util.List<java.lang.Long>
addAll
in class AbstractProtobufList<java.lang.Long>
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection<java.lang.Long>
remove
in interface java.util.List<java.lang.Long>
remove
in class AbstractProtobufList<java.lang.Long>
public java.lang.Long remove(int index)
remove
in interface java.util.List<java.lang.Long>
remove
in class AbstractProtobufList<java.lang.Long>
private void ensureIndexInRange(int index)
index
is within the range of [0, size]
. Throws an
IndexOutOfBoundsException
if it is not.index
- the index to verify is in rangeprivate java.lang.String makeOutOfBoundsExceptionMessage(int index)