Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
com.google.protobuf.LazyStringArrayList Class Reference
Inheritance diagram for com.google.protobuf.LazyStringArrayList:
Inheritance graph
[legend]

Classes

class  ByteArrayListView
 
class  ByteStringListView
 

Public Member Functions

void add (byte[] element)
 
void add (byte[] element)
 
void add (ByteString element)
 
void add (ByteString element)
 
void add (int index, String element)
 
void add (int index, String element)
 
boolean addAll (Collection<? extends String > c)
 
boolean addAll (Collection<? extends String > c)
 
boolean addAll (int index, Collection<? extends String > c)
 
boolean addAll (int index, Collection<? extends String > c)
 
boolean addAllByteArray (Collection< byte[]> c)
 
boolean addAllByteArray (Collection< byte[]> c)
 
boolean addAllByteString (Collection<? extends ByteString > values)
 
boolean addAllByteString (Collection<? extends ByteString > values)
 
List< byte[]> asByteArrayList ()
 
List< byte[]> asByteArrayList ()
 
List< ByteStringasByteStringList ()
 
List< ByteStringasByteStringList ()
 
void clear ()
 
void clear ()
 
String get (int index)
 
String get (int index)
 
byte[] getByteArray (int index)
 
byte[] getByteArray (int index)
 
ByteString getByteString (int index)
 
ByteString getByteString (int index)
 
Object getRaw (int index)
 
Object getRaw (int index)
 
List<?> getUnderlyingElements ()
 
List<?> getUnderlyingElements ()
 
LazyStringList getUnmodifiableView ()
 
LazyStringList getUnmodifiableView ()
 
 LazyStringArrayList ()
 
 LazyStringArrayList ()
 
 LazyStringArrayList (int initialCapacity)
 
 LazyStringArrayList (int initialCapacity)
 
 LazyStringArrayList (LazyStringList from)
 
 LazyStringArrayList (LazyStringList from)
 
 LazyStringArrayList (List< String > from)
 
 LazyStringArrayList (List< String > from)
 
void mergeFrom (LazyStringList other)
 
void mergeFrom (LazyStringList other)
 
LazyStringArrayList mutableCopyWithCapacity (int capacity)
 
LazyStringArrayList mutableCopyWithCapacity (int capacity)
 
String remove (int index)
 
String remove (int index)
 
void set (int index, byte[] s)
 
void set (int index, byte[] s)
 
void set (int index, ByteString s)
 
void set (int index, ByteString s)
 
String set (int index, String s)
 
String set (int index, String s)
 
int size ()
 
int size ()
 

Static Public Attributes

static final LazyStringList EMPTY = EMPTY_LIST
 

Private Member Functions

void add (int index, byte[] element)
 
void add (int index, byte[] element)
 
void add (int index, ByteString element)
 
void add (int index, ByteString element)
 
 LazyStringArrayList (ArrayList< Object > list)
 
 LazyStringArrayList (ArrayList< Object > list)
 
Object setAndReturn (int index, byte[] s)
 
Object setAndReturn (int index, byte[] s)
 
Object setAndReturn (int index, ByteString s)
 
Object setAndReturn (int index, ByteString s)
 

Static Private Member Functions

static byte[] asByteArray (Object o)
 
static byte[] asByteArray (Object o)
 
static ByteString asByteString (Object o)
 
static ByteString asByteString (Object o)
 
static String asString (Object o)
 
static String asString (Object o)
 

Private Attributes

final List< Object > list
 

Static Private Attributes

static final LazyStringArrayList EMPTY_LIST = new LazyStringArrayList()
 

Detailed Description

An implementation of LazyStringList that wraps an ArrayList. Each element is one of String, ByteString, or byte[]. It caches the last one requested which is most likely the one needed next. This minimizes memory usage while satisfying the most common use cases.

Note that this implementation is not synchronized. If multiple threads access an ArrayList instance concurrently, and at least one of the threads modifies the list structurally, it must be synchronized externally. (A structural modification is any operation that adds or deletes one or more elements, or explicitly resizes the backing array; merely setting the value of an element is not a structural modification.) This is typically accomplished by synchronizing on some object that naturally encapsulates the list.

If the implementation is accessed via concurrent reads, this is thread safe. Conversions are done in a thread safe manner. It's possible that the conversion may happen more than once if two threads attempt to access the same element and the modifications were not visible to each other, but this will not result in any corruption of the list or change in behavior other than performance.

Author
jonp@.nosp@m.goog.nosp@m.le.co.nosp@m.m (Jon Perlow)

Definition at line 61 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

Constructor & Destructor Documentation

◆ LazyStringArrayList() [1/10]

com.google.protobuf.LazyStringArrayList.LazyStringArrayList ( )
inline

◆ LazyStringArrayList() [2/10]

com.google.protobuf.LazyStringArrayList.LazyStringArrayList ( int  initialCapacity)
inline

◆ LazyStringArrayList() [3/10]

com.google.protobuf.LazyStringArrayList.LazyStringArrayList ( LazyStringList  from)
inline

◆ LazyStringArrayList() [4/10]

com.google.protobuf.LazyStringArrayList.LazyStringArrayList ( List< String >  from)
inline

◆ LazyStringArrayList() [5/10]

com.google.protobuf.LazyStringArrayList.LazyStringArrayList ( ArrayList< Object >  list)
inlineprivate

◆ LazyStringArrayList() [6/10]

com.google.protobuf.LazyStringArrayList.LazyStringArrayList ( )
inline

◆ LazyStringArrayList() [7/10]

com.google.protobuf.LazyStringArrayList.LazyStringArrayList ( int  initialCapacity)
inline

◆ LazyStringArrayList() [8/10]

com.google.protobuf.LazyStringArrayList.LazyStringArrayList ( LazyStringList  from)
inline

◆ LazyStringArrayList() [9/10]

com.google.protobuf.LazyStringArrayList.LazyStringArrayList ( List< String >  from)
inline

◆ LazyStringArrayList() [10/10]

com.google.protobuf.LazyStringArrayList.LazyStringArrayList ( ArrayList< Object >  list)
inlineprivate

Member Function Documentation

◆ add() [1/10]

void com.google.protobuf.LazyStringArrayList.add ( byte[]  element)
inline

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

Parameters
elementelement to be appended to this list
Exceptions
UnsupportedOperationExceptionif the add operation is not supported by this list

Implements com.google.protobuf.LazyStringList.

Definition at line 223 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ add() [2/10]

void com.google.protobuf.LazyStringArrayList.add ( byte[]  element)
inline

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

Parameters
elementelement to be appended to this list
Exceptions
UnsupportedOperationExceptionif the add operation is not supported by this list

Implements com.google.protobuf.LazyStringList.

Definition at line 223 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ add() [3/10]

void com.google.protobuf.LazyStringArrayList.add ( ByteString  element)
inline

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

Parameters
elementelement to be appended to this list
Exceptions
UnsupportedOperationExceptionif the add operation is not supported by this list

Implements com.google.protobuf.LazyStringList.

Definition at line 216 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ add() [4/10]

void com.google.protobuf.LazyStringArrayList.add ( ByteString  element)
inline

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

Parameters
elementelement to be appended to this list
Exceptions
UnsupportedOperationExceptionif the add operation is not supported by this list

Implements com.google.protobuf.LazyStringList.

Definition at line 216 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ add() [5/10]

void com.google.protobuf.LazyStringArrayList.add ( int  index,
byte[]  element 
)
inlineprivate

◆ add() [6/10]

void com.google.protobuf.LazyStringArrayList.add ( int  index,
byte[]  element 
)
inlineprivate

◆ add() [7/10]

void com.google.protobuf.LazyStringArrayList.add ( int  index,
ByteString  element 
)
inlineprivate

◆ add() [8/10]

void com.google.protobuf.LazyStringArrayList.add ( int  index,
ByteString  element 
)
inlineprivate

◆ add() [9/10]

void com.google.protobuf.LazyStringArrayList.add ( int  index,
String  element 
)
inline

◆ add() [10/10]

void com.google.protobuf.LazyStringArrayList.add ( int  index,
String  element 
)
inline

◆ addAll() [1/4]

boolean com.google.protobuf.LazyStringArrayList.addAll ( Collection<? extends String >  c)
inline

◆ addAll() [2/4]

boolean com.google.protobuf.LazyStringArrayList.addAll ( Collection<? extends String >  c)
inline

◆ addAll() [3/4]

boolean com.google.protobuf.LazyStringArrayList.addAll ( int  index,
Collection<? extends String >  c 
)
inline

◆ addAll() [4/4]

boolean com.google.protobuf.LazyStringArrayList.addAll ( int  index,
Collection<? extends String >  c 
)
inline

◆ addAllByteArray() [1/2]

boolean com.google.protobuf.LazyStringArrayList.addAllByteArray ( Collection< byte[]>  c)
inline

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

Parameters
ccollection whose elements are to be added to this list
Returns
true if this list changed as a result of the call
Exceptions
UnsupportedOperationExceptionif the addAllByteArray operation is not supported by this list

Implements com.google.protobuf.LazyStringList.

Definition at line 193 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ addAllByteArray() [2/2]

boolean com.google.protobuf.LazyStringArrayList.addAllByteArray ( Collection< byte[]>  c)
inline

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

Parameters
ccollection whose elements are to be added to this list
Returns
true if this list changed as a result of the call
Exceptions
UnsupportedOperationExceptionif the addAllByteArray operation is not supported by this list

Implements com.google.protobuf.LazyStringList.

Definition at line 193 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ addAllByteString() [1/2]

boolean com.google.protobuf.LazyStringArrayList.addAllByteString ( Collection<? extends ByteString c)
inline

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

Parameters
ccollection whose elements are to be added to this list
Returns
true if this list changed as a result of the call
Exceptions
UnsupportedOperationExceptionif the addAllByteString operation is not supported by this list

Implements com.google.protobuf.LazyStringList.

Definition at line 185 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ addAllByteString() [2/2]

boolean com.google.protobuf.LazyStringArrayList.addAllByteString ( Collection<? extends ByteString c)
inline

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

Parameters
ccollection whose elements are to be added to this list
Returns
true if this list changed as a result of the call
Exceptions
UnsupportedOperationExceptionif the addAllByteString operation is not supported by this list

Implements com.google.protobuf.LazyStringList.

Definition at line 185 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ asByteArray() [1/2]

static byte [] com.google.protobuf.LazyStringArrayList.asByteArray ( Object  o)
inlinestaticprivate

◆ asByteArray() [2/2]

static byte [] com.google.protobuf.LazyStringArrayList.asByteArray ( Object  o)
inlinestaticprivate

◆ asByteArrayList() [1/2]

List<byte[]> com.google.protobuf.LazyStringArrayList.asByteArrayList ( )
inline

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.

Implements com.google.protobuf.LazyStringList.

Definition at line 363 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ asByteArrayList() [2/2]

List<byte[]> com.google.protobuf.LazyStringArrayList.asByteArrayList ( )
inline

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.

Implements com.google.protobuf.LazyStringList.

Definition at line 363 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ asByteString() [1/2]

static ByteString com.google.protobuf.LazyStringArrayList.asByteString ( Object  o)
inlinestaticprivate

◆ asByteString() [2/2]

static ByteString com.google.protobuf.LazyStringArrayList.asByteString ( Object  o)
inlinestaticprivate

◆ asByteStringList() [1/2]

List<ByteString> com.google.protobuf.LazyStringArrayList.asByteStringList ( )
inline

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

Implements com.google.protobuf.ProtocolStringList.

Definition at line 406 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ asByteStringList() [2/2]

List<ByteString> com.google.protobuf.LazyStringArrayList.asByteStringList ( )
inline

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

Implements com.google.protobuf.ProtocolStringList.

Definition at line 406 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ asString() [1/2]

static String com.google.protobuf.LazyStringArrayList.asString ( Object  o)
inlinestaticprivate

◆ asString() [2/2]

