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

Static Public Attributes

static final LazyStringList EMPTY = EMPTY_LIST
 

Private Member Functions

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

Static Private Member Functions

static byte[] asByteArray (Object o)
 
static ByteString asByteString (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 LazyStringArrayList.java.

Constructor & Destructor Documentation

◆ LazyStringArrayList() [1/5]

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

Definition at line 79 of file LazyStringArrayList.java.

◆ LazyStringArrayList() [2/5]

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

Definition at line 83 of file LazyStringArrayList.java.

◆ LazyStringArrayList() [3/5]

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

Definition at line 87 of file LazyStringArrayList.java.

◆ LazyStringArrayList() [4/5]

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

Definition at line 92 of file LazyStringArrayList.java.

◆ LazyStringArrayList() [5/5]

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

Definition at line 96 of file LazyStringArrayList.java.

Member Function Documentation

◆ add() [1/5]

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 LazyStringArrayList.java.

◆ add() [2/5]

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 LazyStringArrayList.java.

◆ add() [3/5]

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

Definition at line 157 of file LazyStringArrayList.java.

◆ add() [4/5]

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

Definition at line 151 of file LazyStringArrayList.java.

◆ add() [5/5]

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

Definition at line 145 of file LazyStringArrayList.java.

◆ addAll() [1/2]

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

Definition at line 164 of file LazyStringArrayList.java.

◆ addAll() [2/2]

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

Definition at line 173 of file LazyStringArrayList.java.

◆ addAllByteArray()

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 LazyStringArrayList.java.

◆ addAllByteString()

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 LazyStringArrayList.java.

◆ asByteArray()

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

Definition at line 294 of file LazyStringArrayList.java.

◆ asByteArrayList()

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 LazyStringArrayList.java.

◆ asByteString()

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

Definition at line 284 of file LazyStringArrayList.java.

◆ asByteStringList()

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 LazyStringArrayList.java.

◆ asString()

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

Definition at line 274 of file LazyStringArrayList.java.

◆ clear()

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

Definition at line 209 of file LazyStringArrayList.java.

◆ get()

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

Definition at line 111 of file LazyStringArrayList.java.

◆ getByteArray()

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 ( )

Implements com.google.protobuf.LazyStringList.

Definition at line 245 of file LazyStringArrayList.java.

◆ getByteString()

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 ( )

Implements com.google.protobuf.LazyStringList.

Definition at line 235 of file LazyStringArrayList.java.

◆ getRaw()

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 ( )

Implements com.google.protobuf.LazyStringList.

Definition at line 230 of file LazyStringArrayList.java.

◆ getUnderlyingElements()

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 LazyStringArrayList.java.

◆ getUnmodifiableView()

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 LazyStringArrayList.java.

◆ mergeFrom()

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

◆ mutableCopyWithCapacity()

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

Returns a mutable clone of this list with the specified capacity.

Implements com.google.protobuf.Internal.ProtobufList< E >.

Definition at line 101 of file LazyStringArrayList.java.

◆ remove()

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

Definition at line 201 of file LazyStringArrayList.java.

◆ set() [1/3]

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 ( )

Implements com.google.protobuf.LazyStringList.

Definition at line 265 of file LazyStringArrayList.java.

◆ set() [2/3]

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 ( )

Implements com.google.protobuf.LazyStringList.

Definition at line 255 of file LazyStringArrayList.java.

◆ set() [3/3]

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

Definition at line 138 of file LazyStringArrayList.java.

◆ setAndReturn() [1/2]

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

Definition at line 269 of file LazyStringArrayList.java.

◆ setAndReturn() [2/2]

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

Definition at line 259 of file LazyStringArrayList.java.

◆ size()

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

Definition at line 133 of file LazyStringArrayList.java.

Member Data Documentation

◆ EMPTY

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

Definition at line 75 of file LazyStringArrayList.java.

◆ EMPTY_LIST

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

Definition at line 64 of file LazyStringArrayList.java.

◆ list

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

Definition at line 77 of file LazyStringArrayList.java.


The documentation for this class was generated from the following file:
com.google.protobuf.LazyStringArrayList.size
int size()
Definition: LazyStringArrayList.java:133
index
GLuint index
Definition: glcorearb.h:3055


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:07:07