Am I right in assuming that the Java-Optional
does not have much todo with the C++17-optional
?
I know Javas Optional
mostly from use in the Stream-API, e.g.:
Optional<Integer> op = Optional.empty();
op.stream().forEach(System.out::println);
I know it has its uses as a return value as well (not so much as parameter). But concerning this kind of use this is not applicaple to the C++-optional
, right?
Or is it "Monads" again, the thing no-one can explain after understanding it? Does the C++-optional
have in fact everything to do with Monads, and so have Java-Streams, and thus C++--optional
is comparable to Java-Optional
? What would be an comparable example, then?