June 2018
Beginner
722 pages
18h 47m
English
Let's look at our last implementation of the call to the supplyDecidePprocessAndConsume() method:
supplyDecideProcessAndConsume(() -> 7, d -> d < 5, i -> i * 5., d -> System.out.println("Result=" + d + " Great!"));
The functions we have used are pretty trivial. In real-life code, each of them may require a multiple-line implementation. In such a case, to put a code block inline would make the code almost unreadable. In such cases, referring to the methods with the necessary implementation helps. Let's assume we have the following Helper class:
public class Helper { public double calculateResult(int i){ // Maybe many lines of code here return i* 5; } public static void printResult(double d){ // Maybe many lines of code ...
Read now
Unlock full access