From: David ‘Bombe’ Roden Date: Tue, 21 Jan 2014 06:34:23 +0000 (+0100) Subject: Use Java 8’s predicate instead of Guava’s. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=5a7d1c53bac5edd913e483852758660665413ffa;p=xudocci.git Use Java 8’s predicate instead of Guava’s. --- diff --git a/src/main/java/net/pterodactylus/xdcc/ui/stdin/Result.java b/src/main/java/net/pterodactylus/xdcc/ui/stdin/Result.java index e8a52c1..b09b061 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/Result.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/Result.java @@ -23,6 +23,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.List; +import java.util.function.Predicate; import java.util.regex.Pattern; import net.pterodactylus.xdcc.core.Core; @@ -31,7 +32,6 @@ import net.pterodactylus.xdcc.data.Download; import net.pterodactylus.xdcc.data.Pack; import com.google.common.base.Function; -import com.google.common.base.Predicate; import com.google.common.collect.ComparisonChain; /** @@ -48,7 +48,7 @@ public class Result implements Comparable { private final List archiveSuffixes = Arrays.asList("rar", "tar", "zip", "tar.gz", "tar.bz2", "tar.lzma", "7z"); @Override - public boolean apply(Result result) { + public boolean test(Result result) { for (String suffix : archiveSuffixes) { if (result.pack().name().toLowerCase().endsWith(suffix)) { return true; @@ -65,10 +65,10 @@ public class Result implements Comparable { private static final Comparator packArchiveComparator = new Comparator() { @Override public int compare(Result leftResult, Result rightResult) { - if (isArchive.apply(leftResult) && !isArchive.apply(rightResult)) { + if (isArchive.test(leftResult) && !isArchive.test(rightResult)) { return 1; } - if (!isArchive.apply(leftResult) && isArchive.apply(rightResult)) { + if (!isArchive.test(leftResult) && isArchive.test(rightResult)) { return -1; } return 0;