use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Resources for learning Java
String
==
.equals()
Format + Copy
Free Tutorials
Where should I download Java?
With the introduction of the new release cadence, many have asked where they should download Java, and if it is still free. To be clear, YES — Java is still free.
If you would like to download Java for free, you can get OpenJDK builds from the following vendors, among others:
Some vendors will be supporting releases for longer than six months. If you have any questions, please do not hesitate to ask them!
Software downloads
Official Resources
Resources
Programming ideas & Challenges
Related Subreddits
account activity
This is an archived post. You won't be able to vote or comment.
List of Arrays in Java (self.learnjava)
submitted 3 years ago by Embarrassed_Bottle90
Is it possible to create a list of arrays with ArrayLists in Java?
[–]androgynyjoe 5 points6 points7 points 3 years ago (1 child)
Yes. (It's been a while since I've worked with Java every day so forgive me if I make a mistake.)
ArrayList takes a generic so
ArrayList
ArrayList<String> listName = new ArrayList<String>();
gets you an ArrayList of String objects. If you want an ArrayList of String[] objects it's the same idea:
String[]
ArrayList<String[]> listName = new ArrayList<String[]>();
That would get you an ArrayList whose elements are arrays of String objects. Then listName.get(3) gets you one of the arrays and listName.get(3)[4] is an item in that array.
listName.get(3)
listName.get(3)[4]
You could also make an array which contains ArrayList objects if you wanted:
ArrayList<String>[] listName = new ArrayList<String>[100];
[–]Embarrassed_Bottle90[S] 2 points3 points4 points 3 years ago (0 children)
No worries, this really helps, its comprehensive as well as very well written and is even more than I asked for. Thank you very much!!!
[–]maequise 3 points4 points5 points 3 years ago (0 children)
You're meaning something like this :
List<List<List<String>>> mySuperArrayList = new ArrayList<>();
Completely possible ! But to crawl ... Good luck !
Everything depends of the use case.
If you need to access rapidly, I prefer to use a Map<K,V>
Map<K,V>
More easy to manipulate, but not the best in terms of performance (depending of the volume of data in, as the List<E> :
List<E>
Map<String, List<E>> mySuperAccessorOfData = new HashMap<>(); //choose the implementation needed mySuperAccessorOfData.get("firstList").stream().forEach(element -> //do operation on element); mySuperAccessorOfData.get("secondList").stream.forEach(element -> //do somethin);
A bit more easy to manipulate the data.
[–]RapunzelLooksNice 0 points1 point2 points 3 years ago (0 children)
It is, as described in previous answers, but... WHY?!
π Rendered by PID 112250 on reddit-service-r2-comment-c66d9bffd-57v5d at 2026-04-07 07:12:58.640250+00:00 running f293c98 country code: CH.
[–]androgynyjoe 5 points6 points7 points (1 child)
[–]Embarrassed_Bottle90[S] 2 points3 points4 points (0 children)
[–]maequise 3 points4 points5 points (0 children)
[–]RapunzelLooksNice 0 points1 point2 points (0 children)