Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.stream.IntStream;
- interface LambdaOperation {
- double performOperation(double n);
- }
- public class SixthExercise {
- public static void main(String[] args) {
- LambdaOperation lambdaOperation = n -> (int) Math.pow(2, n);
- System.out.println("Power of base two to third(n) exponent: " + lambdaOperation.performOperation(3));
- IntStream
- .rangeClosed(0, 20)
- .boxed()
- .forEach(it -> System.out.println("Value no: " + it + " is: " + (int) lambdaOperation.performOperation(it)));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement