filter


Description:

public Optional<T> filter (Predicate<T> predicate)

Filters the value based on the given predicate.

Parameters:

predicate

The predicate function.

Returns:

If the value is present and matches the predicate, an Optional containing the value is returned. Otherwise, returns an empty Optional.