Android: 2-dimensional List String (List of List)

For a web developer who used mostly PHP and JavaScript for several years, plunging into Java can be challenging especially when it comes to data types.

PHP and JavaScript are loosely typed languages, while Java is strict about types.

I was told that in Android, List<String> is very commonly used, even more than arrays. And now I’ve come to the point when I need to use a 2-dimensional List<String>.

Here’s a sample code:

Output of System.outprintln(Arrays.deepToString(ls.toArray())); is this:

The output of Log.d("serialized", listOfList.toString()); is this:

Catzie

A Filipino who is a mobile & web developer on weekdays, and a baker on weekends. When I have time to spare, I blog, play video games, watch series (usually anime), cook dishes, draw, or spend a little time with pets. I also like traveling and recording song covers, but I only do so occasionally. Follow on Twitter: @catzie

Leave a Reply

Your email address will not be published. Required fields are marked *