Re:Virtual Structs Part 1: Where Rust’s Enum Shines
by taeric on Tuesday May 05, 2015 @03:47PM
(#9494518)
Not in the same way. In Java, you can have an enum that has some data placed on it, at a per value basis. You can not have an enum where different instances of the same value have different values attached to it.
That is, Enum.A will always be Enum.A with the same data on it at all times in Java. This is not the case for ADTs.
That is, Enum.A will always be Enum.A with the same data on it at all times in Java. This is not the case for ADTs.