Here you can find the source of getList(Iterator
Parameter | Description |
---|---|
iterator | a parameter |
public static List<String> getList(Iterator<String> iterator)
//package com.java2s; /*//from w w w. j av a2 s . c o m * The contents of this file are subject to the license and copyright * detailed in the LICENSE and NOTICE files at the root of the source * tree and available online at * * http://duracloud.org/license/ */ import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class Main { /** * Creates a list of all of the items in an iteration. * Be wary of using this for Iterations of very long lists. * * @param iterator * @return */ public static List<String> getList(Iterator<String> iterator) { List<String> contents = new ArrayList<String>(); while (iterator.hasNext()) { contents.add(iterator.next()); } return contents; } }