From d02767ece51fdc35466cec0f0f8842af210726e9 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Mon, 3 Nov 2014 20:08:36 -0800 Subject: [PATCH] Cleanup ListPage in google apis. --- .../googlecloudstorage/domain/ListPage.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ListPage.java b/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ListPage.java index efa017c8c2..f94b1ca79c 100644 --- a/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ListPage.java +++ b/providers/google-cloud-storage/src/main/java/org/jclouds/googlecloudstorage/domain/ListPage.java @@ -16,32 +16,31 @@ */ package org.jclouds.googlecloudstorage.domain; +import static org.jclouds.googlecloudstorage.internal.NullSafeCopies.copyOf; + import java.beans.ConstructorProperties; import java.util.List; import org.jclouds.javax.annotation.Nullable; import com.google.common.collect.ForwardingList; -import com.google.common.collect.ImmutableList; -/** - * The collection returned from any listFirstPage() method. - */ +/** An immutable list that includes a token, if there is another page available. */ public final class ListPage extends ForwardingList { private final List items; private final String nextPageToken; private final List prefixes; - public static ListPage create(Iterable items, String nextPageToken, List prefixes) { + public static ListPage create(List items, String nextPageToken, List prefixes) { return new ListPage(items, nextPageToken, prefixes); } @ConstructorProperties({ "items", "nextPageToken", "prefixes" }) - ListPage(Iterable items, String nextPageToken, List prefixes) { - this.items = items != null ? ImmutableList.copyOf(items) : ImmutableList.of(); + ListPage(List items, String nextPageToken, List prefixes) { + this.items = copyOf(items); this.nextPageToken = nextPageToken; - this.prefixes = prefixes != null ? prefixes : ImmutableList.of(); + this.prefixes = copyOf(prefixes); } @Nullable public String nextPageToken() {