Uses of Interface java.util.function.Predicate (Java Platform SE 8 )
Date: 2020-03-26

## Uses of Interface
java.util.function.Predicate

- Packages that use Predicate
  Package | Description
  --- | ---
  java.util | Contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes (a string tokenizer, a random-number generator, and a bit array).
  java.util.concurrent | Utility classes commonly useful in concurrent programming.
  java.util.function | Functional interfaces provide target types for lambda expressions and method references.
  java.util.regex | Classes for matching character sequences against patterns specified by regular expressions.
  java.util.stream | Classes to support functional-style operations on streams of elements, such as map-reduce transformations on collections.

- - ### Uses of Predicate in java.util

    Methods in java.util with parameters of type Predicate
    Modifier and Type | Method and Description
    --- | ---
    `Optional<T>` | Optional.`filter(Predicate<? super T> predicate)` If a value is present, and the value matches the given predicate, return an `Optional` describing the value, otherwise return an empty `Optional`.
    `boolean` | ArrayList.`removeIf(Predicate<? super E> filter)`
    `boolean` | Vector.`removeIf(Predicate<? super E> filter)`
    `default boolean` | Collection.`removeIf(Predicate<? super E> filter)` Removes all of the elements of this collection that satisfy the given predicate.

  - ### Uses of Predicate in java.util.concurrent

    Methods in java.util.concurrent with parameters of type Predicate
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | CopyOnWriteArraySet.`removeIf(Predicate<? super E> filter)`
    `boolean` | CopyOnWriteArrayList.`removeIf(Predicate<? super E> filter)`

  - ### Uses of Predicate in java.util.function

    Methods in java.util.function that return Predicate
    Modifier and Type | Method and Description
    --- | ---
    `default Predicate<T>` | Predicate.`and(Predicate<? super T> other)` Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
    `static <T> Predicate<T>` | Predicate.`isEqual(Object targetRef)` Returns a predicate that tests if two arguments are equal according to `Objects.equals(Object, Object)`.
    `default Predicate<T>` | Predicate.`negate()` Returns a predicate that represents the logical negation of this predicate.
    `default Predicate<T>` | Predicate.`or(Predicate<? super T> other)` Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.

    Methods in java.util.function with parameters of type Predicate
    Modifier and Type | Method and Description
    --- | ---
    `default Predicate<T>` | Predicate.`and(Predicate<? super T> other)` Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
    `default Predicate<T>` | Predicate.`or(Predicate<? super T> other)` Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.

  - ### Uses of Predicate in java.util.regex

    Methods in java.util.regex that return Predicate
    Modifier and Type | Method and Description
    --- | ---
    `Predicate<String>` | Pattern.`asPredicate()` Creates a predicate which can be used to match a string.

  - ### Uses of Predicate in java.util.stream

    Methods in java.util.stream with parameters of type Predicate
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | Stream.`allMatch(Predicate<? super T> predicate)` Returns whether all elements of this stream match the provided predicate.
    `boolean` | Stream.`anyMatch(Predicate<? super T> predicate)` Returns whether any elements of this stream match the provided predicate.
    `Stream<T>` | Stream.`filter(Predicate<? super T> predicate)` Returns a stream consisting of the elements of this stream that match the given predicate.
    `boolean` | Stream.`noneMatch(Predicate<? super T> predicate)` Returns whether no elements of this stream match the provided predicate.
    `static <T> Collector<T,?,Map<Boolean,List<T>>>` | Collectors.`partitioningBy(Predicate<? super T> predicate)` Returns a `Collector` which partitions the input elements according to a `Predicate`, and organizes them into a `Map<Boolean, List<T>>`.
    `static <T,D,A> Collector<T,?,Map<Boolean,D>>` | Collectors.`partitioningBy(Predicate<? super T> predicate, Collector<? super T,A,D> downstream)` Returns a `Collector` which partitions the input elements according to a `Predicate`, reduces the values in each partition according to another `Collector`, and organizes them into a `Map<Boolean, D>` whose values are the result of the downstream reduction.

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2020, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.