I would like to refer to an array with an enum type. This is a pretty standard thing in C ++ (my origin), however I'm not sure if this is possible / desirable in Java.
For example, I would like to have an enumeration, for example:
public enum Resource {
COAL,
IRON
}
Then I would like to refer like this:
Amount[COAL]
Price[IRON]
I do not want to create fields Amountand Price Resource, since I need a list of objects (orders for resources), grouped by resource type. Manually assigning int to each type is Resourceno better than public static int final BLAH, I feel, nothing worked.
In essence, I'm looking for a C ++ enumeration that tags things. I understand that this may be the βwrongβ way of doing things in Java, so feel free to point me in the direction of the right Java ethos.