I'm busy with reading and do some practicing for
Java 17 OCP. I'm busy in Chapter 10 "Channing Optionals".
Suddenly out of the blue, there is line represented like
I can follow that flatMap must be used instead off map().
Than I was asking myself what would you do with it? What is possible to use it that makes the live easier...
I have made something, but that doesn't make really sense but, at least it compiles and it runs, but is just returning what passed in:
No I try to do something like counting the length of a
String, but this doesn't compile:
And this overloaded method calling by:
An Optional like Optional<Integer> does have one value, right. I mean it is not a List or Array something like that.
It's for me very hard to understand what can you do with it? In which situation would you use it?
For diehard java developers they think a stupid question, you must be creative to think what
you should do with it, but as said, on this moment I don't see the advantage.