Package com.google.protobuf
Class BooleanArrayList
- All Implemented Interfaces:
Internal.BooleanList
,Internal.ProtobufList<Boolean>
,PrimitiveNonBoxingCollection
,Iterable<Boolean>
,Collection<Boolean>
,List<Boolean>
,RandomAccess
,SequencedCollection<Boolean>
final class BooleanArrayList
extends AbstractProtobufList<Boolean>
implements Internal.BooleanList, RandomAccess, PrimitiveNonBoxingCollection
An implementation of
Internal.BooleanList
on top of a primitive array.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean[]
The backing store for the list.private static final BooleanArrayList
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 mutableBooleanArrayList
with default capacity.private
BooleanArrayList
(boolean[] other, int size) Constructs a new mutableBooleanArrayList
containing the same elements asother
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
boolean
addAll
(Collection<? extends Boolean> collection) void
addBoolean
(boolean element) Likeadd(Boolean)
but more efficient in that it doesn't box the element.private void
addBoolean
(int index, boolean element) Likeadd(int, Boolean)
but more efficient in that it doesn't box the element.boolean
static BooleanArrayList
private void
ensureIndexInRange
(int index) Ensures that the providedindex
is within the range of[0, size]
.boolean
get
(int index) boolean
getBoolean
(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) boolean
setBoolean
(int index, boolean 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 boolean[] 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
-
BooleanArrayList
BooleanArrayList()Constructs a new mutableBooleanArrayList
with default capacity. -
BooleanArrayList
private BooleanArrayList(boolean[] other, int size) Constructs a new mutableBooleanArrayList
containing the same elements asother
.
-
-
Method Details
-
emptyList
-
removeRange
protected void removeRange(int fromIndex, int toIndex) - Overrides:
removeRange
in classAbstractList<Boolean>
-
equals
- Specified by:
equals
in interfaceCollection<Boolean>
- Specified by:
equals
in interfaceList<Boolean>
- Overrides:
equals
in classAbstractProtobufList<Boolean>
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceCollection<Boolean>
- Specified by:
hashCode
in interfaceList<Boolean>
- Overrides:
hashCode
in classAbstractProtobufList<Boolean>
-
mutableCopyWithCapacity
Description copied from interface:Internal.BooleanList
Returns a mutable clone of this list with the specified capacity.- Specified by:
mutableCopyWithCapacity
in interfaceInternal.BooleanList
- Specified by:
mutableCopyWithCapacity
in interfaceInternal.ProtobufList<Boolean>
-
get
-
getBoolean
public boolean getBoolean(int index) Description copied from interface:Internal.BooleanList
LikeList.get(int)
but more efficient in that it doesn't box the returned value.- Specified by:
getBoolean
in interfaceInternal.BooleanList
-
indexOf
-
contains
- Specified by:
contains
in interfaceCollection<Boolean>
- Specified by:
contains
in interfaceList<Boolean>
- Overrides:
contains
in classAbstractCollection<Boolean>
-
size
public int size()- Specified by:
size
in interfaceCollection<Boolean>
- Specified by:
size
in interfaceList<Boolean>
- Specified by:
size
in classAbstractCollection<Boolean>
-
set
-
setBoolean
public boolean setBoolean(int index, boolean element) Description copied from interface:Internal.BooleanList
LikeList.set(int, Object)
but more efficient in that it doesn't box the element.- Specified by:
setBoolean
in interfaceInternal.BooleanList
-
add
- Specified by:
add
in interfaceCollection<Boolean>
- Specified by:
add
in interfaceList<Boolean>
- Overrides:
add
in classAbstractProtobufList<Boolean>
-
add
-
addBoolean
public void addBoolean(boolean element) Likeadd(Boolean)
but more efficient in that it doesn't box the element.- Specified by:
addBoolean
in interfaceInternal.BooleanList
-
addBoolean
private void addBoolean(int index, boolean element) Likeadd(int, Boolean)
but more efficient in that it doesn't box the element. -
addAll
- Specified by:
addAll
in interfaceCollection<Boolean>
- Specified by:
addAll
in interfaceList<Boolean>
- Overrides:
addAll
in classAbstractProtobufList<Boolean>
-
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
-