Different dates from different calendar systems may still point to the same actual day. For instance, January 29th 2020 in the Gregorian calendar refers to the same day as January 16th in the Julian calendar.
The LocalDate.isEqual() method checks to see if two dates refer to the same day, regardless of the calendar. LocalDate.equals() will only return true if the date that you compare it with is also a LocalDate, and not, for instance, a JapaneseDate or a ThaiBuddhistDate.
LocalTime doesn't need an isEqual() method, because all calendar systems are assumed to use the same time-of-day representation, namely the 24 hour clock.
"The equals() method of a LocalTime class is used to compare this LocalTime object to the LocalTime passed as parameter and returns true when objects are equal else false. The comparison between both LocalTimes is based on timeline position of the local times within a day. The value to be returned by this method is determined as follows:
if both LocalTimes are equal, then true is returned
if both instances are not equal, then false is returned"
Hey, thanks for the responses. We all know date and time management can be tricky! ;)
@Stephan, I don't still get all the thing... So my understanding is:
Object equality: you use `LocalDate#equals(Object other)` to check that both objects holds the same representation, therefore a `localDate1` object will only equal another `localDate2`object with the same representation. Therefore an object with another representation (for example a Japanese date) won't be equal here even if both hold the same chronological date.
Chronological equality: you use `LocalDate#isEqual(ChronoLocalDate other)` to check that both objects holds the same chronological date regardless of the representation. Therefore two objects holding the LocalDate and the JapaneseDate for the day when mankind first stepped on the Moon will be equal here.
Do you agree? Thanks!
PS: by the way this would explain that `LocalTime` does not need the `isEqual()` method, since it works the same independently of the calendar...