I need to store key/value info in some type of collection. In C#, I'd define a dictionary like this:
var entries = new Dictionary<string, int>();
entries.Add("Stop me", 11);
entries.Add("Feed me", 12);
entries.Add("Walk me", 13);
Then I would access the values so:
int value = entries["Stop me"];
How do I do this in Java? I've seen examples with ArrayList
, but I'd like the solution with generics, if possible.