Package com.google.protobuf
Class ProtobufArrayList<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- com.google.protobuf.AbstractProtobufList<E>
-
- com.google.protobuf.ProtobufArrayList<E>
-
- All Implemented Interfaces:
Internal.ProtobufList<E>,java.lang.Iterable<E>,java.util.Collection<E>,java.util.List<E>,java.util.RandomAccess
final class ProtobufArrayList<E> extends AbstractProtobufList<E> implements java.util.RandomAccess
ImplementsInternal.ProtobufListfor non-primitive andStringtypes.
-
-
Field Summary
Fields Modifier and Type Field Description private E[]arrayprivate static ProtobufArrayList<java.lang.Object>EMPTY_LISTprivate intsize-
Fields inherited from class com.google.protobuf.AbstractProtobufList
DEFAULT_CAPACITY
-
-
Constructor Summary
Constructors Modifier Constructor Description (package private)ProtobufArrayList()privateProtobufArrayList(E[] array, int size, boolean isMutable)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, E element)booleanadd(E element)private static <E> E[]createArray(int capacity)static <E> ProtobufArrayList<E>emptyList()private voidensureIndexInRange(int index)Eget(int index)private java.lang.StringmakeOutOfBoundsExceptionMessage(int index)ProtobufArrayList<E>mutableCopyWithCapacity(int capacity)Returns a mutable clone of this list with the specified capacity.Eremove(int index)Eset(int index, E element)intsize()-
Methods inherited from class com.google.protobuf.AbstractProtobufList
addAll, addAll, clear, ensureIsMutable, equals, hashCode, isModifiable, makeImmutable, remove, removeAll, retainAll
-
Methods inherited from class java.util.AbstractList
indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, toArray, toArray, toString
-
-
-
-
Field Detail
-
EMPTY_LIST
private static final ProtobufArrayList<java.lang.Object> EMPTY_LIST
-
array
private E[] array
-
size
private int size
-
-
Constructor Detail
-
ProtobufArrayList
ProtobufArrayList()
-
ProtobufArrayList
private ProtobufArrayList(E[] array, int size, boolean isMutable)
-
-
Method Detail
-
emptyList
public static <E> ProtobufArrayList<E> emptyList()
-
mutableCopyWithCapacity
public ProtobufArrayList<E> mutableCopyWithCapacity(int capacity)
Description copied from interface:Internal.ProtobufListReturns a mutable clone of this list with the specified capacity.- Specified by:
mutableCopyWithCapacityin interfaceInternal.ProtobufList<E>
-
add
public boolean add(E element)
- Specified by:
addin interfacejava.util.Collection<E>- Specified by:
addin interfacejava.util.List<E>- Overrides:
addin classAbstractProtobufList<E>
-
add
public void add(int index, E element)- Specified by:
addin interfacejava.util.List<E>- Overrides:
addin classAbstractProtobufList<E>
-
get
public E get(int index)
-
remove
public E remove(int index)
- Specified by:
removein interfacejava.util.List<E>- Overrides:
removein classAbstractProtobufList<E>
-
set
public E set(int index, E element)
- Specified by:
setin interfacejava.util.List<E>- Overrides:
setin classAbstractProtobufList<E>
-
size
public int size()
-
createArray
private static <E> E[] createArray(int capacity)
-
ensureIndexInRange
private void ensureIndexInRange(int index)
-
makeOutOfBoundsExceptionMessage
private java.lang.String makeOutOfBoundsExceptionMessage(int index)
-
-