Run automatic Java 8 conversion over codebase

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171174380
This commit is contained in:
mcilwain 2017-10-05 10:48:38 -07:00 committed by Ben McIlwain
parent 44df5da771
commit 5edb7935ed
190 changed files with 2312 additions and 3096 deletions

View file

@ -15,13 +15,13 @@
package google.registry.whois;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static google.registry.model.EppResourceUtils.queryNotDeleted;
import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Predicate;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Streams;
import com.google.common.net.InternetDomainName;
import google.registry.model.host.HostResource;
import google.registry.model.registry.Registries;
@ -47,16 +47,14 @@ final class NameserverLookupByIpCommand implements WhoisCommand {
@Override
public WhoisResponse executeQuery(DateTime now) throws WhoisException {
ImmutableList<HostResource> hosts = FluentIterable
.from(queryNotDeleted(HostResource.class, now, "inetAddresses", ipAddress))
.filter(new Predicate<HostResource>() {
@Override
public boolean apply(final HostResource host) {
return Registries
.findTldForName(InternetDomainName.from(host.getFullyQualifiedHostName()))
.isPresent();
}})
.toList();
ImmutableList<HostResource> hosts =
Streams.stream(queryNotDeleted(HostResource.class, now, "inetAddresses", ipAddress))
.filter(
host ->
Registries.findTldForName(
InternetDomainName.from(host.getFullyQualifiedHostName()))
.isPresent())
.collect(toImmutableList());
if (hosts.isEmpty()) {
throw new WhoisException(now, SC_NOT_FOUND, "No nameservers found.");
}