1   package com.atlassian.user.search.page;
2   
3   import java.util.ArrayList;
4   import java.util.Collection;
5   import java.util.List;
6   
7   public final class Pagers
8   {
9       /**
10       * Creates a new instance of {@link DefaultPager} with the provided elements.
11       */
12      public static <T> DefaultPager<T> newDefaultPager(Iterable<? extends T> elements)
13      {
14          if (elements instanceof Collection)
15          {
16              return new DefaultPager<T>(new ArrayList<T>((Collection<? extends T>) elements));
17          }
18          List<T> list = new ArrayList<T>();
19          for (T element : elements)
20          {
21              list.add(element);
22          }
23          return new DefaultPager<T>(list);
24      }
25  }