Skip to content

Commit

Permalink
chore: Use LazyStringArrayList (#2304)
Browse files Browse the repository at this point in the history
* chore: Use LazyStringArrayList

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: Update to use LazyStringArrayList.emptyList()

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
lqiu96 and gcf-owl-bot[bot] authored Aug 22, 2024
1 parent 7c70df9 commit d1b0acf
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.google.common.collect.ImmutableList;
import com.google.protobuf.ByteString;
import com.google.protobuf.LazyStringArrayList;
import com.google.protobuf.UnmodifiableLazyStringList;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -109,14 +108,16 @@ public void compareTest() {

@Test
public void testSerialization() throws IOException, ClassNotFoundException {
LazyStringArrayList lazyList = new LazyStringArrayList();
lazyList.add("lazy");
lazyList.add("very lazy");
LazyStringArrayList lazyListNonEmpty =
new LazyStringArrayList(ImmutableList.of("lazy", "very lazy"));
lazyListNonEmpty.makeImmutable();
LazyStringArrayList lazyListEmpty = LazyStringArrayList.emptyList();
lazyListEmpty.makeImmutable();
List[] labelLists = {
Arrays.asList("str1", "str2", "str3"),
ImmutableList.of("string1", "string2"),
new UnmodifiableLazyStringList(lazyList),
new UnmodifiableLazyStringList(LazyStringArrayList.EMPTY)
lazyListNonEmpty,
lazyListEmpty
};

for (int i = 0; i < labelLists.length; i++) {
Expand Down

0 comments on commit d1b0acf

Please sign in to comment.