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
List p
Try this:
List< Object> myList = x.getName; myList.sort(Comparator.comparing(Object::getName));