|
@ -1,6 +1,7 @@
|
1
|
1
|
package org.jfw.util;
|
2
|
2
|
|
3
|
3
|
import java.util.Collections;
|
|
4
|
import java.util.LinkedList;
|
4
|
5
|
import java.util.List;
|
5
|
6
|
|
6
|
7
|
public class PageQueryResult<T> {
|
|
@ -65,13 +66,17 @@ public class PageQueryResult<T> {
|
65
|
66
|
}
|
66
|
67
|
ret.setPageNo(pageNo);
|
67
|
68
|
ret.setPageSize(pageSize);
|
68
|
|
int begin = pageNo * pageSize - pageNo;
|
|
69
|
int begin = pageNo * pageSize - pageSize;
|
69
|
70
|
ret.setData(list.subList(begin,Math.min(list.size(), begin + pageSize)));
|
70
|
71
|
}
|
71
|
72
|
return ret;
|
72
|
73
|
}
|
73
|
74
|
|
74
|
75
|
public static void main(String[] args) {
|
|
76
|
List<String> list = new LinkedList<String>();
|
|
77
|
for(int i = 0 ; i < 14;++i) list.add("a");
|
|
78
|
PageQueryResult.build(list,10,2);
|
|
79
|
|
75
|
80
|
new PageQueryResult<String>().setData(Collections.<String> emptyList());
|
76
|
81
|
|
77
|
82
|
}
|