### Question:
Ordering implements Comparator<Object>, Serializable, XMLSerializable { @SuppressWarnings("unchecked") public static void orderList(List<?> objects, List<? extends Ordering> orderings) { if(objects == null || orderings == null || orderings.isEmpty()) { return; } Comparator<Object> comparator = orderings.get(0); for(int i=1; i<orderings.size(); i++) { comparator = comparator.thenComparing(orderings.get(i)); } objects.sort(comparator); } Ordering();  Ordering(String sortPathSpec);  Ordering(String sortPathSpec, SortOrder sortOrder);  Ordering(Expression sortSpec);  Ordering(Expression sortSpec, SortOrder sortOrder); @SuppressWarnings("unchecked") static void orderList(List<?> objects, List<? extends Ordering> orderings); static List<E> orderedList(final Collection<E> objects, List<? extends Ordering> orderings); @Override boolean equals(Object object); @Override int hashCode(); void setSortSpecString(String sortSpecString); void setNullSortedFirst(boolean nullSortedFirst); boolean isNullSortedFirst(); void setPathExceptionSupressed(boolean pathExceptionSuppressed); boolean isPathExceptionSuppressed(); String getSortSpecString(); void setSortOrder(SortOrder order); boolean isAscending(); boolean isDescending(); void setAscending(); void setDescending(); boolean isCaseInsensitive(); boolean isCaseSensitive(); void setCaseInsensitive(); void setCaseSensitive(); Expression getSortSpec(); void setSortSpec(Expression sortSpec); void orderList(List<?> objects); List<E> orderedList(Collection<E> objects); @Override int compare(Object o1, Object o2); @Override void encodeAsXML(XMLEncoder encoder, ConfigurationNodeVisitor delegate); @Override String toString(); SortOrder getSortOrder(); Orderings then(Ordering nextOrdering); Orderings then(Orderings nextOrderings); Orderings then(List<Ordering> nextOrderings);  }### Answer:
@Test public void testOrderList() { List<TstBean> list = new ArrayList<>(3); list.add(new TstBean(5)); list.add(new TstBean(2)); list.add(new TstBean(3)); new Ordering("integer", SortOrder.ASCENDING).orderList(list); assertEquals(2, list.get(0).getInteger().intValue()); assertEquals(3, list.get(1).getInteger().intValue()); assertEquals(5, list.get(2).getInteger().intValue()); }
@Test public void testOrderList_Static() { List<TstBean> list = new ArrayList<>(6); list.add(new TstBean("c", 1)); list.add(new TstBean("c", 30)); list.add(new TstBean("a", 5)); list.add(new TstBean("b", 1)); list.add(new TstBean("b", 2)); list.add(new TstBean("b", 5)); List<Ordering> orderings = asList( new Ordering("string", SortOrder.ASCENDING), new Ordering("integer", SortOrder.DESCENDING)); List<TstBean> orderedList = new ArrayList<>(list); Ordering.orderList(orderedList, orderings); assertEquals(list.get(2), orderedList.get(0)); assertEquals(list.get(5), orderedList.get(1)); assertEquals(list.get(4), orderedList.get(2)); assertEquals(list.get(3), orderedList.get(3)); assertEquals(list.get(1), orderedList.get(4)); assertEquals(list.get(0), orderedList.get(5)); }