Method of Collections class for sorting List elements | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Method of Collections class for sorting List elements

I have a List which contains multiple Map elements like this: List<Map<String,String>> List. Each Map has only 4 key corresponding to their values like this: Map<Supplier, A>, Map<Color, Red>, Map<Priority, 10>, Map<Price, 38>. How do I sort my List by Price in java.

30th Oct 2017, 9:18 AM
AgnĆØs Lee
2 Respostas
0
I've solved my problem. Remember that Map may encounter nullPointerException, so we should make sure Map is not null.
2nd Nov 2017, 3:02 PM
AgnĆØs Lee