Answer the question
In order to leave comments, you need to log in
What's wrong with nested arrays?
Hello everyone
Tell me, what could be wrong with such a design?
ArrayList<ArrayList<Integer>> list = new ArrayList<ArrayList<Integer>>(10);
Answer the question
In order to leave comments, you need to log in
Where are the arrays?
If you mean ArrayList then it's not an array. If the ones inside the ArrayList is another matter.
In addition to a "tight" binding to a specific implementation of List through ArrayList, I don’t see anything bad.
But in principle, depending on the case, binding to a specific implementation can be beneficial and necessary.
As for me, this option is better.
final List<List<Integer>> list = new ArrayList<>(10);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question