get Newest ZonedDateTime - Java java.time

Java examples for java.time:ZonedDateTime

Description

get Newest ZonedDateTime

Demo Code


//package com.java2s;

import java.time.ZonedDateTime;

public class Main {
    public static ZonedDateTime getNewest(final ZonedDateTime first,
            final ZonedDateTime second) {
        if (first == null) {
            return second;
        } else if (second == null || first.isAfter(second)) {
            return first;
        }/* w w  w . j  a v  a  2  s .com*/

        return second;
    }
}

Related Tutorials