September 2018
Intermediate to advanced
802 pages
19h 30m
English
In the previous chapter, Chapter 4, Going Functional, while creating a lambda-friendly API, we ended up with the following API method:
public interface Traffic { void speedAfterStart(double timeSec, int trafficUnitsNumber, SpeedModel speedModel, BiPredicate<TrafficUnit, Double> limitTraffic, BiConsumer<TrafficUnit, Double> printResult); }
The specified number of TrafficUnit instances were produced inside the speedAfterStart() method. They were limited by the limitTrafficAndSpeed function and were processed according to the speedModel function inside the speedAfterStart() method. The results were formatted by the printResults function.
It is a very flexible design that allows for quite a range of experimentation via the modification ...
Read now
Unlock full access