Yeah. Not worth it for this instance. If it would be something different, it might be worth exploring.
Type: Posts; User: ober0330
Yeah. Not worth it for this instance. If it would be something different, it might be worth exploring.
Well yeah, so maybe what I'm looking for is a map that is extended for this purpose.
You'd get a error if you tried to pass in a non-string... not sure what you're getting at?
Take the new value, add it to the existing value for the provided key.
Well yeah, I understand how the map works. I guess what I want is:
mymap.add("key", value);
And that doesn't seem to exist. And I guess it makes sense that it wouldn't be there by default...
Well, it obviously has many methods, but it doesn't seem to have another method for adding a value to an existing key. I guess I could use put to add the existing value of that key to the new value...
Nevermind. I think I'm over-complicating it because now I have to check to see if the key exists or not... gah. Not worth it.
So I have a map:
Map<String, Integer> totals = new LinkedHashMap<String, Integer>();
I'm going to have about 6 running totals and I figured rather than creating 6 different variables, why not...