So, for instance:
Code: Select all
Map<String, List<GeometricShape>> shapeMap = new HashMap<String, List<GeometricShape>>();
List<GeometricShape> circleList = new List<GeometricShape>();
Circle c1 = new Circle(); //pretend this constructor makes a random cricle, you can do something different in your code if you want.
Circle c2 = new Circle();
cricleList.add(c1); //this works because your Circle will extend GeometricShape
circleList.add(c2);
shapeMap.put("Circles", circleList);
Code: Select all
List<GeometricShape> currentList = shapeMap.get("Circles");
and then loop through that list and render each circle.
-Angus