Want to implement LongPredicate using lambda and method reference in Java? Use the below example of Lambda Expression:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import java.util.function.LongPredicate; public class LongPredicateLambdaTest { public static void main(String args[]) { LongPredicate longPredicate = (long input) -> { // lambda expression if(input == 50) { return true; } else return false; }; boolean result = longPredicate.test(50); System.out.println(result); } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.