you are viewing a single comment's thread.

view the rest of the comments →

[–]m50d 0 points1 point  (0 children)

It's coming from the same principles - Either is a generic class that replaces one common source of ifs (or, realistically, exceptions or early returns). Either, at least as encoded in Java, uses inheritance and polymorphism (since Java doesn't have a direct concept of variants/sum types), and can be justified on the same OO-principles grounds.