Uses of Interface java.util.function.Predicate (Java SE 26 & JDK 26)
Description: use: module: java.base, package: java.util.function, interface: Predicate

# Uses of Interface
java.util.function.Predicate

Packages that use Predicate
Package
Description
com.sun.net.httpserver
Provides a simple high-level Http server API, which can be used to build embedded HTTP servers.
java.io
Provides for system input and output through data streams, serialization and the file system.
java.lang.classfile
Provides classfile parsing, generation, and transformation library.
java.util
Contains the collections framework, some internationalization support classes, a service loader, properties, random number generation, string parsing and scanning classes, base64 encoding and decoding, a bit array, and several miscellaneous utility classes.
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.
jdk.jfr.consumer
This package contains classes for consuming Flight Recorder data.

- ## Uses of Predicate in com.sun.net.httpserver

  Methods in com.sun.net.httpserver with parameters of type Predicate
  Modifier and Type
  Method
  Description
  `static HttpHandler`
  HttpHandlers.`handleOrElse(Predicate<Request> handlerTest, HttpHandler handler, HttpHandler fallbackHandler)`
  Complements a conditional `HttpHandler` with another handler.

- ## Uses of Predicate in java.io

  Methods in java.io with parameters of type Predicate
  Modifier and Type
  Method
  Description
  `static ObjectInputFilter`
  ObjectInputFilter.`allowFilter(Predicate<Class<?>> predicate, ObjectInputFilter.Status otherStatus)`
  Returns a filter that returns `Status.ALLOWED` if the predicate on the class is `true`.
  `static ObjectInputFilter`
  ObjectInputFilter.`rejectFilter(Predicate<Class<?>> predicate, ObjectInputFilter.Status otherStatus)`
  Returns a filter that returns `Status.REJECTED` if the predicate on the class is `true`.

- ## Uses of Predicate in java.lang.classfile

  Methods in java.lang.classfile with parameters of type Predicate
  Modifier and Type
  Method
  Description
  `static ClassTransform`
  ClassTransform.`dropping(Predicate<ClassElement> filter)`
  Creates a class transform that passes each element through to the builder, except for those that the supplied `Predicate` returns true for.
  `static FieldTransform`
  FieldTransform.`dropping(Predicate<FieldElement> filter)`
  Creates a field transform that passes each element through to the builder, except for those that the supplied `Predicate` is true for.
  `static MethodTransform`
  MethodTransform.`dropping(Predicate<MethodElement> filter)`
  Creates a method transform that passes each element through to the builder, except for those that the supplied `Predicate` is true for.
  `static ClassTransform`
  ClassTransform.`transformingMethodBodies(Predicate<MethodModel> filter, CodeTransform xform)`
  Creates a class transform that transforms the `CodeAttribute` (method body) of `MethodModel` elements with the supplied code transform for methods that the supplied `Predicate` returns true for, passing other elements through to the builder.
  `static ClassTransform`
  ClassTransform.`transformingMethods(Predicate<MethodModel> filter, MethodTransform xform)`
  Creates a class transform that transforms `MethodModel` elements with the supplied method transform for methods that the supplied `Predicate` returns true for, passing other elements through to the builder.

