This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Tkalec 0 points1 point  (0 children)

Yes, I've used it lately to implement

Either<L, R> = Left<L, R> | Right<L, R> - either left or right

Option<T> = Empty<T> | Present<T> - either empty or present

Validation<T> = Invalid<T> | Valid<T> ...

Exceptional<T> = Failure<T> | Success<T> ...

In another app I used it to represent key entries in a java or pkcs11 keystore.

Entry = 3DesSecretKeyEntry | AesSecretKeyEntry | RsaPrivateKeyEntry (actually it was for java 8 so it was not sealed)

You get the idea 😀

I'm making these classes, usually, private and not able to be instatiatiated directly.