Skip to content

2017

Algebraic Data Types in Java

Many languages, especially functional ones, make use of algebraic data types. That is, types that have fixed and well known subtypes or implementations. Most languages have some keyword to allow the developer to prevent new implementations of the class from being made. One example would be the sealed keyword on scala traits, which prevents the trait from being implemented anywhere except for in the file where it was declared.