Skip to content
Advertisement

sort an arraylist of arraylist of integers

I am looking to sort an arraylist of arraylist of integers and I require help?

I was informed that I need to implement comparator or comparable and then use the collection.sort to sort the list of list in order…

JavaScript

Advertisement

Answer

No error check for null lists, but here it is.

JavaScript

With Java 8 it gets even more concise:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement