From 7c5bec1b48db95854965c13c203a0e23373c88d6 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 17 Dec 2015 10:15:57 -0700 Subject: [PATCH] Using Java 8 Predicate Function + Removing jetty-util (java 7) holdover Predicate.java + Converting use to (java 8) java.util.function.Predicate --- .../java/org/eclipse/jetty/http/PathMap.java | 4 +-- .../jetty/http/pathmap/PathSpecSet.java | 3 +- .../eclipse/jetty/util/IncludeExclude.java | 1 + .../org/eclipse/jetty/util/Predicate.java | 31 ------------------- .../java/org/eclipse/jetty/util/RegexSet.java | 1 + 5 files changed, 4 insertions(+), 36 deletions(-) delete mode 100644 jetty-util/src/main/java/org/eclipse/jetty/util/Predicate.java diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java b/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java index 41cc11f1d87..457679434c5 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/PathMap.java @@ -26,11 +26,9 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.StringTokenizer; -import java.util.function.BiFunction; +import java.util.function.Predicate; import org.eclipse.jetty.util.ArrayTernaryTrie; -import org.eclipse.jetty.util.IncludeExclude; -import org.eclipse.jetty.util.Predicate; import org.eclipse.jetty.util.Trie; import org.eclipse.jetty.util.URIUtil; diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/PathSpecSet.java b/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/PathSpecSet.java index 330b55ab25c..75fc4214031 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/PathSpecSet.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/pathmap/PathSpecSet.java @@ -24,8 +24,7 @@ import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.TreeSet; - -import org.eclipse.jetty.util.Predicate; +import java.util.function.Predicate; /** * A Set of PathSpec strings. diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/IncludeExclude.java b/jetty-util/src/main/java/org/eclipse/jetty/util/IncludeExclude.java index 96a8791382a..39d80e22918 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/IncludeExclude.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/IncludeExclude.java @@ -20,6 +20,7 @@ package org.eclipse.jetty.util; import java.util.HashSet; import java.util.Set; +import java.util.function.Predicate; /** Utility class to maintain a set of inclusions and exclusions. diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/Predicate.java b/jetty-util/src/main/java/org/eclipse/jetty/util/Predicate.java deleted file mode 100644 index 33a8eb41a88..00000000000 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/Predicate.java +++ /dev/null @@ -1,31 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2015 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.util; - -/** - * Temporary implementation of Java 8's java.util.function.Predicate - *

- * To be removed for Java 8 only versions of Jetty. - * - * @param the item to test - */ -public interface Predicate -{ - boolean test(ITEM item); -} diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/RegexSet.java b/jetty-util/src/main/java/org/eclipse/jetty/util/RegexSet.java index 3f738d226cf..ca5a0305d89 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/RegexSet.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/RegexSet.java @@ -23,6 +23,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.Set; +import java.util.function.Predicate; import java.util.regex.Pattern; /**