[Solved] how sort in java8 list of lists of object by multiple properties [duplicate]


Just use comparator, an example of sorting by firstName then by lastName

list.forEach(l -> l.sort(Comparator.comparing(CsvEntity::getFirstName)
                               .thenComparing(CsvEntity::getLastName)));

Of course you have to have getters for your fields to use method reference

solved how sort in java8 list of lists of object by multiple properties [duplicate]