seawork seawork - 1 year ago 55
Java Question

Map<String, Integer> foo - how do I get the value of the integer - JAVA

I have a method:

public void updateBoard (Map<String, Integer> foo)

How do I find out the value of the Integer? I'm trying foo.get() but it just gives me the key.


Answer Source

You get all Integer values of the Map with:


Because a Map is a key->value construct.



you get all keys.

And with


you get the appropriate value for the key key1.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download