How do you create a multi-dimensional List?

John Zukowski

Since the elements of a List are objects, in order to make the List multi-dimensional, each object in the outer list needs to be a List, too. For instance, ...

List list = new ArrayList(10);
for (int i=0; i<10; i++) {
  list.set(i, new LinkedList());
Then just fill up each inner list with items.
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact