# Class UnmodifiableLazyStringList (3.19.4)

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

An implementation of [LazyStringList](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.LazyStringList) that wraps another [LazyStringList](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.LazyStringList) such that
it cannot be modified via the wrapper.

## Inheritance

[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> java.util.AbstractCollection \> [AbstractList](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html) \> UnmodifiableLazyStringList

## Implements

[LazyStringList](https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.LazyStringList), [RandomAccess](https://docs.oracle.com/javase/8/docs/api/java/util/RandomAccess.html)

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-) [AbstractCollection.\<T\>toArray(T\[\])](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractCollection.html#toArray-T[]-) [AbstractCollection.addAll(Collection\<? extends E\>)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractCollection.html#addAll-java.util.Collection<? extends E>-) [AbstractCollection.contains(Object)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractCollection.html#contains-java.lang.Object-) [AbstractCollection.containsAll(Collection\<?\>)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractCollection.html#containsAll-java.util.Collection<?>-) [AbstractCollection.isEmpty()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractCollection.html#isEmpty--) [AbstractCollection.remove(Object)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractCollection.html#remove-java.lang.Object-) [AbstractCollection.removeAll(Collection\<?\>)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractCollection.html#removeAll-java.util.Collection<?>-) [AbstractCollection.retainAll(Collection\<?\>)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractCollection.html#retainAll-java.util.Collection<?>-) [AbstractCollection.size()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractCollection.html#size--) [AbstractCollection.toArray()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractCollection.html#toArray--) [AbstractCollection.toString()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractCollection.html#toString--) [AbstractList.add(E)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#add-E-) [AbstractList.add(int,E)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#add-int-E-) [AbstractList.addAll(int,Collection\<? extends E\>)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#addAll-int-java.util.Collection<? extends E>-) [AbstractList.clear()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#clear--) [AbstractList.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#equals-java.lang.Object-) [AbstractList.get(int)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#get-int-) [AbstractList.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#hashCode--) [AbstractList.indexOf(Object)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#indexOf-java.lang.Object-) [AbstractList.iterator()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#iterator--) [AbstractList.lastIndexOf(Object)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#lastIndexOf-java.lang.Object-) [AbstractList.listIterator()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#listIterator--) [AbstractList.listIterator(int)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#listIterator-int-) [AbstractList.remove(int)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#remove-int-) [AbstractList.removeRange(int,int)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#removeRange-int-int-) [AbstractList.set(int,E)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#set-int-E-) [AbstractList.subList(int,int)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#subList-int-int-)

## Constructors

### UnmodifiableLazyStringList(LazyStringList list)

    public UnmodifiableLazyStringList(LazyStringList list)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `list` | `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.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` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html[]` |

### add(ByteString element)

    public void add(ByteString element)

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `element` | `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.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` | `https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html<https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html[]>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### 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` | `https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html<? extends com.google.protobuf.ByteString>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### 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** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html[]>` |   |

### asByteStringList()

    public List<ByteString> asByteStringList()

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

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString>` |   |

### get(int index)

    public String get(int index)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

**Overrides** [AbstractList.get(int)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#get-int-)

### getByteArray(int index)

    public byte[] getByteArray(int index)

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html[]` |   |

### 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` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.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` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` |   |

### 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** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<?>` |   |

### getUnmodifiableView()

    public LazyStringList getUnmodifiableView()

Returns an unmodifiable view of the list.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.LazyStringList` |   |

### iterator()

    public Iterator<String> iterator()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` |   |

**Overrides** [AbstractList.iterator()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#iterator--)

### listIterator(int index)

    public ListIterator<String> listIterator(int index)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/ListIterator.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` |   |

**Overrides** [AbstractList.listIterator(int)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractList.html#listIterator-int-)

### 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` | `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.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` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |
| `element` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html[]` |

### 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` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |
| `element` | `https://docs.cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString` |

### size()

    public int size()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

**Overrides** [AbstractCollection.size()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractCollection.html#size--)