We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
" :: " stands for Method Reference .It is most commonly used for instance methods of a class.As you might have observed ,unless you have something like this:
d -> d.getCgpa()>10 in filter operations ,in all other(most commonly) operations viz sorted,map etc. you can use :: like:
.map(Dish::getCalories) .
A wonderful example would be for forEach : .forEach(System.out::println) !!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Sort
You are viewing a single comment's thread. Return to all comments →
" :: " stands for Method Reference .It is most commonly used for instance methods of a class.As you might have observed ,unless you have something like this: d -> d.getCgpa()>10 in filter operations ,in all other(most commonly) operations viz sorted,map etc. you can use :: like:
.map(Dish::getCalories) . A wonderful example would be for forEach : .forEach(System.out::println) !!