Package com.google.protobuf
Class FloatArrayList
- All Implemented Interfaces:
Internal.FloatList,Internal.ProtobufList<Float>,PrimitiveNonBoxingCollection,Iterable<Float>,Collection<Float>,List<Float>,RandomAccess
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 FloatArrayListprivate intThe size of the list distinct from the length of the array.Fields inherited from class com.google.protobuf.AbstractProtobufList
DEFAULT_CAPACITYFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)Constructs a new mutableFloatArrayListwith default capacity.privateFloatArrayList(float[] other, int size, boolean isMutable) Constructs a new mutableFloatArrayListcontaining the same elements asother. -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(Collection<? extends Float> collection) voidaddFloat(float element) Likeadd(Float)but more efficient in that it doesn't box the element.private voidaddFloat(int index, float element) Likeadd(int, Float)but more efficient in that it doesn't box the element.booleanstatic FloatArrayListprivate voidensureIndexInRange(int index) Ensures that the providedindexis within the range of[0, size].booleanget(int index) floatgetFloat(int index) LikeList.get(int)but more efficient in that it doesn't box the returned value.inthashCode()intprivate StringmakeOutOfBoundsExceptionMessage(int index) mutableCopyWithCapacity(int capacity) Returns a mutable clone of this list with the specified capacity.remove(int index) protected voidremoveRange(int fromIndex, int toIndex) floatsetFloat(int index, float element) LikeList.set(int, Object)but more efficient in that it doesn't box the element.intsize()Methods inherited from class com.google.protobuf.AbstractProtobufList
addAll, clear, ensureIsMutable, isModifiable, makeImmutable, remove, removeAll, retainAllMethods inherited from class java.util.AbstractList
iterator, lastIndexOf, listIterator, listIterator, subListMethods inherited from class java.util.AbstractCollection
containsAll, isEmpty, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface com.google.protobuf.Internal.ProtobufList
isModifiable, makeImmutableMethods inherited from interface java.util.List
addAll, clear, containsAll, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, replaceAll, retainAll, 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 mutableFloatArrayListwith default capacity. -
FloatArrayList
private FloatArrayList(float[] other, int size, boolean isMutable) Constructs a new mutableFloatArrayListcontaining the same elements asother.
-
-
Method Details
-
emptyList
-
removeRange
protected void removeRange(int fromIndex, int toIndex) - Overrides:
removeRangein classAbstractList<Float>
-
equals
- Specified by:
equalsin interfaceCollection<Float>- Specified by:
equalsin interfaceList<Float>- Overrides:
equalsin classAbstractProtobufList<Float>
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<Float>- Specified by:
hashCodein interfaceList<Float>- Overrides:
hashCodein classAbstractProtobufList<Float>
-
mutableCopyWithCapacity
Description copied from interface:Internal.FloatListReturns a mutable clone of this list with the specified capacity.- Specified by:
mutableCopyWithCapacityin interfaceInternal.FloatList- Specified by:
mutableCopyWithCapacityin interfaceInternal.ProtobufList<Float>
-
get
-
getFloat
public float getFloat(int index) Description copied from interface:Internal.FloatListLikeList.get(int)but more efficient in that it doesn't box the returned value.- Specified by:
getFloatin interfaceInternal.FloatList
-
indexOf
-
contains
- Specified by:
containsin interfaceCollection<Float>- Specified by:
containsin interfaceList<Float>- Overrides:
containsin classAbstractCollection<Float>
-
size
public int size()- Specified by:
sizein interfaceCollection<Float>- Specified by:
sizein interfaceList<Float>- Specified by:
sizein classAbstractCollection<Float>
-
set
-
setFloat
public float setFloat(int index, float element) Description copied from interface:Internal.FloatListLikeList.set(int, Object)but more efficient in that it doesn't box the element.- Specified by:
setFloatin interfaceInternal.FloatList
-
add
- Specified by:
addin interfaceCollection<Float>- Specified by:
addin interfaceList<Float>- Overrides:
addin classAbstractProtobufList<Float>
-
add
-
addFloat
public void addFloat(float element) Likeadd(Float)but more efficient in that it doesn't box the element.- Specified by:
addFloatin 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:
addAllin interfaceCollection<Float>- Specified by:
addAllin interfaceList<Float>- Overrides:
addAllin classAbstractProtobufList<Float>
-
remove
-
ensureIndexInRange
private void ensureIndexInRange(int index) Ensures that the providedindexis within the range of[0, size]. Throws anIndexOutOfBoundsExceptionif it is not.- Parameters:
index- the index to verify is in range
-
makeOutOfBoundsExceptionMessage
-