An interface extendingList<String>that also provides access to the items of the list as
UTF8-encoded ByteString or byte[] objects. This is used by the protocol buffer implementation to
support lazily converting bytes parsed over the wire to String objects until needed and also
increases the efficiency of serialization if the String was never requested as the ByteString or
byte[] is already cached. The ByteString methods are used in immutable API only and byte[]
methods used in mutable API only for they use different representations for string/bytes fields.
the element at the specified position in this list
getUnderlyingElements()
publicabstractList<?>getUnderlyingElements()
Returns an unmodifiable List of the underlying elements, each of which is either aStringor its equivalent UTF-8 encodedByteStringor byte[]. It is an error for the
caller to modify the returned List, and attempting to do so will result in anUnsupportedOperationException.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Interface LazyStringList (3.19.4)\n\n public interface LazyStringList extends ProtocolStringList\n\nAn interface extending `List\u003cString\u003e` that also provides access to the items of the list as\nUTF8-encoded ByteString or byte\\[\\] objects. This is used by the protocol buffer implementation to\nsupport lazily converting bytes parsed over the wire to String objects until needed and also\nincreases the efficiency of serialization if the String was never requested as the ByteString or\nbyte\\[\\] is already cached. The ByteString methods are used in immutable API only and byte\\[\\]\nmethods used in mutable API only for they use different representations for string/bytes fields. \n\nImplements\n----------\n\n[ProtocolStringList](/java/docs/reference/protobuf/latest/com.google.protobuf.ProtocolStringList)\n\nMethods\n-------\n\n### add(byte\\[\\] element)\n\n public abstract void add(byte[] element)\n\nAppends the specified element to the end of this list (optional operation).\n\n### add(ByteString element)\n\n public abstract void add(ByteString element)\n\nAppends the specified element to the end of this list (optional operation).\n\n### addAllByteArray(Collection\\\u003cbyte\\[\\]\\\u003e c)\n\n public abstract boolean addAllByteArray(Collection\u003cbyte[]\u003e c)\n\nAppends all elements in the specified byte\\[\\] collection to the end of this list.\n\n### addAllByteString(Collection\\\u003c? extends ByteString\\\u003e c)\n\n public abstract boolean addAllByteString(Collection\u003c? extends ByteString\u003e c)\n\nAppends all elements in the specified ByteString collection to the end of this list.\n\n### asByteArrayList()\n\n public abstract List\u003cbyte[]\u003e asByteArrayList()\n\nReturns a mutable view of this list. Changes to the view will be made into the original list.\nThis method is used in mutable API only.\n\n### getByteArray(int index)\n\n public abstract byte[] getByteArray(int index)\n\nReturns the element at the specified position in this list as byte\\[\\].\n\n### getByteString(int index)\n\n public abstract ByteString getByteString(int index)\n\nReturns the element at the specified position in this list as a ByteString.\n\n### getRaw(int index)\n\n public abstract Object getRaw(int index)\n\nReturns the element at the specified position in this list as an Object that will either be a\nString or a ByteString.\n\n### getUnderlyingElements()\n\n public abstract List\u003c?\u003e getUnderlyingElements()\n\nReturns an unmodifiable List of the underlying elements, each of which is either a `\nString` or its equivalent UTF-8 encoded `ByteString` or byte\\[\\]. It is an error for the\ncaller to modify the returned List, and attempting to do so will result in an UnsupportedOperationException.\n\n### getUnmodifiableView()\n\n public abstract LazyStringList getUnmodifiableView()\n\nReturns an unmodifiable view of the list.\n\n### mergeFrom(LazyStringList other)\n\n public abstract void mergeFrom(LazyStringList other)\n\nMerges 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.\nImmutable API doesn't need to use this method as byte\\[\\] is not used there at all.\n\n### set(int index, byte\\[\\] element)\n\n public abstract void set(int index, byte[] element)\n\nReplaces the element at the specified position in this list with the specified element\n(optional operation).\n\n### set(int index, ByteString element)\n\n public abstract void set(int index, ByteString element)\n\nReplaces the element at the specified position in this list with the specified element\n(optional operation)."]]