Just go to Streams and Java 8 Lambda functions, and the last comment to what otherwise does not require explanation of Oracle doc Lambda Expressions :
You can serialize a lambda expression if its target type and its captured arguments are serializable. However, like inner classes, serializing lambda expressions is strongly discouraged.
Checking this, I found the SO question
How to serialize lambda?
where the OP deals with serialized lambda expressions from client code.
If I had a web service and one of the parameters was a lambda expression, it looks like it could contain malicious code that could do things like access the file system, or cause a stack overflow - so it would be really foolish to trust it ,
Am I overdoing the security risk or are there restrictions on what a serialized expression can contain?
java lambda java-8 serialization
Adam
source share