From the javadoc of Calendar.before(Object when)
:
Returns whether this Calendar represents a time before the time represented by the specified Object. This method is equivalent to:
compareTo(when) < 0
if and only if when is a Calendar instance. Otherwise, the method returns false.
Why does it accepts an Object if when someone passes something that's not a Calendar instance it returns false? Why not just accepting a Calendar instance? This kept me watching for uncorrect results in a functionality for quite some time.
I think there is no particular reason for that. java.util.Calendar
has some design issues we have have to live with, unfortunately.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With