``JAVA
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import java.util.List;
public class PageTest {
public static Page listConvertToPage(List list, Pageable pageable) {
int start = (int)pageable.getOffset();
int end = (start + pageable.getPageSize()) > list.size() ? list.size() : ( start + pageable.getPageSize());
return new PageImpl(list.subList(start, end), pageable, list.size());
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)