private void setup ( Collection < T > items , int ps , Comparator < T > sort ) { Collection < T > list ; Iterator < T > it ; if ( sort == null ) { list = items ; } else { list = new TreeSet < T > ( sort ) ; list . addAll ( items ) ; } sorter = sort ; pageSize = ps ; pages = new ArrayList < Collection < T > > ( ) ; it = list . iterator ( ) ; while ( it . hasNext ( ) ) { ArrayList < T > page = new ArrayList < T > ( ) ; pages . add ( page ) ; for ( int i = 0 ; i < ps ; i ++ ) { T ob ; if ( ! it . hasNext ( ) ) { break ; } ob = it . next ( ) ; page . add ( ob ) ; } } }
Sets the collection up using the specified parameters .