Technology : General Technology Notes: Diary of a late,late adopter.
Updated: 4/4/2004; 7:43:40 AM.

 

Frequent Visits

Subscribe to "Technology" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.

 
 

Tuesday, March 16, 2004

My Findings on HashMaps:
  1. 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.
  2. The special thing about Maps is that the way you look up your objects in a Map is with another object.
  3. A Map is like an associative array in PHP. It is a container for key - value pairs.
  4. 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.
  5. 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();
  6. 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.
  7. with a HashMap, your objects will not be sorted the way you expect
  8. with a TreeMap, the objects are sorted in a way that makes sense.

12:20:32 PM    comment []

© Copyright 2004 mcgyver5.



Click here to visit the Radio UserLand website.

 


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