den123
den123

Reputation: 801

How to use function reference for Java 8?

How to use function reference in this case (function reference instead x.length())?

private static Function<String, Integer> f1 = x -> x.length();

Upvotes: 0

Views: 69

Answers (1)

Dmitry Gorkovets
Dmitry Gorkovets

Reputation: 2286

Like this

private static Function<String, Integer> f1 = String::length;

Upvotes: 2

Related Questions