protected List<T> getBatchChunk(List<T> list, int batchSize, int chunkNumber) {
        if (list == null || list.isEmpty()) {
            return null;
        }

        final int start = chunkNumber * batchSize;
        final int end = Math.min(start + batchSize, list.size());
        if (start >= end) {
            return null;
        }
        return list.subList(start, end);
    }
protected List < T > getBatchChunk ( List < T > list , int batchSize , int chunkNumber ) { if ( list == null || list . isEmpty ( ) ) { return null ; } final int start = chunkNumber * batchSize ; final int end = Math . min ( start + batchSize , list . size ( ) ) ; if ( start >= end ) { return null ; } return list . subList ( start , end ) ; }
Used to partition the list to chunks.

@param list        to be paged.
@param batchSize   batch operation size.
@param chunkNumber batch chunk number.
@return sub-list of list if any or null.