一行代码实现Steam流分页,优雅,实在是太优雅了()

    /**
     * 开始分页
     *
     * @param list
     * @param current  页码
     * @param size 每页大小
     * @return
     */
public class PageUtils {
    public static <T> List<T> startPage(List<T> list, Integer current, Integer size) {
        if (CollectionUtils.isEmpty(list)) {
            return list;
        }
        return list.stream().skip((current - 1) * size).limit(size).collect(Collectors.toList());
    }
}
        List<xxxEntity> pageList = PageUtils.startPage(entityList, current, size);
        Page<xxxEntity> page = new Page<>(current, size, entityList.size());
        page.setRecords(pageList);
————————
    /**
     * 开始分页
     *
     * @param list
     * @param current  页码
     * @param size 每页大小
     * @return
     */
public class PageUtils {
    public static <T> List<T> startPage(List<T> list, Integer current, Integer size) {
        if (CollectionUtils.isEmpty(list)) {
            return list;
        }
        return list.stream().skip((current - 1) * size).limit(size).collect(Collectors.toList());
    }
}
        List<xxxEntity> pageList = PageUtils.startPage(entityList, current, size);
        Page<xxxEntity> page = new Page<>(current, size, entityList.size());
        page.setRecords(pageList);