static <U extends Pair<Long, Double>> Bucket<U> of(List<U> us) {
    U first = us.get(0);
    U last = us.get(us.size() - 1);
    Pair<Long, Double> center = centerBetween(first, last);
    return new Bucket<>(us, first, last, center, first);
  }
this class is copied and modified from <a
href="https://github.com/ggalmazor/lt_downsampling_java8">...</a> project
library-udf/src/main/java/org/apache/iotdb/library/dprofile/util/Bucket.java