private void setCurrentPage ( int page ) { if ( page >= totalPages ) { this . currentPage = totalPages ; } else if ( page <= 1 ) { this . currentPage = 1 ; } else { this . currentPage = page ; } // now work out where the sub-list should start and end startingIndex = pageSize * ( currentPage - 1 ) ; if ( startingIndex < 0 ) { startingIndex = 0 ; } endingIndex = startingIndex + pageSize ; if ( endingIndex > list . size ( ) ) { endingIndex = list . size ( ) ; } }
Specifies a specific page to jump to .