class TribeInfo { String name; int fierceness; String planet; public TribeInfo (String name, int fierceness, String planet) { this.name = name; this.fierceness = fierceness; this.planet = planet; } } //end-TribeInfo public class LinkedListMapExample { public static void main (String[] argv) { // Create an instance. OurLinkedListMap map = new OurLinkedListMap (); // Put some key-value pairs inside. TribeInfo info = new TribeInfo ("Ewok", 3, "Endor"); KeyValuePair kvp = new KeyValuePair ("Ewok", info); map.set (kvp); info = new TribeInfo ("Aqualish", 6, "Ando"); kvp = new KeyValuePair (info.name, info); map.set (kvp); // This is more compact: create the instance in the method argument list. info = new TribeInfo ("Gungan", 2, "Naboo"); map.set ( new KeyValuePair (info.name, info) ); info = new TribeInfo ("Amanin", 8, "Maridun"); map.set ( new KeyValuePair (info.name, info) ); info = new TribeInfo ("Jawa", 6, "Tatooine"); map.set ( new KeyValuePair (info.name, info) ); info = new TribeInfo ("Hutt", 7, "Varl"); map.set ( new KeyValuePair (info.name, info) ); // A little harder to read, but even more compact: map.set ( new KeyValuePair ("Cerean", new TribeInfo ("Cerean", 4, "Cerea") ) ); KeyValuePair kvpResult = map.get ("Hutt"); System.out.println ("Info for Hutt: " + kvpResult); } }