How to do it...

Let's recall how a user called the lambda-friendly API:

double timeSec = 10.0;int trafficUnitsNumber = 10;SpeedModel speedModel = (t, wp, hp) -> ...;BiConsumer<TrafficUnit, Double> printResults = (tu, sp) -> ...;BiPredicate<TrafficUnit, Double> limitSpeed = (tu, sp) -> ...;Traffic api = new TrafficImpl(Month.APRIL, DayOfWeek.FRIDAY, 17,                               "USA", "Denver", "Main103S");api.speedAfterStart(timeSec, trafficUnitsNumber, speedModel,                     limitSpeed, printResults);

As we have already noticed, such an API may not cover all the possible ways the model can evolve, but it is a good starting point that allows us to construct the stream and the pipeline of operations with more transparency and flexibility of experimentation.

Now, let's look ...

Get Java 11 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.