@Override public List<?> getUnderlyingElements() { // The returned value is already unmodifiable. return list.getUnderlyingElements(); }
public List<?> getUnderlyingElements() { // The returned value is already unmodifiable. return list.getUnderlyingElements(); } }
@Override public boolean addAll(int index, Collection<? extends String> c) { // When copying from another LazyStringList, directly copy the underlying // elements rather than forcing each element to be decoded to a String. Collection<?> collection = c instanceof LazyStringList ? ((LazyStringList) c).getUnderlyingElements() : c; boolean ret = list.addAll(index, collection); modCount++; return ret; }
@Override public boolean addAll(int index, Collection<? extends String> c) { ensureIsMutable(); // When copying from another LazyStringList, directly copy the underlying // elements rather than forcing each element to be decoded to a String. Collection<?> collection = c instanceof LazyStringList ? ((LazyStringList) c).getUnderlyingElements() : c; boolean ret = list.addAll(index, collection); modCount++; return ret; }
@Override public void mergeFrom(LazyStringList other) { ensureIsMutable(); for (Object o : other.getUnderlyingElements()) { if (o instanceof byte[]) { byte[] b = (byte[]) o; // Byte array's content is mutable so they should be copied rather than // shared when merging from one message to another. list.add(Arrays.copyOf(b, b.length)); } else { list.add(o); } } }
/** * Adds the {@code values} to the {@code list}. This is a helper method * used by generated code. Users should ignore it. * * @throws NullPointerException if any of the elements of {@code values} is * null. */ protected static <T> void addAll(final Iterable<T> values, final Collection<? super T> list) { if (values instanceof LazyStringList) { // For StringOrByteStringLists, check the underlying elements to avoid // forcing conversions of ByteStrings to Strings. checkForNullValues(((LazyStringList) values).getUnderlyingElements()); } else { checkForNullValues(values); } if (values instanceof Collection) { final Collection<T> collection = (Collection<T>) values; list.addAll(collection); } else { for (final T value : values) { list.add(value); } } }
List<?> lazyValues = ((LazyStringList) values).getUnderlyingElements(); LazyStringList lazyList = (LazyStringList) list; int begin = list.size();
@Override public List<?> getUnderlyingElements() { // The returned value is already unmodifiable. return list.getUnderlyingElements(); }
@Override public List<?> getUnderlyingElements() { // The returned value is already unmodifiable. return list.getUnderlyingElements(); }
public List<?> getUnderlyingElements() { // The returned value is already unmodifiable. return list.getUnderlyingElements(); }
@Override public boolean addAll(int index, Collection<? extends String> c) { // When copying from another LazyStringList, directly copy the underlying // elements rather than forcing each element to be decoded to a String. Collection<?> collection = c instanceof LazyStringList ? ((LazyStringList) c).getUnderlyingElements() : c; boolean ret = list.addAll(index, collection); modCount++; return ret; }
public void mergeFrom(LazyStringList other) { for (Object o : other.getUnderlyingElements()) { if (o instanceof byte[]) { byte[] b = (byte[]) o; // Byte array's content is mutable so they should be copied rather than // shared when merging from one message to another. list.add(Arrays.copyOf(b, b.length)); } else { list.add(o); } } }
@Override public boolean addAll(int index, Collection<? extends String> c) { ensureIsMutable(); // When copying from another LazyStringList, directly copy the underlying // elements rather than forcing each element to be decoded to a String. Collection<?> collection = c instanceof LazyStringList ? ((LazyStringList) c).getUnderlyingElements() : c; boolean ret = list.addAll(index, collection); modCount++; return ret; }
@Override public boolean addAll(int index, Collection<? extends String> c) { ensureIsMutable(); // When copying from another LazyStringList, directly copy the underlying // elements rather than forcing each element to be decoded to a String. Collection<?> collection = c instanceof LazyStringList ? ((LazyStringList) c).getUnderlyingElements() : c; boolean ret = list.addAll(index, collection); modCount++; return ret; }
@Override public void mergeFrom(LazyStringList other) { ensureIsMutable(); for (Object o : other.getUnderlyingElements()) { if (o instanceof byte[]) { byte[] b = (byte[]) o; // Byte array's content is mutable so they should be copied rather than // shared when merging from one message to another. list.add(Arrays.copyOf(b, b.length)); } else { list.add(o); } } }
@Override public void mergeFrom(LazyStringList other) { ensureIsMutable(); for (Object o : other.getUnderlyingElements()) { if (o instanceof byte[]) { byte[] b = (byte[]) o; // Byte array's content is mutable so they should be copied rather than // shared when merging from one message to another. list.add(Arrays.copyOf(b, b.length)); } else { list.add(o); } } }
/** * Adds the {@code values} to the {@code list}. This is a helper method * used by generated code. Users should ignore it. * * @throws NullPointerException if any of the elements of {@code values} is * null. When that happens, some elements of {@code values} may have already * been added to the result {@code list}. */ protected static <T> void addAll(final Iterable<T> values, final Collection<? super T> list) { if (values instanceof LazyStringList) { // For StringOrByteStringLists, check the underlying elements to avoid // forcing conversions of ByteStrings to Strings. checkForNullValues(((LazyStringList) values).getUnderlyingElements()); list.addAll((Collection<T>) values); } else if (values instanceof Collection) { checkForNullValues(values); list.addAll((Collection<T>) values); } else { for (final T value : values) { if (value == null) { throw new NullPointerException(); } list.add(value); } } }
/** * Adds the {@code values} to the {@code list}. This is a helper method * used by generated code. Users should ignore it. * * @throws NullPointerException if {@code values} or any of the elements of * {@code values} is null. When that happens, some elements of * {@code values} may have already been added to the result {@code list}. */ protected static <T> void addAll(final Iterable<T> values, final Collection<? super T> list) { if (values == null) { throw new NullPointerException(); } if (values instanceof LazyStringList) { // For StringOrByteStringLists, check the underlying elements to avoid // forcing conversions of ByteStrings to Strings. checkForNullValues(((LazyStringList) values).getUnderlyingElements()); list.addAll((Collection<T>) values); } else if (values instanceof Collection) { checkForNullValues(values); list.addAll((Collection<T>) values); } else { for (final T value : values) { if (value == null) { throw new NullPointerException(); } list.add(value); } } }
/** * Adds the {@code values} to the {@code list}. This is a helper method * used by generated code. Users should ignore it. * * @throws NullPointerException if {@code values} or any of the elements of * {@code values} is null. When that happens, some elements of * {@code values} may have already been added to the result {@code list}. */ protected static <T> void addAll(final Iterable<T> values, final Collection<? super T> list) { if (values == null) { throw new NullPointerException(); } if (values instanceof LazyStringList) { // For StringOrByteStringLists, check the underlying elements to avoid // forcing conversions of ByteStrings to Strings. checkForNullValues(((LazyStringList) values).getUnderlyingElements()); list.addAll((Collection<T>) values); } else if (values instanceof Collection) { checkForNullValues(values); list.addAll((Collection<T>) values); } else { for (final T value : values) { if (value == null) { throw new NullPointerException(); } list.add(value); } } }