How to sort a List<Object> alphabetically using Object name field

后端 未结 16 1495
暗喜
暗喜 2020-11-28 06:00

I have a List of Objects like List p.I want to sort this list alphabetically using Object name field. Object contains 10 field and name field is o
16条回答
  •  伪装坚强ぢ
    2020-11-28 06:15

    Try this:

    List< Object> myList = x.getName;
    myList.sort(Comparator.comparing(Object::getName));
    

提交回复
热议问题