private void dumpCurrent(List<List<T>> lists) {
    final List<T> batch = buffer.stream().limit(size).collect(toList());
    lists.add(batch);
  }
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/SlidingCollector.java