Example usage for java.time.temporal Temporal equals

List of usage examples for java.time.temporal Temporal equals

Introduction

In this page you can find the example usage for java.time.temporal Temporal equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:org.silverpeas.core.calendar.ical4j.ICal4JImporter.java

private Period extractPeriod(final Mutable<ZoneId> zoneId, final VEvent vEvent) {
    final Date startDate = vEvent.getStartDate().getDate();
    Date endDate = vEvent.getEndDate().getDate();
    if (endDate == null && !(startDate instanceof DateTime)) {
        endDate = startDate;/*  www. j  a  v  a  2  s. c  om*/
    }
    Temporal startTemporal = iCal4JDateCodec.decode(startDate, zoneId.get());
    Temporal endTemporal = iCal4JDateCodec.decode(endDate, zoneId.get());
    if (endTemporal instanceof OffsetDateTime && startTemporal.equals(endTemporal)) {
        endTemporal = endTemporal.plus(1, ChronoUnit.HOURS);
    }
    return Period.between(startTemporal, endTemporal);
}