Top Fields Constructors Methods
com.mchange.v1.util

public final Class IteratorUtils

extends Object
Class Inheritance
Imports
java.util.*, java.lang.reflect.Array

Field Summary

Modifier and TypeField and Description
public static final Iterator<E>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static boolean
public static void
fillArray(Iterator<E> ii, Object[] fillMe, boolean
iff there is extra space in the array, set the element immediately after the last from the iterator to null.
null_terminate
)

Fills an array with the contents of an iterator.

public static void
fillArray(Iterator<E> ii, Object[] fillMe)

public static Iterator<E>
public static Object[]
toArray(Iterator<E> ii, int array_size, Class<T> componentClass, boolean
iff there is extra space in the array, set the element immediately after the last from the iterator to null.
null_terminate
)

public static Object[]
toArray(Iterator<E> ii, int array_size, Class<T> componentClass)

public static Object[]
toArray(Iterator<E> ii, int ii_size, Object[] maybeFillMe)

Designed to help implement Collection.toArray(Object[] )methods...

public static ArrayList<E>
toArrayList(Iterator<E> ii, int initial_capacity)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTY_ITERATORback to summary
public static final Iterator<E> EMPTY_ITERATOR

Constructor Detail

IteratorUtilsback to summary
private IteratorUtils()

Method Detail

equivalentback to summary
public static boolean equivalent(Iterator<E> ii, Iterator<E> jj)
fillArrayback to summary
public static void fillArray(Iterator<E> ii, Object[] fillMe, boolean null_terminate)

Fills an array with the contents of an iterator. If the array is too small, it will contain the first portion of the iterator. If the array can contain more elements than the iterator, extra elements are left untouched, unless null_terminate is set to true, in which case the element immediately following the last from the iterator is set to null. (This method is intended to make it easy to implement Collection.toArray(Object[] oo) methods...

Parameters
null_terminate:boolean

iff there is extra space in the array, set the element immediately after the last from the iterator to null.

fillArrayback to summary
public static void fillArray(Iterator<E> ii, Object[] fillMe)
oneElementUnmodifiableIteratorback to summary
public static Iterator<E> oneElementUnmodifiableIterator(final Object elem)
toArrayback to summary
public static Object[] toArray(Iterator<E> ii, int array_size, Class<T> componentClass, boolean null_terminate)
Parameters
null_terminate:boolean

iff there is extra space in the array, set the element immediately after the last from the iterator to null.

toArrayback to summary
public static Object[] toArray(Iterator<E> ii, int array_size, Class<T> componentClass)
toArrayback to summary
public static Object[] toArray(Iterator<E> ii, int ii_size, Object[] maybeFillMe)

Designed to help implement Collection.toArray(Object[] )methods... does the right thing if you can express an iterator and know the size of your Collection.

toArrayListback to summary
public static ArrayList<E> toArrayList(Iterator<E> ii, int initial_capacity)