I am currently a student in AP Computer Science trying to write a program that makes Applets much easier to make. My teacher loves applets, and me and my classmates detest them. To do so, the best way that I can think of saving coordinates is through ArrayLists in Arraylists in HashMaps. However, I can't seem to get this to work.
The reason I need a ArrayList in an ArrayList is because when you make a polygon, the parameters include two arrays - one for the x coordinates, and one for the y coordinates. These two would originally be ArrayLists. Those ArrayLists need to be stored into an ArrayList that contains all of the paramters, which is stored in a HashMap that stores all of the polygons.
Lets take this example:
HashMap<String, ArrayList<Object>> polygons= new HashMap<String, ArrayList<Object>>();
polygons.put("Polygon 1", new ArrayList<Object>());
polygons.get("Polygon 1").add(new ArrayList<Integer>());
This gives me a runtime error if I were to try to read any of the ArrayLists, and I get a compile time error if I try adding something to the innermost ArrayList.
Am I going about this in the wrong way? Is there 1. a better way to do this, or 2. a way to make this way work?