Package com.google.protobuf
Class FloatArrayList
- All Implemented Interfaces:
Internal.FloatList
,Internal.ProtobufList<Float>
,PrimitiveNonBoxingCollection
,Iterable<Float>
,Collection<Float>
,List<Float>
,RandomAccess
,SequencedCollection<Float>
final class FloatArrayList
extends AbstractProtobufList<Float>
implements Internal.FloatList, RandomAccess, PrimitiveNonBoxingCollection
An implementation of
Internal.FloatList
on top of a primitive array.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate float[]
The backing store for the list.private static final FloatArrayList
private int
The size of the list distinct from the length of the array.Fields inherited from class com.google.protobuf.AbstractProtobufList
DEFAULT_CAPACITY
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorsModifierConstructorDescription(package private)
Constructs a new mutableFloatArrayList
with default capacity.private
FloatArrayList
(float[] other, int size) Constructs a new mutableFloatArrayList
containing the same elements asother
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
boolean
addAll
(Collection<? extends 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
static FloatArrayList
private void
ensureIndexInRange
(int index) Ensures that the providedindex
is within the range of[0, size]
.boolean
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
private String
makeOutOfBoundsExceptionMessage
(int index) mutableCopyWithCapacity
(int capacity) Returns a mutable clone of this list with the specified capacity.remove
(int index) protected void
removeRange
(int fromIndex, int toIndex) 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, remove, 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 java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface com.google.protobuf.Internal.ProtobufList
isModifiable, makeImmutable
Methods inherited from interface java.util.List
addAll, addFirst, addLast, clear, containsAll, getFirst, getLast, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, subList, toArray, toArray
-
Field Details
-
EMPTY_LIST
-
array
private float[] arrayThe backing store for the list. -
size
private int sizeThe size of the list distinct from the length of the array. That is, it is the number of elements set in the list.
-
-
Constructor Details
-
FloatArrayList
FloatArrayList()Constructs a new mutableFloatArrayList
with default capacity. -
FloatArrayList
private FloatArrayList(float[] other, int size) Constructs a new mutableFloatArrayList
containing the same elements asother
.
-
-
Method Details
-
emptyList
-
removeRange
protected void removeRange(int fromIndex, int toIndex) - Overrides:
removeRange
in classAbstractList<Float>
-
equals
- Specified by:
equals
in interfaceCollection<Float>
- Specified by:
equals
in interfaceList<Float>
- Overrides:
equals
in classAbstractProtobufList<Float>
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<Float>
- Specified by:
hashCode
in interfaceList<Float>
- Overrides:
hashCode
in classAbstractProtobufList<Float>
-
mutableCopyWithCapacity
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<Float>
-
get
-
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
-
contains
- Specified by:
contains
in interfaceCollection<Float>
- Specified by:
contains
in interfaceList<Float>
- Overrides:
contains
in classAbstractCollection<Float>
-
size
public int size()- Specified by:
size
in interfaceCollection<Float>
- Specified by:
size
in interfaceList<Float>
- Specified by:
size
in classAbstractCollection<Float>
-
set
-
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
- Specified by:
add
in interfaceCollection<Float>
- Specified by:
add
in interfaceList<Float>
- Overrides:
add
in classAbstractProtobufList<Float>
-
add
-
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
- Specified by:
addAll
in interfaceCollection<Float>
- Specified by:
addAll
in interfaceList<Float>
- Overrides:
addAll
in classAbstractProtobufList<Float>
-
remove
-
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
-