code: public static <C extends Comparable> Ordering<Range<C>> orderingByUpperEndpoint() {
          return new Ordering<Range<C>>() {
              @Override
              public int compare(final Range<C> left, final Range<C> right) {
                  return ComparisonChain.start()
                      .compare(left.hasUpperBound(), right.hasUpperBound())
                      .compare(left.upperEndpoint(), right.upperEndpoint())
                      .result();
              }
          };
      }
docs: Return an ordering by upper endpoint over ranges.
  
  @param <C> range endpoint type
  @return an ordering by upper endpoint over ranges