I like the solution it's clean and not too complex...
# codereview
b
I like the solution it's clean and not too complex, I only have one thing to say about that if inside ifChanged method, in my opinion this code could be cleaner if you create some infix or extension function to boolean, I know it's not a big change lol
Copy code
infix fun Boolean.then(action: () -> Unit) = if (this) action() else null

private fun ifChanged(onListChanged: (List<Quest>) -> Unit) = fun(list: List<Quest>) = (previousList != null) then {
    previousList = list
    onListChanged(list)
}
But I like this solution, it's a good way to chain functions.