Skip to content

Weird phrase in "functional-interfaces" tutorial #197

@AyAyEm

Description

@AyAyEm

Location of Issue:
https://dev.java/learn/lambdas/functional-interfaces/#using-specialized-predicates

Image

The solution provided by the JDK is the same as for suppliers and consumers: specialized predicates. Along with Predicate<String> are three specialized interfaces: IntPredicate, LongPredicate, and DoublePredicate. Their abstract methods all follow the naming convention. Since they all return a boolean, they are just named test() and take an argument corresponding to the interface.

Description:
I'm having a hard time understanding why Predicate<String> is along with IntPredicate, LongPredicate and DoublePredicate. Was it meant to be Predicate<T>?

Suggested Fix:
Just like the Biconsumer section:

There are three specialized versions of the Predicate<T> interface to handle primitive types: IntPredicate, LongPredicate, and DoublePredicate. Their abstract methods all follow the naming convention. Since they all return a boolean, they are just named test() and take an argument corresponding to the interface.

Minor details:
In the biconsumer i expected to see a "same".

Their abstract methods all follow the naming convention.

Suggested Fix:

Their abstract methods all follow the same naming convention, mentioned at Using Specialized Suppliers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions