I have two ZonedDateTime
instances:
final ZonedDateTime a = ...;
final ZonedDateTime b = ...;
I want to get the maximum of those two values. I want to avoid having to write custom ad-hoc code.
What is the best way to do this in Java 8? I am currently doing it as following:
final ZonedDateTime c = Stream.of(a, b).max(ChronoZonedDateTime::compareTo).get();
Are there better approaches?