|
 |
Tuesday, March 16, 2004 |
My Findings on HashMaps:
- A Map is one type of Collection in Java. Collections are used to hold a bunch of objects. Different Collections let you look up your objects in different ways.
- The special thing about Maps is that the way you look up your objects in a Map is with another object.
- A Map is like an associative array in PHP. It is a container for key - value pairs.
- To get values out of a Map, you iterate through the Map's keys and use the get() method to get the value associated with that key back out.
- Map is the interface, Hashmap or TreeMap is the implementation of that interface, just like ArrayList is an implementation of List. So, to make a new HashMap, you would say Map myHashMap = new HashMap();
- A HashMap uses the hashCode() method available to all Java objects to take the hashCode of your object so that it can quickly find it when you want it.
- with a HashMap, your objects will not be sorted the way you expect
- with a TreeMap, the objects are sorted in a way that makes sense.
12:20:32 PM
|
|
© Copyright 2004 mcgyver5.
|
|
|
|
March 2004 |
Sun |
Mon |
Tue |
Wed |
Thu |
Fri |
Sat |
|
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
|
|
|
Feb Apr |
|
|