I have a problem with a multiple ArrayList of waypoints.
I have one ship.
A ship has waypoints.
public static ArrayList<Waypoint> _waypoints = new ArrayList<>();
To add a new waypoint I use
Screen._waypoints.add(
new Waypoint(
12,20
)
);
Screen._waypoints.add(
new Waypoint(
15,50
)
);
Screen._waypoints.add(
new Waypoint(
17,90
)
);
That means:
- Ship -> 12,20
- Ship -> 15,50
- Ship -> 17,90
I have modified my game and I have added ship types that means every type of ship has a different waypoints.
I modified the waypoints initialization.
public static ArrayList<ArrayList<Waypoint>> _waypoints = new ArrayList<ArrayList<Waypoint>>();
I want to create this structure:
Ship -> Wood -> Array list of waypoints
For example I have two types of ship -> Wood and Pirate ship.
Ship -> Wood
- Ship -> 12,20
- Ship -> 15,50
- Ship -> 17,90
Ship -> Pirate
- Ship -> 12,20
- Ship -> 15,50
- Ship -> 17,90
To get the arrayList of the wood I want to use this:
waypoints.get("wood");
I don't know how to realize it using a two dimensional arrayList of arrayList
Thanks,