Pageable in spring for paging on List<Object> is not working

前端 未结 2 870
暗喜
暗喜 2021-01-29 13:45

I have a list of object which contain 10000 records i am trying to split that records in each of 10,

But somehow it is not working.. can someone have a look



        
2条回答
  •  难免孤独
    2021-01-29 14:41

    We can use PagedListHolder which can change the list in pages and we can than fetch a page by setting it's page size and page.

    PagedListHolder page = new PagedListHolder(admin_viewapplicationpage);
          page.setPageSize(50); // number of items per page
          page.setPage(0);      // set to first page
    
          int totalPages = page.getPageCount(); //  gives the totalpages according to the main list
          
          List admin_viewapplication = page.getPageList();  // a List which represents the current page which is the sublist
          
    
        

    提交回复
    热议问题