References
- https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/function/package-summary.html
- https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html#isEmpty()
- https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/function/ToIntFunction.html
- https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Integer.html#intValue()
This is Predicate
Functional Interface's abstract method. It gets one argument T t
and return boolean
.
boolean test(T t)
Evaluates this predicate on the given argument.
But, in this example, String::isEmpty
does not get any argument but it is instance method of String
.
Predicate<String> p = String::isEmpty;
I can infer that in Java, this type of method can apply to Functional Interface with one argument.
And, is there any examples of one argument Functional Interface with the function has one argument not like upper example?