DZone
[Question/Problem Statement is the Property of Techgig]
Java Advanced — Lambda Expressions [www.techgig.com]
Write the Following Methods that Return a Lambda Expression Performing a Specified Action: Perform Operation isOdd(): The Lambda Expression must return if a Number is Odd or If it is Even. Perform Operation isPrime(): The lambda expression must return if a number is prime or if it is composite. PerformOperation isPalindrome(): The Lambda Expression must return if a number is a Palindrome or if it is not.
Input Format
Input is as Show in the Format Below
Input
3
1 3
2 7
3 7777
Constraints
NA
NA
Output Format
Output is as Show in the Format Below
Output
ODD
PRIME
PALINDROME
[Explanation of the Solution]
This is a Good Question to Refresh Java 8 Lambdas. In my Solution, I Implemented the Functional Interfaces within my main()
Method and assigned it to Local Reference Variables.
Source: DZone