You are viewing a single comment's thread. Return to all comments →
Trying to keep everything to one line. Might not be the most efficient, but it's clean.
public static PerformOperation is_odd(){ return (int a) -> a % 2 != 0; } public static PerformOperation is_prime(){ return (int a) -> java.math.BigInteger.valueOf(a).isProbablePrime(1); } public static PerformOperation is_palindrome(){ return (int a) -> Integer.toString(a).equals( new StringBuilder(Integer.toString(a)).reverse().toString() ); }
Java Lambda Expressions
You are viewing a single comment's thread. Return to all comments →
Trying to keep everything to one line. Might not be the most efficient, but it's clean.