You are viewing a single comment's thread. Return to all comments →
PerformOperation isOdd(){ return (n)->n%2==0?false:true; } PerformOperation isPrime() { return (n) -> { if (n < 2) return false; for (int i = 2; i <= Math.sqrt(n); i++) { if (n % i == 0) { return false; } } return true; }; } PerformOperation isPalindrome(){ return (n)->{ String str=String.valueOf(n); String reversedString = new StringBuilder(str).reverse().toString(); if (reversedString.equals(str)) return true; return false; }; }; }
Seems like cookies are disabled on this browser, please enable them to open this website
Java Lambda Expressions
You are viewing a single comment's thread. Return to all comments →