@jnb: equals() can be called on a null string, so you don’t need the null check. You could also use when instead of the if/else if chain. I wouldn’t do all the work in the constructor, too. Constructors should construct an object. Methods should do things.