code: public static <T extends Comparable<? super T>> void sortIfNotEmpty(final List<T> list) {
          if (!list.isEmpty()) {
              Collections.sort(list);
          }
      }
docs: Sort a collection if it is not empty (to prevent {@link ConcurrentModificationException} if an immutable
  empty list that has been returned more than once is being sorted in one thread and iterated through in
  another thread -- #334).
  
  @param <T>
  the element type
  @param list
  the list