Java Iterator copyIterator(Iterable iterable)

Here you can find the source of copyIterator(Iterable iterable)

Description

copy Iterator

License

Open Source License

Declaration

public static <T> List<T> copyIterator(Iterable<T> iterable) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static <T> List<T> copyIterator(Iterable<T> iterable) {
        Iterator<T> iterator = iterable.iterator();
        List<T> copy = new ArrayList<T>();
        while (iterator.hasNext())
            copy.add(iterator.next());//www  .  j  ava 2  s.co  m
        return copy;
    }
}

Related

  1. contains(Iterator iterator, Object element)
  2. contains(Iterator iterator, String value)
  3. convertToArray(Iterator iter)
  4. convertToList(Iterator iter)
  5. copy(Iterator iterator)
  6. copyIterator(Iterator iter)
  7. copyOf(Iterator elements)
  8. count(Iterator thingsToCount)
  9. countIterator(Iterator it)