By the way, which is better — Java way with None a...
# announcements
m
By the way, which is better — Java way with None and Some declared as one class (Optional), or Scala way with sealed class (actually, three classes instead of one)? I have single-class Either implementation, bit it has extra flag which says whether it is left or right.
a
I'd go with the sealed class approach with multiple classes in order to have a single responsibility (makes the code cleaner IMHO, because if i want to look at the behaviour of None, i have to skim through if/else and find out which one belongs to None)
Optional is like the Strategy Pattern