import java.util.*; class PointMap { public static void main (String [] args) { Map myPoints = new Hashtable(); myPoints.put("BUBU", new Point(1.0,1.0)); // 1. einen Iterator auf das keySet erzeugen // Iterator it = myPoints.keySet().iterator(); // 2. Keys durchgehen und Elemente aus der Map holen // while(it.hasNext()) { // String aKey = it.next(); // JAVA 1.5 enthält for-each loops for (String aKey : myPoints.keySet()) { Point b = myPoints.get(aKey); System.out.println("Key: "+aKey +" Value: "+b); } } } class Point { double x,y; Point(double xi, double yi) { x=xi; y=yi; } public String toString() { return "Point("+x+","+y+")"; } }