Use simpler Iterables helper when counting domains

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=230955066
This commit is contained in:
mcilwain 2019-01-25 13:08:42 -08:00 committed by Ben McIlwain
parent 5a8760570c
commit 5b0c61dad3

View file

@ -19,7 +19,7 @@ import static google.registry.model.registry.Registries.assertTldsExist;
import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters; import com.beust.jcommander.Parameters;
import com.google.common.collect.Iterators; import com.google.common.collect.Iterables;
import google.registry.model.domain.DomainBase; import google.registry.model.domain.DomainBase;
import google.registry.util.Clock; import google.registry.util.Clock;
import java.util.List; import java.util.List;
@ -43,14 +43,13 @@ final class CountDomainsCommand implements CommandWithRemoteApi {
} }
private int getCountForTld(String tld, DateTime now) { private int getCountForTld(String tld, DateTime now) {
return Iterators.size( return Iterables.size(
ofy() ofy()
.load() .load()
.type(DomainBase.class) .type(DomainBase.class)
.filter("tld", tld) .filter("tld", tld)
.filter("deletionTime >", now) .filter("deletionTime >", now)
.chunkAll() .chunkAll()
.keys() .keys());
.iterator());
} }
} }