Java Iterator asArray(T[] arr, Iterator itr)

Here you can find the source of asArray(T[] arr, Iterator itr)

Description

as Array

License

Open Source License

Declaration

public static <T> T[] asArray(T[] arr, Iterator<T> itr) 

Method Source Code

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

import java.util.*;

public class Main {
    public static <T> T[] asArray(T[] arr, Iterator<T> itr) {
        ArrayList<T> lst = new ArrayList<T>();
        while (itr.hasNext()) {
            lst.add(itr.next());/*w ww  .  j av a 2s  .c  o m*/
        }
        Class tclass = arr.getClass().getComponentType();
        return lst.toArray(arr);
    }
}

Related

  1. addAllToSet(Set set, Iterator it)
  2. addTo(final Iterator iter, final C c)
  3. appendTo(final Iterator iter, final List list)
  4. areEqual(final Iterator a, final Iterator b)
  5. areEqual(final Iterator ittyA, final Iterator ittyB)
  6. asList(final Iterator iterator)
  7. asList(Iterator it)
  8. asStringOn(StringBuffer sb, Iterator iter, String separator)
  9. cast(Iterator p)