code: public static ComparatorItem fromSort(Sort sort) {
      if (sort == null) {
        return null;
      }
      ComparatorItem comparatorItem = null;
      for (Order order : sort) {
        ComparatorItem item = fromSortOrder(order);
        if (item != null) {
          if (comparatorItem == null) {
            comparatorItem = item;
          } else {
            comparatorItem.getLastComparatorItem().setNextComparatorItem(item);
          }
        }
      }
      return comparatorItem;
    }
docs: Transforms a {@code Sort} object into a comparator item.
  
  @param sort the {@code Sort} object
  @return the comparator item