Example usage for java.time Period isZero

List of usage examples for java.time Period isZero

Introduction

In this page you can find the example usage for java.time Period isZero.

Prototype

public boolean isZero() 

Source Link

Document

Checks if all three units of this period are zero.

Usage

From source file:Main.java

public static void main(String[] args) {
    Period p = Period.ofMonths(1);

    System.out.println(p.isZero());

}

From source file:Main.java

@Override
public LocalDate queryFrom(TemporalAccessor temporal) {
    LocalDate date = LocalDate.from(temporal);
    LocalDate currentYearMLKDay = getMartinLutherKingDayForDateInYear(date.getYear());

    Period periodToCurrentYearMLKDay = Period.between(date, currentYearMLKDay);

    if (periodToCurrentYearMLKDay.isNegative() || periodToCurrentYearMLKDay.isZero()) {
        return getMartinLutherKingDayForDateInYear(date.getYear() + 1);
    } else {//from   www  .j  av  a 2 s .com
        return currentYearMLKDay;
    }
}