Issue
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 -> {}
}
}
Solution
this should work:
val list = dataList.filter {
when(it.type){
Type.ACTIVE,
Type.RENEWED,
Type.OTHER -> true
else -> false
}
}
Answered By - Ivo Beckers
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.