You can use Comparator.comparing which makes comparators for any attributes which you want to compare. Check out the code below:
Comparator<Parent> byAttr1ofFirstChild = Comparator.comparing(
parent -> parent.getChildren().get(0).getAttr1()
);
Comparator<Parent> byAttr1ofFirstGrandChild = Comparator.comparing(
parent -> parent.getChildren().get(0).getGrandChildren().get(0).getAttr1()
);
List<Parent> sortedList = parents.stream()
.sorted(byAttr1ofFirstChild.thenComparing(byAttr1ofFirstGrandChild))
.collect(toList());
Comparator.comparing helps you use static imports to code efficiently :
Comparator<Parent> byFirst = comparing(Parent::getAttrib1, reverseOrder());
Comparator<Parent> bySecond = comparing(Parent::getAttrib2);
Interested in Java? Check out this Java tutorial by Intellipaat.