Class UnmodifiableLazyStringList (3.19.4)

public class UnmodifiableLazyStringList extends AbstractList<String> implements LazyStringList, RandomAccess

An implementation of LazyStringList that wraps another LazyStringList such that it cannot be modified via the wrapper.

Inheritance

Object > java.util.AbstractCollection > AbstractList > UnmodifiableLazyStringList

Constructors

UnmodifiableLazyStringList(LazyStringList list)

public UnmodifiableLazyStringList(LazyStringList list)
Parameter
Name Description
list LazyStringList

Methods

add(byte[] element)

public void add(byte[] element)

Appends the specified element to the end of this list (optional operation).

Parameter
Name Description
element byte[]

add(ByteString element)

public void add(ByteString element)

Appends the specified element to the end of this list (optional operation).

Parameter
Name Description
element ByteString

addAllByteArray(Collection<byte[]> element)

public boolean addAllByteArray(Collection<byte[]> element)

Appends all elements in the specified byte[] collection to the end of this list.

Parameter
Name Description
element Collection<byte[]>
Returns
Type Description
boolean

addAllByteString(Collection<? extends ByteString> element)

public boolean addAllByteString(Collection<? extends ByteString> element)

Appends all elements in the specified ByteString collection to the end of this list.

Parameter
Name Description
element Collection<? extends com.google.protobuf.ByteString>
Returns
Type Description
boolean

asByteArrayList()

public List<byte[]> asByteArrayList()

Returns a mutable view of this list. Changes to the view will be made into the original list. This method is used in mutable API only.

Returns
Type Description
List<byte[]>

asByteStringList()

public List<ByteString> asByteStringList()

Returns a view of the data as a list of ByteStrings.

Returns
Type Description
List<ByteString>

get(int index)

public String get(int index)
Parameter
Name Description
index int
Returns
Type Description
String
Overrides

getByteArray(int index)

public byte[] getByteArray(int index)

Returns the element at the specified position in this list as byte[].

Parameter
Name Description
index int
Returns
Type Description
byte[]

getByteString(int index)

public ByteString getByteString(int index)

Returns the element at the specified position in this list as a ByteString.

Parameter
Name Description
index int
Returns
Type Description
ByteString

getRaw(int index)

public Object getRaw(int index)

Returns the element at the specified position in this list as an Object that will either be a String or a ByteString.

Parameter
Name Description
index int
Returns
Type Description
Object

getUnderlyingElements()

public List<?> getUnderlyingElements()

Returns an unmodifiable List of the underlying elements, each of which is either a String or its equivalent UTF-8 encoded ByteString or byte[]. It is an error for the caller to modify the returned List, and attempting to do so will result in an UnsupportedOperationException.

Returns
Type Description
List<?>

getUnmodifiableView()

public LazyStringList getUnmodifiableView()

Returns an unmodifiable view of the list.

Returns
Type Description
LazyStringList

iterator()

public Iterator<String> iterator()
Returns
Type Description
Iterator<String>
Overrides

listIterator(int index)

public ListIterator<String> listIterator(int index)
Parameter
Name Description
index int
Returns
Type Description
ListIterator<String>
Overrides

mergeFrom(LazyStringList other)

public void mergeFrom(LazyStringList other)

Merges all elements from another LazyStringList into this one. This method differs from #addAll(Collection) on that underlying byte arrays are copied instead of reference shared. Immutable API doesn't need to use this method as byte[] is not used there at all.

Parameter
Name Description
other LazyStringList

set(int index, byte[] element)

public void set(int index, byte[] element)

Replaces the element at the specified position in this list with the specified element (optional operation).

Parameters
Name Description
index int
element byte[]

set(int index, ByteString element)

public void set(int index, ByteString element)

Replaces the element at the specified position in this list with the specified element (optional operation).

Parameters
Name Description
index int
element ByteString

size()

public int size()
Returns
Type Description
int
Overrides