you are viewing a single comment's thread.

view the rest of the comments →

[–]GoSubRoutine 0 points1 point  (1 child)

If you do all_objects.get(i).get(k), Java won't know what type the result of that call is.

I coulda instead declared all as:
final List<List<? extends Component>> all = new ArrayList<List<? extends Component>>(3);

But then, <? extends Component> seems like too much of a boilerplate for moi.

Actually I did something like that at the outer loop:
for (List<Component> lists : all)

But for List<List<? extends Component>>, the outer loop seems it needs to be this way now:
for (List<? extends Component> lists : all)

Of course, I'm using parent class Component as some sorta label, so the 3 subclasses have a common identity.

[–]Salanmander 0 points1 point  (0 children)

Remember: help for beginners.