mirror of
https://github.com/google/nomulus
synced 2026-01-10 07:57:58 +00:00
Replace FluentIterable with streams
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=180005797
This commit is contained in:
@@ -17,6 +17,7 @@ package google.registry.export;
|
||||
import static com.google.appengine.api.datastore.DatastoreServiceFactory.getDatastoreService;
|
||||
import static com.google.appengine.api.taskqueue.QueueFactory.getQueue;
|
||||
import static com.google.common.base.Strings.nullToEmpty;
|
||||
import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||
|
||||
import com.google.appengine.api.datastore.Query;
|
||||
import com.google.appengine.api.modules.ModulesService;
|
||||
@@ -24,9 +25,9 @@ import com.google.appengine.api.modules.ModulesServiceFactory;
|
||||
import com.google.appengine.api.taskqueue.TaskHandle;
|
||||
import com.google.appengine.api.taskqueue.TaskOptions;
|
||||
import com.google.appengine.api.taskqueue.TaskOptions.Method;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Streams;
|
||||
import google.registry.util.NonFinalForTesting;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
@@ -88,10 +89,10 @@ public class DatastoreBackupService {
|
||||
public Iterable<DatastoreBackupInfo> findAllByNamePrefix(final String namePrefix) {
|
||||
// Need the raw DatastoreService to access the internal _AE_Backup_Information entities.
|
||||
// TODO(b/19081037): make an Objectify entity class for these raw Datastore entities instead.
|
||||
return FluentIterable.from(
|
||||
getDatastoreService().prepare(new Query(BACKUP_INFO_KIND)).asIterable())
|
||||
return Streams.stream(getDatastoreService().prepare(new Query(BACKUP_INFO_KIND)).asIterable())
|
||||
.filter(entity -> nullToEmpty((String) entity.getProperty("name")).startsWith(namePrefix))
|
||||
.transform(DatastoreBackupInfo::new);
|
||||
.map(DatastoreBackupInfo::new)
|
||||
.collect(toImmutableList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user