java.util.function.Predicate



API Populatity

11 Client projects

Project: java

Package: java.util

Project stanfordnlp/CoreNLP in file ...c38b05e9/src.edu.stanford.nlp.util.ArrayUtils.java (2014-11-06)
@@ -2,6 +2,7 @@ package edu.stanford.nlp.util;
 
 import java.lang.reflect.Array;
 import java.util.*;
+import java.util.function.Predicate;
 
 
 /**
@@ -563,11 +564,11 @@ public class ArrayUtils {
    * Implementation notes: creates two arrays, calls <code>filter</code>
    * once for each element, does not alter <code>original</code>
    */
-  public static <T> T[] filter(T[] original, Filter<? super T> filter) {
+  public static <T> T[] filter(T[] original, Predicate<? super T> filter) {
     T[] result = Arrays.copyOf(original, original.length); // avoids generic array creation compile error
     int size = 0;
     for (T value : original) {
-      if (filter.accept(value)) {
+      if (filter.test(value)) {
         result[size] = value;
         size++;
       }
Project stanfordnlp/CoreNLP in file ...5e9/src.edu.stanford.nlp.util.CollectionUtils.java (2014-11-06)
@@ -18,6 +18,7 @@ import java.util.Map;
 import java.util.Random;
 import java.util.Set;
 import java.util.function.Function;
+import java.util.function.Predicate;
 
 import edu.stanford.nlp.stats.ClassicCounter;
 import edu.stanford.nlp.stats.Counter;
@@ -895,10 +896,10 @@ public class CollectionUtils {
    * Filters the objects in the collection according to the given Filter and returns a list
    *
    */
-  public static<T> List<T> filterAsList(Collection<? extends T> original, Filter<? super T> f){
+  public static<T> List<T> filterAsList(Collection<? extends T> original, Predicate<? super T> f){
     List<T> transformed = new ArrayList<T>();
     for (T t: original) {
-      if (f.accept(t)) {
+      if (f.test(t)) {
         transformed.add(t);
       }
     }
Project stanfordnlp/CoreNLP in file ...5a29ae28/src.edu.stanford.nlp.util.ArrayUtils.java (2014-10-24)
@@ -2,6 +2,7 @@ package edu.stanford.nlp.util;
 
 import java.lang.reflect.Array;
 import java.util.*;
+import java.util.function.Predicate;
 
 
 /**
@@ -563,11 +564,11 @@ public class ArrayUtils {
    * Implementation notes: creates two arrays, calls <code>filter</code>
    * once for each element, does not alter <code>original</code>
    */
-  public static <T> T[] filter(T[] original, Filter<? super T> filter) {
+  public static <T> T[] filter(T[] original, Predicate<? super T> filter) {
     T[] result = Arrays.copyOf(original, original.length); // avoids generic array creation compile error
     int size = 0;
     for (T value : original) {
-      if (filter.accept(value)) {
+      if (filter.test(value)) {
         result[size] = value;
         size++;
       }