4 ms·
I'm generally a proponent of OO, and I actually think this kind of filtering chain is one of a number of places where fp code can be more readable than imperati
by mypalmike 4y ago
I'm generally a proponent of OO, and I actually think this kind of filtering chain is one of a number of places where fp code can be more readable than imperative loops.
- Jtsummers 4y agoIt's also, more or less, the "fluent interface" style if laid out differently, other than the lambdas (but even those are in both C# and Java): timeslotRepo.findAll() .stream() .filter(timeslot->timeslot.getEndDate()==null) .first() .ifPresentOrElse(()->{}, ()->{new Timeslot(DateTime.now())}) https://en.wikipedia.org/wiki/Fluent_interface#Java https://en.wikipedia.org/wiki/Fluent_interface#Java