Package com.google.protobuf
Class FloatArrayList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- com.google.protobuf.AbstractProtobufList<java.lang.Float>
-
- com.google.protobuf.FloatArrayList
-
- All Implemented Interfaces:
Internal.FloatList
,Internal.ProtobufList<java.lang.Float>
,PrimitiveNonBoxingCollection
,java.lang.Iterable<java.lang.Float>
,java.util.Collection<java.lang.Float>
,java.util.List<java.lang.Float>
,java.util.RandomAccess
final class FloatArrayList extends AbstractProtobufList<java.lang.Float> implements Internal.FloatList, java.util.RandomAccess, PrimitiveNonBoxingCollection
An implementation ofInternal.FloatList
on top of a primitive array.
-
-
Field Summary
Fields Modifier and Type Field Description private float[]
array
The backing store for the list.private static FloatArrayList
EMPTY_LIST
private int
size
The size of the list distinct from the length of the array.-
Fields inherited from class com.google.protobuf.AbstractProtobufList
DEFAULT_CAPACITY
-
-
Constructor Summary
Constructors Modifier Constructor Description (package private)
FloatArrayList()
Constructs a new mutableFloatArrayList
with default capacity.private
FloatArrayList(float[] other, int size)
Constructs a new mutableFloatArrayList
containing the same elements asother
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, java.lang.Float element)
boolean
add(java.lang.Float element)
boolean
addAll(java.util.Collection<? extends java.lang.Float> collection)
void
addFloat(float element)
Likeadd(Float)
but more efficient in that it doesn't box the element.private void
addFloat(int index, float element)
Likeadd(int, Float)
but more efficient in that it doesn't box the element.boolean
contains(java.lang.Object element)
static FloatArrayList
emptyList()
private void
ensureIndexInRange(int index)
Ensures that the providedindex
is within the range of[0, size]
.boolean
equals(java.lang.Object o)
java.lang.Float
get(int index)
float
getFloat(int index)
LikeList.get(int)
but more efficient in that it doesn't box the returned value.int
hashCode()
int
indexOf(java.lang.Object element)
private java.lang.String
makeOutOfBoundsExceptionMessage(int index)
Internal.FloatList
mutableCopyWithCapacity(int capacity)
Returns a mutable clone of this list with the specified capacity.java.lang.Float
remove(int index)
boolean
remove(java.lang.Object o)
protected void
removeRange(int fromIndex, int toIndex)
java.lang.Float
set(int index, java.lang.Float element)
float
setFloat(int index, float element)
LikeList.set(int, Object)
but more efficient in that it doesn't box the element.int
size()
-
Methods inherited from class com.google.protobuf.AbstractProtobufList
addAll, clear, ensureIsMutable, isModifiable, makeImmutable, removeAll, retainAll
-
Methods inherited from class java.util.AbstractList
iterator, lastIndexOf, listIterator, listIterator, subList
-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.google.protobuf.Internal.ProtobufList
isModifiable, makeImmutable
-
-
-
-
Field Detail
-
EMPTY_LIST
private static final FloatArrayList EMPTY_LIST
-
array
private float[] array
The backing store for the list.
-
size
private int size
The size of the list distinct from the length of the array. That is, it is the number of elements set in the list.
-
-
Method Detail
-
emptyList
public static FloatArrayList emptyList()
-
removeRange
protected void removeRange(int fromIndex, int toIndex)
- Overrides:
removeRange
in classjava.util.AbstractList<java.lang.Float>
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equals
in interfacejava.util.Collection<java.lang.Float>
- Specified by:
equals
in interfacejava.util.List<java.lang.Float>
- Overrides:
equals
in classAbstractProtobufList<java.lang.Float>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfacejava.util.Collection<java.lang.Float>
- Specified by:
hashCode
in interfacejava.util.List<java.lang.Float>
- Overrides:
hashCode
in classAbstractProtobufList<java.lang.Float>
-
mutableCopyWithCapacity
public Internal.FloatList mutableCopyWithCapacity(int capacity)
Description copied from interface:Internal.FloatList
Returns a mutable clone of this list with the specified capacity.- Specified by:
mutableCopyWithCapacity
in interfaceInternal.FloatList
- Specified by:
mutableCopyWithCapacity
in interfaceInternal.ProtobufList<java.lang.Float>
-
get
public java.lang.Float get(int index)
- Specified by:
get
in interfacejava.util.List<java.lang.Float>
- Specified by:
get
in classjava.util.AbstractList<java.lang.Float>
-
getFloat
public float getFloat(int index)
Description copied from interface:Internal.FloatList
LikeList.get(int)
but more efficient in that it doesn't box the returned value.- Specified by:
getFloat
in interfaceInternal.FloatList
-
indexOf
public int indexOf(java.lang.Object element)
- Specified by:
indexOf
in interfacejava.util.List<java.lang.Float>
- Overrides:
indexOf
in classjava.util.AbstractList<java.lang.Float>
-
contains
public boolean contains(java.lang.Object element)
- Specified by:
contains
in interfacejava.util.Collection<java.lang.Float>
- Specified by:
contains
in interfacejava.util.List<java.lang.Float>
- Overrides:
contains
in classjava.util.AbstractCollection<java.lang.Float>
-
size
public int size()
- Specified by:
size
in interfacejava.util.Collection<java.lang.Float>
- Specified by:
size
in interfacejava.util.List<java.lang.Float>
- Specified by:
size
in classjava.util.AbstractCollection<java.lang.Float>
-
set
public java.lang.Float set(int index, java.lang.Float element)
- Specified by:
set
in interfacejava.util.List<java.lang.Float>
- Overrides:
set
in classAbstractProtobufList<java.lang.Float>
-
setFloat
public float setFloat(int index, float element)
Description copied from interface:Internal.FloatList
LikeList.set(int, Object)
but more efficient in that it doesn't box the element.- Specified by:
setFloat
in interfaceInternal.FloatList
-
add
public boolean add(java.lang.Float element)
- Specified by:
add
in interfacejava.util.Collection<java.lang.Float>
- Specified by:
add
in interfacejava.util.List<java.lang.Float>
- Overrides:
add
in classAbstractProtobufList<java.lang.Float>
-
add
public void add(int index, java.lang.Float element)
- Specified by:
add
in interfacejava.util.List<java.lang.Float>
- Overrides:
add
in classAbstractProtobufList<java.lang.Float>
-
addFloat
public void addFloat(float element)
Likeadd(Float)
but more efficient in that it doesn't box the element.- Specified by:
addFloat
in interfaceInternal.FloatList
-
addFloat
private void addFloat(int index, float element)
Likeadd(int, Float)
but more efficient in that it doesn't box the element.
-
addAll
public boolean addAll(java.util.Collection<? extends java.lang.Float> collection)
- Specified by:
addAll
in interfacejava.util.Collection<java.lang.Float>
- Specified by:
addAll
in interfacejava.util.List<java.lang.Float>
- Overrides:
addAll
in classAbstractProtobufList<java.lang.Float>
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
remove
in interfacejava.util.Collection<java.lang.Float>
- Specified by:
remove
in interfacejava.util.List<java.lang.Float>
- Overrides:
remove
in classAbstractProtobufList<java.lang.Float>
-
remove
public java.lang.Float remove(int index)
- Specified by:
remove
in interfacejava.util.List<java.lang.Float>
- Overrides:
remove
in classAbstractProtobufList<java.lang.Float>
-
ensureIndexInRange
private void ensureIndexInRange(int index)
Ensures that the providedindex
is within the range of[0, size]
. Throws anIndexOutOfBoundsException
if it is not.- Parameters:
index
- the index to verify is in range
-
makeOutOfBoundsExceptionMessage
private java.lang.String makeOutOfBoundsExceptionMessage(int index)
-
-