rocketraman
10/23/2023, 10:27 PMLocalTime
(or LocalDateTime
or even Instant
) are comparing as true
? Huh?
val a = LocalTime(21, 0)..LocalTime(9, 0)
val b = LocalTime(22, 0)..LocalTime(9, 15)
// true ??
println(a == b)
rocketraman
10/23/2023, 11:06 PMval a = 5..1
val b = 6..1
// true
println(a == b)
I guess in one way I can see this, as no value can fall between start and end, therefore the ranges are in effect empty and equal. But its still a bit surprising. Especially when one looks at the implementation of ComparableRange.equals
, its checking equality of start
and endInclusive
, which would cause that equality to be false.rocketraman
10/23/2023, 11:07 PMisEmpty
. Ok!