public static List < String > getList ( Iterator < String > iterator ) { List < String > contents = new ArrayList < String > ( ) ; while ( iterator . hasNext ( ) ) { contents . add ( iterator . next ( ) ) ; } return contents ; }
Creates a list of all of the items in an iteration . Be wary of using this for Iterations of very long lists .