Java Iterator dump(Iterator it)

Here you can find the source of dump(Iterator it)

Description

dump

License

Open Source License

Declaration

public static <T> Iterator<T> dump(Iterator<T> it) 

Method Source Code


//package com.java2s;
/*//from w w w.  ja  va2s  . co  m
 * Copyright (c) 2015 Eike Stepper (Berlin, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eike Stepper - initial API and implementation
 */

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Main {
    public static <T> Iterator<T> dump(Iterator<T> it) {
        List<T> list = new ArrayList<T>();
        while (it.hasNext()) {
            list.add(it.next());
        }

        System.out.println(list);
        return list.iterator();
    }
}

Related

  1. count(Iterator thingsToCount)
  2. countIterator(Iterator it)
  3. createMap(Iterator iter)
  4. createPathIterator(String path)
  5. createSkipIterator(Iterable source, int count)
  6. endOfData(Iterator inputIter, Iterator resultIter)
  7. equalsIterator(Iterator it, Iterator it2)
  8. fill(final Iterator iterator, final S collection)
  9. fillArray(Iterator ii, Object[] fillMe, boolean null_terminate)