static String com.google.protobuf.LazyStringArrayList.asString ( Object  o)
inlinestaticprivate

◆ clear() [1/2]

void com.google.protobuf.LazyStringArrayList.clear ( )
inline

◆ clear() [2/2]

void com.google.protobuf.LazyStringArrayList.clear ( )
inline

◆ get() [1/2]

String com.google.protobuf.LazyStringArrayList.get ( int  index)
inline

◆ get() [2/2]

String com.google.protobuf.LazyStringArrayList.get ( int  index)
inline

◆ getByteArray() [1/2]

byte [] com.google.protobuf.LazyStringArrayList.getByteArray ( int  index)
inline

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

Parameters
indexindex of the element to return
Returns
the element at the specified position in this list
Exceptions
IndexOutOfBoundsExceptionif the index is out of range (
index < 0 || index >=
size()
)

Implements com.google.protobuf.LazyStringList.

Definition at line 245 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ getByteArray() [2/2]

byte [] com.google.protobuf.LazyStringArrayList.getByteArray ( int  index)
inline

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

Parameters
indexindex of the element to return
Returns
the element at the specified position in this list
Exceptions
IndexOutOfBoundsExceptionif the index is out of range (
index < 0 || index >=
size()
)

Implements com.google.protobuf.LazyStringList.

Definition at line 245 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ getByteString() [1/2]

ByteString com.google.protobuf.LazyStringArrayList.getByteString ( int  index)
inline

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

Parameters
indexindex of the element to return
Returns
the element at the specified position in this list
Exceptions
IndexOutOfBoundsExceptionif the index is out of range (
index < 0 || index >=
size()
)

Implements com.google.protobuf.LazyStringList.

Definition at line 235 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ getByteString() [2/2]

ByteString com.google.protobuf.LazyStringArrayList.getByteString ( int  index)
inline

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

Parameters
indexindex of the element to return
Returns
the element at the specified position in this list
Exceptions
IndexOutOfBoundsExceptionif the index is out of range (
index < 0 || index >=
size()
)

Implements com.google.protobuf.LazyStringList.

Definition at line 235 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ getRaw() [1/2]

Object com.google.protobuf.LazyStringArrayList.getRaw ( int  index)
inline

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

Parameters
indexindex of the element to return
Returns
the element at the specified position in this list
Exceptions
IndexOutOfBoundsExceptionif the index is out of range (
index < 0 || index >=
size()
)

Implements com.google.protobuf.LazyStringList.

Definition at line 230 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ getRaw() [2/2]

Object com.google.protobuf.LazyStringArrayList.getRaw ( int  index)
inline

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

Parameters
indexindex of the element to return
Returns
the element at the specified position in this list
Exceptions
IndexOutOfBoundsExceptionif the index is out of range (
index < 0 || index >=
size()
)

Implements com.google.protobuf.LazyStringList.

Definition at line 230 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ getUnderlyingElements() [1/2]

List<?> com.google.protobuf.LazyStringArrayList.getUnderlyingElements ( )
inline

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 {}.

Implements com.google.protobuf.LazyStringList.

Definition at line 305 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ getUnderlyingElements() [2/2]

List<?> com.google.protobuf.LazyStringArrayList.getUnderlyingElements ( )
inline

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 {}.

Implements com.google.protobuf.LazyStringList.

Definition at line 305 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ getUnmodifiableView() [1/2]

LazyStringList com.google.protobuf.LazyStringArrayList.getUnmodifiableView ( )
inline

Returns an unmodifiable view of the list.

Implements com.google.protobuf.LazyStringList.

Definition at line 411 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ getUnmodifiableView() [2/2]

LazyStringList com.google.protobuf.LazyStringArrayList.getUnmodifiableView ( )
inline

◆ mergeFrom() [1/2]

void com.google.protobuf.LazyStringArrayList.mergeFrom ( LazyStringList  other)
inline

◆ mergeFrom() [2/2]

void com.google.protobuf.LazyStringArrayList.mergeFrom ( LazyStringList  other)
inline

◆ mutableCopyWithCapacity() [1/2]

