You are viewing a single comment's thread. Return to all comments →
Fixed code.
public static PerformOperation is_odd() { return (int a) -> { return ((a & 1) == 1); }; } public static PerformOperation is_prime() { return (int a) -> { if (a < 2) return false; for (int i = 2; i * i <= a; i++) if (a % i == 0) return false; return true; }; } public static PerformOperation is_palindrome() { return (int a) -> { String str = Integer.toString(a); String str2 = ""; int i = 0; int j = str.length() - 1; for ( ; i <= j; ++i, --j) { if (str.charAt(i) != str.charAt(j)) return false; } return true; }; } }
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 →
Fixed code.