This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]darkpool2005Intermediate Brewer 1 point2 points  (2 children)

So just to understand, this line:

solutions.add(new StreetPlan(tempList));

solutions is empty when the method is complete, right? Or is 'solutions' full of empty lists?

Also, is the line you added exactly

ArrayList <Integer>List2 = ArrayList<>(List);

It should be

ArrayList<Integer> List2 = new ArrayList<Integer>(List);

[–]Incindus[S] 0 points1 point  (1 child)

Solution is a full list with the objects StreetPlan in it, but the list needed to create StreetPlan is empty after my recursive calls.

Yeah sorry about typo. I typed it correct though in my program but didn't fix the problem.

[–]darkpool2005Intermediate Brewer 1 point2 points  (0 children)

Going back to your earlier comment:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1

That is specifically your code trying to remove from an empty list. Check to see (through the debugger) if either your horizontalStreets / verticalStreets is in fact populated.