java in subList snapshot object list is selected, and does not change the value of the original object List, and thus the need for assignment.
Method parameters:
List <E> the subList ( int fromIndex, int toIndex); // a parameter: set of index elements, two parameters: the first few elements. . .
/ * E.g. list.subList (0,2) is the index starts from 0, take the second element, the result is an element index of 0,1 * /
Paging algorithm:
the try { list.subList (the pageSize * (-pageNum. 1), the pageSize * pageNum); // start with an index 0, i.e. find the 10 0-9 } the catch (an IndexOutOfBoundsException E) { list.subList (the pageSize * (pageNum -1 ), list.size ()); // the array bounds exception, take the last element }
Lazy Loading in:
try { list=list.subList(0,pageSize*pageNum); } catch (IndexOutOfBoundsException e) { list=list.subList(0,list.size()); }