code: public static List<Partition> sortPartitions(List<Partition> partitions) {
      Collections.sort(partitions, new Comparator<Partition>() {
        @Override
        public int compare(Partition o1, Partition o2) {
          return o1.getCompleteName().compareTo(o2.getCompleteName());
        }
      });
      return partitions;
    }
docs: Sort all partitions inplace on the basis of complete name ie dbName.tableName.partitionName