webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Classes | Public Member Functions | Static Public Attributes | List of all members
com.google.protobuf.LazyStringArrayList Class Reference
Inheritance diagram for com.google.protobuf.LazyStringArrayList:
com.google.protobuf.LazyStringList com.google.protobuf.ProtocolStringList

Public Member Functions

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

Static Public Attributes

static final LazyStringList EMPTY = EMPTY_LIST
 

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)

Constructor & Destructor Documentation

◆ LazyStringArrayList() [1/4]

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

◆ LazyStringArrayList() [2/4]

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

◆ LazyStringArrayList() [3/4]

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

◆ LazyStringArrayList() [4/4]

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

Member Function Documentation

◆ add() [1/3]

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

◆ add() [2/3]

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.

◆ add() [3/3]

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.

◆ addAll() [1/2]

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

◆ addAll() [2/2]

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

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ clear()

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

◆ get()

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

◆ 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.

◆ 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.

◆ 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.

◆ getUnderlyingElements()

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

Returns an unmodifiable List of the underlying elements, each of which is either a

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.

Implements com.google.protobuf.LazyStringList.

◆ getUnmodifiableView()

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

Returns an unmodifiable view of the list.

Implements com.google.protobuf.LazyStringList.

◆ mergeFrom()

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

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.

Implements com.google.protobuf.LazyStringList.

◆ mutableCopyWithCapacity()

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

◆ remove()

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

◆ set() [1/3]

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

◆ 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.

◆ set() [3/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.

◆ size()

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

Member Data Documentation

◆ EMPTY

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

The documentation for this class was generated from the following file: