public List < T > page ( int pageNumber ) { if ( pageNumber > totalPages && pageNumber > kaminariNextPage ) { throw new NoSuchElementException ( ) ; } else if ( pageNumber < 1 ) { throw new NoSuchElementException ( ) ; } if ( currentPage == 0 && pageNumber == 1 ) { currentPage = 1 ; return ( currentItems ) ; } if ( currentPage == pageNumber ) { return ( currentItems ) ; } try { setPageParam ( pageNumber ) ; Response response = api . get ( Response . Status . OK , queryParams , pathArgs ) ; currentItems = mapper . readValue ( ( InputStream ) response . getEntity ( ) , javaType ) ; currentPage = pageNumber ; if ( kaminariNextPage > 0 ) { kaminariNextPage = getIntHeaderValue ( response , NEXT_PAGE_HEADER ) ; } return ( currentItems ) ; } catch ( GitLabApiException | IOException e ) { throw new RuntimeException ( e ) ; } }
Returns the specified page of List .