public static < X > ArrayList < X > sublist ( List < X > list , int start , int end ) { ArrayList < X > sublist = new ArrayList < X > ( ) ; for ( int i = start ; i < end ; i ++ ) { sublist . add ( list . get ( i ) ) ; } return sublist ; }
Creates a new list containing a slice of the original list .