Filter by enum class property Kotlin

Viewed 9896

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

2 Answers
Related