|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.commons.collections.IteratorUtils
Provides static utility methods and decorators for IteratorUtils.EmptyIterator instances. The implementations are provided in the org.apache.commons.collections.iterators subpackage.
| Nested Class Summary | |
(package private) static class |
IteratorUtils.EmptyIteratorEmptyIterator class |
(package private) static class |
IteratorUtils.EmptyListIteratorEmptyListIterator class |
| Field Summary | |
static java.util.Iterator |
EMPTY_ITERATORAn iterator over no elements |
static java.util.ListIterator |
EMPTY_LIST_ITERATORA list iterator over no elements |
| Constructor Summary | |
private |
IteratorUtils()Prevents instantiation. |
| Method Summary | |
static java.util.Iterator |
arrayIterator(java.lang.Object[] array)Gets an iterator over an array. |
static java.util.Iterator |
arrayIterator(java.lang.Object[] array, int start)Gets an iterator over the end part of an array. |
static java.util.Iterator |
arrayIterator(java.lang.Object[] array, int start, int end)Gets an iterator over part of an array. |
static java.util.Enumeration |
asEnumeration(java.util.Iterator iterator)Gets an enumeration that wraps an iterator. |
static java.util.Iterator |
asIterator(java.util.Enumeration enumeration)Gets an iterator that provides an iterator view of the given enumeration. |
static java.util.Iterator |
asIterator(java.util.Enumeration enumeration, java.util.Collection removeCollection)Gets an iterator that provides an iterator view of the given enumeration that will remove elements from the specified collection. |
static java.util.Iterator |
chainedIterator(java.util.Collection iterators)Gets an iterator that iterates through a collections of IteratorUtils.EmptyIterators one after another. |
static java.util.Iterator |
chainedIterator(java.util.Iterator[] iterators)Gets an iterator that iterates through an array of IteratorUtils.EmptyIterators one after another. |
static java.util.Iterator |
chainedIterator(java.util.Iterator iterator1, java.util.Iterator iterator2)Gets an iterator that iterates through two IteratorUtils.EmptyIterators one after another. |
static java.util.Iterator |
collatedIterator(java.util.Comparator comparator, java.util.Collection iterators)Gets an iterator that provides an ordered iteration over the elements contained in a collection of IteratorUtils.EmptyIterators. |
static java.util.Iterator |
collatedIterator(java.util.Comparator comparator, java.util.Iterator[] iterators)Gets an iterator that provides an ordered iteration over the elements contained in an array of IteratorUtils.EmptyIterators. |
static java.util.Iterator |
collatedIterator(java.util.Comparator comparator, java.util.Iterator iterator1, java.util.Iterator iterator2)Gets an iterator that provides an ordered iteration over the elements contained in a collection of ordered IteratorUtils.EmptyIterators. |
static java.util.Iterator |
emptyIterator()Gets an empty iterator. |
static java.util.ListIterator |
emptyListIterator()Gets an empty list iterator. |
static java.util.Iterator |
filteredIterator(java.util.Iterator iterator, Predicate predicate)Gets an iterator that filters another iterator. |
static java.util.ListIterator |
filteredListIterator(java.util.ListIterator listIterator, Predicate predicate)Gets a list iterator that filters another list iterator. |
static java.util.Iterator |
getIterator(java.lang.Object obj)Gets a suitable Iterator for the given object. |
static java.util.Iterator |
singletonIterator(java.lang.Object object)Gets a singleton iterator. |
static java.util.ListIterator |
singletonListIterator(java.lang.Object object)Gets a singleton list iterator. |
static java.lang.Object[] |
toArray(java.util.Iterator iterator)Gets an array based on an iterator. |
static java.lang.Object[] |
toArray(java.util.Iterator iterator, java.lang.Class arrayClass)Gets an array based on an iterator. |
static java.util.List |
toList(java.util.Iterator iterator)Gets a list based on an iterator. |
static java.util.List |
toList(java.util.Iterator iterator, int estimatedSize)Gets a list based on an iterator. |
static java.util.ListIterator |
toListIterator(java.util.Iterator iterator)Gets a list iterator based on a simple iterator. |
static java.util.Iterator |
transformedIterator(java.util.Iterator iterator, Transformer transform)Gets an iterator that transforms the elements of another iterator. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.util.Iterator EMPTY_ITERATOR
public static final java.util.ListIterator EMPTY_LIST_ITERATOR
| Constructor Detail |
private IteratorUtils()
| Method Detail |
public static java.util.Iterator emptyIterator()
This iterator is a valid iterator object that will iterate over nothing.
public static java.util.ListIterator emptyListIterator()
This iterator is a valid list iterator object that will iterate over nothing.
public static java.util.Iterator singletonIterator(java.lang.Object object)
This iterator is a valid iterator object that will iterate over the specified object.
object - the single object over which to iteratepublic static java.util.ListIterator singletonListIterator(java.lang.Object object)
This iterator is a valid list iterator object that will iterate over the specified object.
object - the single object over which to iteratepublic static java.util.Iterator arrayIterator(java.lang.Object[] array)
array - the array over which to iteratejava.lang.NullPointerException - if array is null
public static java.util.Iterator arrayIterator(java.lang.Object[] array,
int start)
array - the array over which to iteratestart - the index to start iterating atjava.lang.IllegalArgumentException - if array bounds are invalidjava.lang.NullPointerException - if array is null
public static java.util.Iterator arrayIterator(java.lang.Object[] array,
int start,
int end)
array - the array over which to iteratestart - the index to start iterating atend - the index to finish iterating atjava.lang.IllegalArgumentException - if array bounds are invalidjava.lang.NullPointerException - if array is null
public static java.util.Iterator chainedIterator(java.util.Iterator iterator1,
java.util.Iterator iterator2)
IteratorUtils.EmptyIterators one after another.
iterator1 - the first iterators to use, not nulliterator2 - the first iterators to use, not nulljava.lang.NullPointerException - if either iterator is nullpublic static java.util.Iterator chainedIterator(java.util.Iterator[] iterators)
IteratorUtils.EmptyIterators one after another.
iterators - the iterators to use, not null or empty or contain nullsjava.lang.NullPointerException - if iterators array is null or contains a nullpublic static java.util.Iterator chainedIterator(java.util.Collection iterators)
IteratorUtils.EmptyIterators one after another.
iterators - the iterators to use, not null or empty or contain nullsjava.lang.NullPointerException - if iterators collection is null or contains a nulljava.lang.ClassCastException - if the iterators collection contains the wrong object type
public static java.util.Iterator collatedIterator(java.util.Comparator comparator,
java.util.Iterator iterator1,
java.util.Iterator iterator2)
IteratorUtils.EmptyIterators.
Given two ordered IteratorUtils.EmptyIterators A and B, the IteratorUtils.EmptyIterator.next() method will return the lesser of A.next() and B.next().
The comparator is optional. If null is specified then natural order is used.
comparator - the comparator to use, may be null for natural orderiterator1 - the first iterators to use, not nulliterator2 - the first iterators to use, not nulljava.lang.NullPointerException - if either iterator is null
public static java.util.Iterator collatedIterator(java.util.Comparator comparator,
java.util.Iterator[] iterators)
IteratorUtils.EmptyIterators.
Given two ordered IteratorUtils.EmptyIterators A and B, the IteratorUtils.EmptyIterator.next() method will return the lesser of A.next() and B.next() and so on.
The comparator is optional. If null is specified then natural order is used.
comparator - the comparator to use, may be null for natural orderiterators - the iterators to use, not null or empty or contain nullsjava.lang.NullPointerException - if iterators array is null or contains a null
public static java.util.Iterator collatedIterator(java.util.Comparator comparator,
java.util.Collection iterators)
IteratorUtils.EmptyIterators.
Given two ordered IteratorUtils.EmptyIterators A and B, the IteratorUtils.EmptyIterator.next() method will return the lesser of A.next() and B.next() and so on.
The comparator is optional. If null is specified then natural order is used.
comparator - the comparator to use, may be null for natural orderiterators - the iterators to use, not null or empty or contain nullsjava.lang.NullPointerException - if iterators collection is null or contains a nulljava.lang.ClassCastException - if the iterators collection contains the wrong object type
public static java.util.Iterator transformedIterator(java.util.Iterator iterator,
Transformer transform)
The transformation occurs during the next() method and the underlying iterator is unaffected by the transformation.
iterator - the iterator to use, not nulltransform - the transform to use, not nulljava.lang.NullPointerException - if either parameter is null
public static java.util.Iterator filteredIterator(java.util.Iterator iterator,
Predicate predicate)
The returned iterator will only return objects that match the specified filtering predicate.
iterator - the iterator to use, not nullpredicate - the predicate to use as a filter, not nulljava.lang.NullPointerException - if either parameter is null
public static java.util.ListIterator filteredListIterator(java.util.ListIterator listIterator,
Predicate predicate)
The returned iterator will only return objects that match the specified filtering predicate.
listIterator - the list iterator to use, not nullpredicate - the predicate to use as a filter, not nulljava.lang.NullPointerException - if either parameter is nullpublic static java.util.Iterator asIterator(java.util.Enumeration enumeration)
enumeration - the enumeration to use
public static java.util.Iterator asIterator(java.util.Enumeration enumeration,
java.util.Collection removeCollection)
enumeration - the enumeration to usepublic static java.util.Enumeration asEnumeration(java.util.Iterator iterator)
iterator - the iterator to use, not nulljava.lang.NullPointerException - if iterator is nullpublic static java.util.ListIterator toListIterator(java.util.Iterator iterator)
As the wrapped Iterator is traversed, a LinkedList of its values is cached, permitting all required operations of ListIterator.
iterator - the iterator to use, not nulljava.lang.NullPointerException - if iterator parameter is nullpublic static java.lang.Object[] toArray(java.util.Iterator iterator)
As the wrapped Iterator is traversed, an ArrayList of its values is created. At the end, this is converted to an array.
iterator - the iterator to use, not nulljava.lang.NullPointerException - if iterator parameter is null
public static java.lang.Object[] toArray(java.util.Iterator iterator,
java.lang.Class arrayClass)
As the wrapped Iterator is traversed, an ArrayList of its values is created. At the end, this is converted to an array.
iterator - the iterator to use, not nullarrayClass - the class of array to createjava.lang.NullPointerException - if iterator parameter is nulljava.lang.NullPointerException - if arrayClass is nulljava.lang.ClassCastException - if the arrayClass is invalidpublic static java.util.List toList(java.util.Iterator iterator)
As the wrapped Iterator is traversed, an ArrayList of its values is created. At the end, the list is returned.
iterator - the iterator to use, not nulljava.lang.NullPointerException - if iterator parameter is null
public static java.util.List toList(java.util.Iterator iterator,
int estimatedSize)
As the wrapped Iterator is traversed, an ArrayList of its values is created. At the end, the list is returned.
iterator - the iterator to use, not nullestimatedSize - the initial size of the ArrayListjava.lang.NullPointerException - if iterator parameter is nulljava.lang.IllegalArgumentException - if the size is less than 1public static java.util.Iterator getIterator(java.lang.Object obj)
This method can handles objects as follows
obj - the object to convert to an iterator
|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||