What is the cleanest short way to get this done ?
class AnObject{ Long attr; } List list;
I know it can be done
Assuming you actually have a List, all you need is
List
list.sort(Comparator.comparing(a -> a.attr));
If you make you code clean by not using public fields, but accessor methods, it becomes even cleaner:
list.sort(Comparator.comparing(AnObject::getAttr));