I have a lambda expression:
val lambda: ((ArrayList<String>) -> Unit)
I put this into a Bundle as a Serializable, like so:
putSerializable(LAMBDA, lambda as Serializable)
How do I Deserialize the lambda back into the function type: "((ArrayList) -> Unit)" ?
I'm trying to get this to work:
state.getSerializable(LAMBDA)?.also {
val deserializedLambda: ((ArrayList<String>) -> Unit) = it
}
"it" is Serializable. But I need to deserialize it somehow to get it back to being of type ((ArrayList) -> Unit), which is the type of the variable "changes".
Thanks for your help
Presumably you need a cast: it as (ArrayList) -> Unit
.