Using lambda expressions, implement functional interfaces.
Sample:
return a length of the string, "abc" -> 3, solution:
Function<String, Integer> f = s -> s.length();
Given an integer, return a power of integer: 5 -> 25
Given a string, return modulo 2 of string length: "abcde" -> 1
Given a string, return its in upper case: "ivan" -> "IVAN"
Given 2 strings, return a sum of their lengths: "abc", "de" -> 5
Given 2 strings, print a sum of their lengths.
Return a date of one week prior to today: "2020-05-30"
Given a string, return a string, which consists of a first half of its character, if length is even, returns an empty string otherwise: "abcde" -> "ab", "abcde" -> "".
Return a random number
Given a string, return a reversed string: "abc" ->"cba"
Given a number, return a reversed number: 12345 -> 54321
Given a number, return true if it is even, false otherwise: 6 -> true, 25 -> false
Given a string, return true, if its length is more than 3, false otherwise: "ab" -> false, "abc" -> true
Given a string and a number x. Return true, if length of string is more than x, false otherwise. Hint: BiPredicate.
Using method reference, implement functional interfaces:
Print a given string
Given a string, return a lower case string
Given a number, return a square root from the number
Implement solution 7 from above as a method reference
Given a class Employee with name and salary. Return an employee salary using 1. Supplier, 2. Function.
Using lambda expressions, implement functional interfaces.
Sample: return a length of the string,
"abc" -> 3
, solution:Function<String, Integer> f = s -> s.length();
Using method reference, implement functional interfaces: