/*
 * Copyright (c) 2015 Legend Zero LLC
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package com.legendzero.lzlib.util;

import java.util.List;

public final class Pagination {
    
    private Pagination() {}
    
    public static int getPages(List<?> objects, int items) {
        return (objects.size() + (items - 1)) / items;
    }
    
    public static <T> List<T> paginate(List<T> objects, int page, int items) {
        int min = page * items;
        int max = Math.min(min + items, objects.size());
        return objects.subList(min, max);
    }
}

@@ -1150,16 +1150,57 @@
 .util;%0A%0A
+import com.google.common.collect.Lists;%0A%0A
 import j
@@ -1214,16 +1214,16 @@
 l.List;%0A
-
 %0Apublic 
@@ -1284,140 +1284,9 @@
  %7B%7D%0A
-    %0A    public static int getPages(List%3C?%3E objects, int items) %7B%0A        return (objects.size() + (items - 1)) / items;%0A    %7D%0A    
 %0A
+
     
@@ -1495,12 +1495,440 @@
 x);%0A
-
     %7D%0A
+    %0A    public static %3CT%3E List%3CList%3CT%3E%3E paginateAll(List%3CT%3E objects, int items) %7B%0A        List%3CList%3CT%3E%3E pages = Lists.newArrayList();%0A        for (int i = 0; i %3C getTotalPages(objects, items); i++) %7B%0A            pages.add(paginate(objects, i, items));%0A        %7D%0A        return pages;%0A    %7D%0A    %0A    public static int getTotalPages(List%3C?%3E objects, int items) %7B%0A        return (objects.size() + (items - 1)) / items;%0A    %7D%0A    %0A
 %7D%0A

Add getAllPages utility to Pagination. Reorder pagination methods.