- ## Uses of Predicate in java.util

  Methods in java.util with parameters of type Predicate
  Modifier and Type
  Method
  Description
  `Optional<T>`
  Optional.`filter(Predicate<? super T> predicate)`
  If a value is present, and the value matches the given predicate, returns an `Optional` describing the value, otherwise returns an empty `Optional`.
  `boolean`
  ArrayDeque.`removeIf(Predicate<? super E> filter)`
  `boolean`
  ArrayList.`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 (optional operation).
  `boolean`
  PriorityQueue.`removeIf(Predicate<? super E> filter)`
  `boolean`
  Vector.`removeIf(Predicate<? super E> filter)`

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

  Methods in java.util.concurrent with parameters of type Predicate
  Modifier and Type
  Method
  Description
  `static <T> StructuredTaskScope.JoinerPREVIEW<T, List<StructuredTaskScope.SubtaskPREVIEW<T>>>`
  StructuredTaskScope.Joiner.`allUntil(Predicate<StructuredTaskScope.SubtaskPREVIEW<T>> isDone)`
  Returns a new Joiner object that yields a list of all subtasks when all subtasks complete or a predicate returns `true` to cancel the scope.
  `boolean`
  ArrayBlockingQueue.`removeIf(Predicate<? super E> filter)`
  `boolean`
  ConcurrentLinkedDeque.`removeIf(Predicate<? super E> filter)`
  `boolean`
  ConcurrentLinkedQueue.`removeIf(Predicate<? super E> filter)`
  `boolean`
  CopyOnWriteArrayList.`removeIf(Predicate<? super E> filter)`
  `boolean`
  CopyOnWriteArraySet.`removeIf(Predicate<? super E> filter)`
  `boolean`
  LinkedBlockingDeque.`removeIf(Predicate<? super E> filter)`
  `boolean`
  LinkedBlockingQueue.`removeIf(Predicate<? super E> filter)`
  `boolean`
  LinkedTransferQueue.`removeIf(Predicate<? super E> filter)`
  `boolean`
  PriorityBlockingQueue.`removeIf(Predicate<? super E> filter)`
  Constructors in java.util.concurrent with parameters of type Predicate
  Modifier
  Constructor
  Description
  ``
  `ForkJoinPool(int parallelism, ForkJoinPool.ForkJoinWorkerThreadFactory factory, Thread.UncaughtExceptionHandler handler, boolean asyncMode, int corePoolSize, int maximumPoolSize, int minimumRunnable, Predicate<? super ForkJoinPool> saturate, long keepAliveTime, TimeUnit unit)`
  Creates a `ForkJoinPool` with the given parameters.

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

  Methods in java.util.function that return Predicate
  Modifier and Type
  Method
  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.
  `static <T> Predicate<T>`
  Predicate.`not(Predicate<? super T> target)`
  Returns a predicate that is the negation of the supplied 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
  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.`not(Predicate<? super T> target)`
  Returns a predicate that is the negation of the supplied 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.

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

  Methods in java.util.regex that return Predicate
  Modifier and Type
  Method
  Description
  `Predicate<String>`
  Pattern.`asMatchPredicate()`
  Creates a predicate that tests if this pattern matches a given input string.
  `Predicate<String>`
  Pattern.`asPredicate()`
  Creates a predicate that tests if this pattern is found in a given input string.

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

  Methods in java.util.stream with parameters of type Predicate
  Modifier and Type
  Method
  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.
  `default Stream<T>`
  Stream.`dropWhile(Predicate<? super T> predicate)`
  Returns, if this stream is ordered, a stream consisting of the remaining elements of this stream after dropping the longest prefix of elements that match the given predicate.
  `Stream<T>`
  Stream.`filter(Predicate<? super T> predicate)`
  Returns a stream consisting of the elements of this stream that match the given predicate.
  `static <T,A,R> Collector<T,?,R>`
  Collectors.`filtering(Predicate<? super T> predicate, Collector<? super T, A, R> downstream)`
  Adapts a `Collector` to one accepting elements of the same type `T` by applying the predicate to each input element and only accumulating if the predicate returns `true`.
  `static <T> Stream<T>`
  Stream.`iterate(T seed, Predicate<? super T> hasNext, UnaryOperator<T> next)`
  Returns a sequential ordered `Stream` produced by iterative application of the given `next` function to an initial element, conditioned on satisfying the given `hasNext` 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.
  `default Stream<T>`
  Stream.`takeWhile(Predicate<? super T> predicate)`
  Returns, if this stream is ordered, a stream consisting of the longest prefix of elements taken from this stream that match the given predicate.

- ## Uses of Predicate in jdk.jfr.consumer

  Methods in jdk.jfr.consumer with parameters of type Predicate
  Modifier and Type
  Method
  Description
  `void`
  RecordingFile.`write(Path destination, Predicate<RecordedEvent> filter)`
  Filter out events and write them to a new file.