Send feedback
  
   
 
  
    
      Class UnmodifiableLazyStringList (3.19.4) 
  
  
  
   
  
    
  
  
    
    
    
    
    
    
    
    
    
      
  
  
  
    
public   class  UnmodifiableLazyStringList   extends   AbstractList<String>   implements   LazyStringList ,   RandomAccess  
  
  
    Inheritance 
    Object  >  
    java.util.AbstractCollection  >  
    AbstractList  >  
    UnmodifiableLazyStringList 
   
  
  
  Constructors
   
  UnmodifiableLazyStringList(LazyStringList list) 
  
    
public   UnmodifiableLazyStringList ( LazyStringList   list )  
  
  Methods
   
  add(byte[] element) 
  
    
public   void   add ( byte []   element )  
  Appends the specified element to the end of this list (optional operation).
    
      
        Parameter  
      
        Name Description  
      
        elementbyte [] 
     
  
  add(ByteString element) 
  
    
public   void   add ( ByteString   element )  
  Appends the specified element to the end of this list (optional operation).
addAllByteArray(Collection<byte[]> element) 
  
    
public   boolean   addAllByteArray ( Collection<byte [] >  element )  
  Appends all elements in the specified byte[] collection to the end of this list.
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  
      
        elementCollection <? extends com.google.protobuf.ByteString > 
     
  
  
  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.
asByteStringList() 
  
    
public   List<ByteString>   asByteStringList ()  
  Returns a view of the data as a list of ByteStrings.
get(int index) 
  
    
public   String   get ( int   index )  
  
    
      
        Parameter  
      
        Name Description  
      
        indexint  
     
  
  
    
      
        Returns  
      
        Type Description  
      
        String  
     
  
  Overrides 
  
  getByteArray(int index) 
  
    
public   byte []   getByteArray ( int   index )  
  Returns the element at the specified position in this list as byte[].
    
      
        Parameter  
      
        Name Description  
      
        indexint  
     
  
  
    
      
        Returns  
      
        Type Description  
      
        byte [] 
     
  
  getByteString(int index) 
  
    
public   ByteString   getByteString ( int   index )  
  Returns the element at the specified position in this list as a ByteString.
    
      
        Parameter  
      
        Name Description  
      
        indexint  
     
  
  
  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  
      
        indexint  
     
  
  
    
      
        Returns  
      
        Type Description  
      
        Object  
     
  
  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  
      
        List <? > 
     
  
  getUnmodifiableView() 
  
    
public   LazyStringList   getUnmodifiableView ()  
  Returns an unmodifiable view of the list.
iterator() 
  
    
public   Iterator<String>   iterator ()  
  
  Overrides 
  
  listIterator(int index) 
  
    
public   ListIterator<String>   listIterator ( int   index )  
  
    
      
        Parameter  
      
        Name Description  
      
        indexint  
     
  
  
  Overrides 
  
  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.
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  
      
        indexint  
      
        elementbyte [] 
     
  
  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).
size() 
  
  
    
      
        Returns  
      
        Type Description  
      
        int  
     
  
  Overrides 
  
 
     
    
  
  
  
     
  
    
    
      
       
         
  
  
    
    Send feedback
  
   
 
       
    
    
  
  
 
  Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
  Last updated 2025-10-10 UTC.
 
 
  
  
    
    
    
      
  
  
    Need to tell us more?
  
   
 
     
  
  
    
      [[["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-10-10 UTC."],[],[]]