Migrate Guava Predicates.notNull to Objects.nonNull

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179569444
This commit is contained in:
mcilwain 2017-12-19 10:10:20 -08:00 committed by Ben McIlwain
parent 633eb3179a
commit 0bb2e12a8a
7 changed files with 15 additions and 16 deletions

View file

@ -16,7 +16,6 @@ package google.registry.model.ofy;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Predicates.notNull;
import static com.google.common.collect.Maps.uniqueIndex;
import static com.googlecode.objectify.ObjectifyService.ofy;
import static google.registry.config.RegistryConfig.getBaseOfyRetryDuration;
@ -135,7 +134,7 @@ public class Ofy {
@Override
protected void handleDeletion(Iterable<Key<?>> keys) {
assertInTransaction();
checkState(Streams.stream(keys).allMatch(notNull()), "Can't delete a null key.");
checkState(Streams.stream(keys).allMatch(Objects::nonNull), "Can't delete a null key.");
checkProhibitedAnnotations(keys, NotBackedUp.class, VirtualEntity.class);
TRANSACTION_INFO.get().putDeletes(keys);
}
@ -167,7 +166,8 @@ public class Ofy {
@Override
protected void handleSave(Iterable<?> entities) {
assertInTransaction();
checkState(Streams.stream(entities).allMatch(notNull()), "Can't save a null entity.");
checkState(
Streams.stream(entities).allMatch(Objects::nonNull), "Can't save a null entity.");
checkProhibitedAnnotations(entities, NotBackedUp.class, VirtualEntity.class);
ImmutableMap<Key<?>, ?> keysToEntities = uniqueIndex(entities, Key::create);
TRANSACTION_INFO.get().putSaves(keysToEntities);