Top Description Fields Constructors Methods
org.codehaus.commons.compiler.util.iterator

public Class IteratorCollection<T>

extends AbstractCollection<T>
Class Inheritance
Type Parameters
<T>
The element type of the iterator and the collection
Imports
java.util.AbstractCollection, .ArrayList, .Iterator, .List, org.codehaus.commons.nullanalysis.Nullable

A java.util.Collection that lazily reads its elements from an java.util.Iterator.

In other words, you can call iterator() as often as you want, but the IteratorCollection will iterate over its delegate only once.

Field Summary

Modifier and TypeField and Description
private final List<T>
elements

Lazily-filled collection of the elements delivered by the delegate.

private final Iterator<T>
iterator

The delegate.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Iterator<T>
iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Collection.iterator.

Returns an iterator over the elements contained in this collection.
public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Collection.size.

Returns the number of elements in this collection.
Inherited from java.util.AbstractCollection:
addaddAllclearcontainscontainsAllisEmptyremoveremoveAllretainAlltoArraytoArraytoString

Field Detail

elementsback to summary
private final List<T> elements

Lazily-filled collection of the elements delivered by the delegate.

iteratorback to summary
private final Iterator<T> iterator

The delegate.

Constructor Detail

IteratorCollectionback to summary
public IteratorCollection(Iterator<T> iterator)

Method Detail

iteratorback to summary
public Iterator<T> iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Collection.iterator.

Doc from java.util.AbstractCollection.iterator.

Returns an iterator over the elements contained in this collection.

Returns:Iterator<T>

an iterator over the elements contained in this collection

Annotations
@Override
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Collection.size.

Doc from java.util.Collection.size.

Returns the number of elements in this collection. If this collection contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this collection

Annotations
@Override