3 ms·
Yeah I don't get the iterator thing either... Saw the implementation and I'm not sure what the usecase would be. They have essentially implement a single eleme
by porridgeraisin 2y ago
Yeah I don't get the iterator thing either... Saw the implementation and I'm not sure what the usecase would be.
They have essentially implement a single element iterator for Some and a zero element iterator for None.
- ai_ 2y agoIt's useful for combinators, like flatMap. For instance if you want to flatten an iterator of optional values into the values of all some elements.
- dehrmann 2y agoIs it worth using a custom library so you can do .flatMap(Maybe::stream) instead of .filter(Optional::isPresent).map(Optional::get)
- sedro 2y agoIt's useful and very common to use. For example, you could concatenate together command-line argument flags that may or may not be present.