Stream分批處理數據
public static <T> Stream<List<T>> partitionStream(Collection<T> coll, int size) {
if (CollectionUtils.isEmpty(coll)) {
return Stream.empty();
}
return StreamSupport.stream(Iterables.partition(coll, size).spliterator(), false);
}