From a0d6f72b21da034b538bcd07f6de2cc46e49498e Mon Sep 17 00:00:00 2001 From: Mickael Istria Date: Sun, 2 Jul 2023 22:12:14 +0200 Subject: [PATCH] Replace guava's with JDK streams Reduce dependency on guava to avoid potential conflicts when multiple versions of guava are in the classpath. --- .../gradle/checksums/WrapperValidator.java | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/internal/gradle/checksums/WrapperValidator.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/internal/gradle/checksums/WrapperValidator.java index f70020340f..d8673908bb 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/internal/gradle/checksums/WrapperValidator.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/internal/gradle/checksums/WrapperValidator.java @@ -31,6 +31,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; @@ -47,10 +48,6 @@ import org.osgi.framework.Bundle; import com.google.common.base.Charsets; -import com.google.common.base.Function; -import com.google.common.base.Predicate; -import com.google.common.collect.FluentIterable; -import com.google.common.collect.ImmutableList; import com.google.common.io.CharStreams; import com.google.common.io.Closeables; import com.google.gson.Gson; @@ -110,21 +107,10 @@ public ValidationResult checkWrapper(String baseDir) throws CoreException { }; List> versions = gson.fromJson(json, typeToken.getType()); //@formatter:off - ImmutableList urls = FluentIterable - .from(versions) - .filter(new Predicate>() { - @Override - public boolean apply(Map input) { - return input.get(WRAPPER_CHECKSUM_URL) != null; - } - }) - .transform(new Function, String>() { - @Override - public String apply(Map input) { - return input.get(WRAPPER_CHECKSUM_URL); - } - }) - .toList(); + List urls = versions.stream() + .map(input -> input.get(WRAPPER_CHECKSUM_URL)) + .filter(Objects::nonNull) + .toList(); // @formatter:on DownloadChecksumJob downloadJob = new DownloadChecksumJob(); int count = 0;