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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.