Method of Collections class for sorting List elements | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
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 ответов
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