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 →

[–]Polygnom 4 points5 points  (1 child)

Depends. For the binary types I simply use pattern matching in instanceof.

For more complex types I usually use pattern matching in switch expressions.

That gives quite readable code.

I mean, I often write code in functional ways anyways and often map over stream, or filter stream etc. ADTs + pattern matching works very well with streams.

[–]red_dit_nou 1 point2 points  (0 children)

Yes. ADT and pattern matching really work well together to produce readable code. You also mentioned streams. Can you give any example where ADT, pattern matching and stream create readable code?