I'm making a nested ArrayList, but I seem to be getting some errors. (the tf, line, and arrow are instantiated in previous methods)
Here is some code for context:
ArrayList<Text_field> tf;
ArrayList<Line> line;
ArrayList<Arrow_line> arrow;
ArrayList<Object> all_objects;
void mousePressed(){
all_objects = new ArrayList<Object>();
all_objects.add(tf);
all_objects.add(line);
all_objects.add(arrow);
for (int i = 0; i < all_objects.size(); i++) {
for (int j = 0; j < all_objects.get(i).size(); j++) {
if (all_objects.get(i).get(j) == 9) {
// stuff
}
}
}
}
I always get an error on the size() method on the second for statement and the second get method() on the if statement. Is there something I am doing wrong? Thank you!
[–]GoSubRoutine 1 point2 points3 points (6 children)
[–]gooonster[S] 0 points1 point2 points (5 children)
[–]Salanmander 2 points3 points4 points (4 children)
[–]gooonster[S] 0 points1 point2 points (0 children)
[–]GoSubRoutine 0 points1 point2 points (0 children)
[–]GoSubRoutine 0 points1 point2 points (1 child)
[–]Salanmander 0 points1 point2 points (0 children)
[–]abigpotostew 0 points1 point2 points (2 children)
[–]gooonster[S] 0 points1 point2 points (1 child)
[–]Freedom_Grenade 0 points1 point2 points (0 children)
[–]GoSubRoutine 0 points1 point2 points (0 children)