How do I filter by an enum class in kotlin? (just learning)
In the code below the enum class defined earlier in the file is PayStatus{PAID,UNPAID}
.
fun nextRentDate(): LocalDate? {
return rentPaymentSchedule.
filter { it.value.paymentStatus is PayStatus.UNPAID}.
minBy { it.value.date.toEpochDay() }?.value?.date
}
I get the error: Kotlin:
Incompatible types: PayStatus.UNPAID and Enum