LazyStringArrayList com.google.protobuf.LazyStringArrayList.mutableCopyWithCapacity ( int  capacity)
inline

◆ mutableCopyWithCapacity() [2/2]

LazyStringArrayList com.google.protobuf.LazyStringArrayList.mutableCopyWithCapacity ( int  capacity)
inline

◆ remove() [1/2]

String com.google.protobuf.LazyStringArrayList.remove ( int  index)
inline

◆ remove() [2/2]

String com.google.protobuf.LazyStringArrayList.remove ( int  index)
inline

◆ set() [1/6]

void com.google.protobuf.LazyStringArrayList.set ( int  index,
byte[]  element 
)
inline

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

Parameters
indexindex of the element to replace
elementthe element to be stored at the specified position
Exceptions
UnsupportedOperationExceptionif the set operation is not supported by this list IndexOutOfBoundsException if the index is out of range (
index < 0 || index >=
size()
)

Implements com.google.protobuf.LazyStringList.

Definition at line 265 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ set() [2/6]

void com.google.protobuf.LazyStringArrayList.set ( int  index,
byte[]  element 
)
inline

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

Parameters
indexindex of the element to replace
elementthe element to be stored at the specified position
Exceptions
UnsupportedOperationExceptionif the set operation is not supported by this list IndexOutOfBoundsException if the index is out of range (
index < 0 || index >=
size()
)

Implements com.google.protobuf.LazyStringList.

Definition at line 265 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ set() [3/6]

void com.google.protobuf.LazyStringArrayList.set ( int  index,
ByteString  element 
)
inline

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

Parameters
indexindex of the element to replace
elementthe element to be stored at the specified position
Exceptions
UnsupportedOperationExceptionif the set operation is not supported by this list IndexOutOfBoundsException if the index is out of range (
index < 0 || index >=
size()
)

Implements com.google.protobuf.LazyStringList.

Definition at line 255 of file bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ set() [4/6]

void com.google.protobuf.LazyStringArrayList.set ( int  index,
ByteString  element 
)
inline

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

Parameters
indexindex of the element to replace
elementthe element to be stored at the specified position
Exceptions
UnsupportedOperationExceptionif the set operation is not supported by this list IndexOutOfBoundsException if the index is out of range (
index < 0 || index >=
size()
)

Implements com.google.protobuf.LazyStringList.

Definition at line 255 of file protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java.

◆ set() [5/6]

String com.google.protobuf.LazyStringArrayList.set ( int  index,
String  s 
)
inline

◆ set() [6/6]

String com.google.protobuf.LazyStringArrayList.set ( int  index,
String  s 
)
inline

◆ setAndReturn() [1/4]

Object com.google.protobuf.LazyStringArrayList.setAndReturn ( int  index,
byte[]  s 
)
inlineprivate

◆ setAndReturn() [2/4]

Object com.google.protobuf.LazyStringArrayList.setAndReturn ( int  index,
byte[]  s 
)
inlineprivate

◆ setAndReturn() [3/4]

Object com.google.protobuf.LazyStringArrayList.setAndReturn ( int  index,
ByteString  s 
)
inlineprivate

◆ setAndReturn() [4/4]

Object com.google.protobuf.LazyStringArrayList.setAndReturn ( int  index,
ByteString  s 
)
inlineprivate

◆ size() [1/2]

int com.google.protobuf.LazyStringArrayList.size ( )
inline

◆ size() [2/2]

int com.google.protobuf.LazyStringArrayList.size ( )
inline

Member Data Documentation

◆ EMPTY

static final LazyStringList com.google.protobuf.LazyStringArrayList.EMPTY = EMPTY_LIST
static

◆ EMPTY_LIST

static final LazyStringArrayList com.google.protobuf.LazyStringArrayList.EMPTY_LIST = new LazyStringArrayList()
staticprivate

◆ list

final List< Object > com.google.protobuf.LazyStringArrayList.list
private

The documentation for this class was generated from the following file:
com.google.protobuf.LazyStringArrayList.size
int size()
Definition: bloaty/third_party/protobuf/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java:133


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:06