Hacker News new | ask | show | jobs
by eternalban 4063 days ago
You are not correct regarding Java's enums. Define properties for your enum type, widen the constructor appropriately, and provide the accessor methods:

https://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html...

1 comments

That's not the same thing. Rust enums are types, each with the possibility of having different fields that store data. Java enums are instances of a type, each with static data.

(rust enums can have associated data too, but its not their main usage in idiomatic code)