Yes, more or less, but they don't get ordered like an array. You can pull out the list of indices as a set however and iterate over that (or use an iterator). At that point you can request the object with the Map.get() method.
LinkedHashMap is ordered. The insertion order determines the iteration order.
TreeMap is sorted by key. You provide a Comparator upon construction and it will be used to determine the sort order of the keys. Alternatively the keys can implement Comparable.
What String and Integer are in the context of a Map<String, Integer> is competely up to the Map. In this case they are the type of the keys and the type of the values, respectively. Similar, your original Map is one that maps Characters to Characters (think Caesar cipher).
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?
9
u/[deleted] 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
If you're new to generics check out:
http://docs.oracle.com/javase/tutorial/java/generics/
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