Refactor Guava functional methods to use lambdas

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177027488
This commit is contained in:
mcilwain 2017-11-27 09:30:15 -08:00 committed by jianglai
parent 2ae496bfce
commit bbe2584da4
47 changed files with 478 additions and 647 deletions

View file

@ -21,7 +21,6 @@ import static google.registry.util.CollectionUtils.isNullOrEmpty;
import com.google.common.collect.ImmutableSet;
import com.googlecode.objectify.Key;
import com.googlecode.objectify.Work;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import google.registry.model.BackupGroupRoot;
@ -100,17 +99,15 @@ public class DomainApplicationIndex extends BackupGroupRoot {
return ImmutableSet.of();
}
// Perform eventually consistent query, to avoid overenlisting cross entity groups
return ofy().doTransactionless(new Work<ImmutableSet<DomainApplication>>() {
@Override
public ImmutableSet<DomainApplication> run() {
ImmutableSet.Builder<DomainApplication> apps = new ImmutableSet.Builder<>();
for (DomainApplication app : ofy().load().keys(index.getKeys()).values()) {
if (app.getDeletionTime().isAfter(now)) {
apps.add(app);
}
}
return apps.build();
}});
return ofy().doTransactionless(() -> {
ImmutableSet.Builder<DomainApplication> apps = new ImmutableSet.Builder<>();
for (DomainApplication app : ofy().load().keys(index.getKeys()).values()) {
if (app.getDeletionTime().isAfter(now)) {
apps.add(app);
}
}
return apps.build();
});
}
/**