How to cope with existing java code that uses a lot of lambdas and optionals

The ! means that since your result comes from Java the value might be nullable or not. You can probably ignore it in this case as flatMap never returns null. I hope my explanation is not too bad :slight_smile:
You can find out more here: https://kotlinlang.org/docs/reference/java-interop.html#null-safety-and-platform-types