1

Recently I started reading about Javaslang and its improvements to the classes added by Java 8. Diving into the documentation I came across the following method:

Option.nothing()

Which returns an instance of a singleton of type Option<Void>. I couldn't however think of a single use case where this could be handy (maybe for indicating that it's the end of the chain, but I can still do .map(v -> 1)). Is there a use case where this could be handy and preferable to None?

Adrian Jałoszewski
  • 1,695
  • 3
  • 17
  • 33
  • 8
    Hi, I used it internally for Vavr's (formerly called Javaslang) Pattern Matching implementation. I needed to model Some that contains a function return value of void/nothing. I used the state None for 'pattern did not match'. But later I implemented it without the use of Option.nothing(). In fact, we planned to remove nothing(). Disclaimer: I'm the creator of Vavr (/Javaslang) – Daniel Dietrich Apr 28 '17 at 19:24

0 Answers0