I have a list of enum constants (types) of the same enum object. How can I filter the list by multiple constants?
I have tried this:
val list = dataList.filter {
when(it.type){
Type.ACTIVE,
Type.RENEWED,
Type.OTHER -> {}
}
}
CodePudding user response:
this should work:
val list = dataList.filter {
when(it.type){
Type.ACTIVE,
Type.RENEWED,
Type.OTHER -> true
else -> false
}
}