2021年4月22日星期四

Method references on instances - why not call method directly?

I am trying to understand this example code from Oracle Learning on Lambdas and Method References:

String city = "Munich";  Supplier<String> lambda = city::toUpperCase;  System.out.println(lambda.get());  

Why didn't they simply call

city.toUpperCase();  
https://stackoverflow.com/questions/67223377/method-references-on-instances-why-not-call-method-directly April 23, 2021 at 10:57AM

没有评论:

发表评论