I implemented the following enum in Kotlin
enum class PlaylistAction(val playlistFilter:(Playlist) -> Boolean) {
PLAY ({ it.playListOwner.Id == "xxx" }),
SAVE({true})
}
I would like to use it to filter a List like this:
var test = playlists.filter { playlistActionType.playlistFilter}
where playlistActionType is of type PlaylistAction
and playlists is List<Playlist>
But i am getting the following error:
Error:(122, 34) Type mismatch: inferred type is (Playlist) -> (Playlist) -> Boolean but (Playlist) -> Boolean was expected
Why is the inferred type (Playlist) -> (Playlist) -> Boolean and not (Playlist) -> Boolean?