Lambda function in Java 8 has no parameters and return values

I want to transform a simple Java function into a lambda 8 function without any parameters, and then call it:

public int getMissing() {
  return 0;
}

How to convert the above content to java8 lambda format?

Solution

Your case is similar to the vendor in Java 8

supplier<Integer> supplier = () -> 0;
 System.out.println(supplier.get());
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>