I have a list say its has 25 rows. My page count will be always 5 and i ll be passing the pageId to the list so that i can get only those 5 rows which belongs to that page id (say if my pageId is 2 i need rows from 6-10).. Any simple method to do this???
List<Employee> empList= (List<Employee>)employeeHelper.fetchallData();
This emplist will have all the rows.
I am not sure I understand, but it seems you are looking for a sublist of
emplist.You can use the method
List.subList(int fromIndex, int toIndex)for it.From the javadocs:
To get the elements 5-10 (inclusive, count start at 1) in the 2nd doc:
emplist.subList(25 * (2-1) + (5-1), 25 * (2-1) + 10)