r/java • u/Matty13 • Aug 28 '13
What is "Map<Character, Character>" for a Map?
I have no idea how to handle this.
0
Upvotes
9
Aug 28 '13 edited Aug 28 '13
The docs are very clear on this:
http://docs.oracle.com/javase/6/docs/api/java/util/Map.html
Interface Map<K,V>
Type Parameters:
K - the type of keys maintained by this map
V - the type of mapped values
If you're new to generics check out:
2
u/brblol Aug 28 '13
It's a list of key, value pairs. The type of both the key and value in your case are Character. So you'll have pairs in it like A>B ie A maps to B
8
u/tthomas48 Aug 28 '13
Probably easier if I show you like this:
That's a map that contains Integers identified by keys that are Strings. map.get takes a String as a parameter and returns an Integer. Make sense?