After reading the Oracle docs I did not found what I am looking for. I have an object that it can be compared in different ways, but one of its attributes is a List. How can I compare based on the size of the that List attribute?
Comparator comparator = Comparator.comparing(Product::getCommentList::size);
List<Product> soldL = new LinkedList();
soldL.addAll(sold);
Collections.sort(soldL,comparator);
I tried the code above without success.