June 2018
Beginner
722 pages
18h 47m
English
The Map interface itself is not related to the Collection interface directly, but it uses the Set interface for its keys and Collection for its values. For example, for Map<Integer, String> map:
Each value is stored in a map with a unique key that is passed in along with the value when added to the map. In the case of Map<Integer, String> map:
map.put(42, "whatever"); //42 is the key for the value "whatever"
Then later, the value can be retrieved by its key:
String v = map.get(42);System.out.println(v); //prints: whatever
These are the basic map operations that convey the Map interface's purpose – to provide a storage ...
Read now
Unlock full access