I don't get the following results:
I have a function alreadyDoneToday():Boolean
. While debugging I noticed an odd behavior. The expression itself returns true
, but false
when wrapped inside the function.
var lastDone: Date? = null
...
fun today(): Date {
var calendar = Calendar.getInstance()
return toDateWithoutTime(calendar.time)
}
My solution was now to add a null-check:
fun alreadyDoneToday():Boolean{
return lastDone != null && lastDone!! == today()
}
I was kinda hoping that I could compare a nullable to a not nullable. Apparently not. However the debugger output is really misleading.
Any clues?