Javadoc
- Close HTML tags - Whitespace before tags - Remove dead inline comments
This commit is contained in:
parent
b3d29d56d8
commit
5f23d725ee
|
@ -28,9 +28,11 @@ import org.apache.commons.collections4.ResettableIterator;
|
|||
* that you have an object array, the
|
||||
* {@link org.apache.commons.collections4.iterators.ObjectArrayIterator ObjectArrayIterator}
|
||||
* class is a better choice, as it will perform better.
|
||||
* </p>
|
||||
* <p>
|
||||
* The iterator implements a {@link #reset} method, allowing the reset of
|
||||
* the iterator back to the start if required.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements returned by this iterator.
|
||||
* @since 1.0
|
||||
|
@ -114,7 +116,6 @@ public class ArrayIterator<E> implements ResettableIterator<E> {
|
|||
}
|
||||
}
|
||||
|
||||
// Properties
|
||||
/**
|
||||
* Gets the array that this iterator is iterating over.
|
||||
*
|
||||
|
@ -144,7 +145,6 @@ public class ArrayIterator<E> implements ResettableIterator<E> {
|
|||
return startIndex;
|
||||
}
|
||||
|
||||
// Iterator interface
|
||||
/**
|
||||
* Returns true if there are more elements to return from the array.
|
||||
*
|
||||
|
|
|
@ -27,10 +27,11 @@ import org.apache.commons.collections4.ResettableListIterator;
|
|||
* The array can be either an array of object or of primitives. If you know
|
||||
* that you have an object array, the {@link ObjectArrayListIterator}
|
||||
* class is a better choice, as it will perform better.
|
||||
*
|
||||
* </p>
|
||||
* <p>
|
||||
* This iterator does not support {@link #add(Object)} or {@link #remove()}, as the array
|
||||
* cannot be changed in size. The {@link #set(Object)} method is supported however.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements returned by this iterator.
|
||||
* @see org.apache.commons.collections4.iterators.ArrayIterator
|
||||
|
@ -105,7 +106,6 @@ public class ArrayListIterator<E> extends ArrayIterator<E>
|
|||
throw new UnsupportedOperationException("add() method is not supported");
|
||||
}
|
||||
|
||||
// ListIterator interface
|
||||
/**
|
||||
* Returns true if there are previous elements to return from the array.
|
||||
*
|
||||
|
@ -182,6 +182,7 @@ public class ArrayListIterator<E> extends ArrayIterator<E>
|
|||
* <p>
|
||||
* This method sets the element that was returned by the last call
|
||||
* to {@link #next()} of {@link #previous()}.
|
||||
* </p>
|
||||
* <p>
|
||||
* <b>Note:</b> {@link java.util.ListIterator} implementations that support
|
||||
* {@code add()} and {@code remove()} only allow {@code set()} to be called
|
||||
|
@ -189,6 +190,7 @@ public class ArrayListIterator<E> extends ArrayIterator<E>
|
|||
* Javadoc for more details). Since this implementation does
|
||||
* not support {@code add()} or {@code remove()}, {@code set()} may be
|
||||
* called as often as desired.
|
||||
* </p>
|
||||
*
|
||||
* @param o the element to set
|
||||
* @throws IllegalStateException if {@link #next()} or {@link #previous()} has not been called
|
||||
|
|
|
@ -27,10 +27,12 @@ import java.util.Objects;
|
|||
* The {@code offset} corresponds to the position of the first element to
|
||||
* be returned from the decorated iterator, and {@code max} is the maximum
|
||||
* number of elements to be returned at most.
|
||||
* </p>
|
||||
* <p>
|
||||
* In case an offset parameter other than 0 is provided, the decorated
|
||||
* iterator is immediately advanced to this position, skipping all elements
|
||||
* before that position.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements returned by this iterator.
|
||||
* @since 4.1
|
||||
|
@ -55,6 +57,7 @@ public class BoundedIterator<E> implements Iterator<E> {
|
|||
* <p>
|
||||
* The iterator is immediately advanced until it reaches the position at {@code offset},
|
||||
* incurring O(n) time.
|
||||
* </p>
|
||||
*
|
||||
* @param iterator the iterator to be decorated
|
||||
* @param offset the index of the first element of the decorated iterator to return
|
||||
|
@ -123,6 +126,7 @@ public class BoundedIterator<E> implements Iterator<E> {
|
|||
* to this position upon creation. A call to {@link #remove()} will still result in an
|
||||
* {@link IllegalStateException} if no explicit call to {@link #next()} has been made prior
|
||||
* to calling {@link #remove()}.
|
||||
* </p>
|
||||
*/
|
||||
@Override
|
||||
public void remove() {
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.apache.commons.collections4.list.UnmodifiableList;
|
|||
* Given two ordered {@link Iterator} instances {@code A} and
|
||||
* {@code B}, the {@link #next} method on this iterator will return the
|
||||
* lesser of {@code A.next()} and {@code B.next()}.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements returned by this iterator.
|
||||
* @since 2.1
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.apache.commons.collections4.ResettableIterator;
|
|||
* This class provides an implementation of an empty iterator.
|
||||
* This class provides for binary compatibility between Commons Collections
|
||||
* 2.1.1 and 3.1 due to issues with {@code IteratorUtils}.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements returned by this iterator.
|
||||
* @since 2.1.1 and 3.1
|
||||
|
@ -34,6 +35,7 @@ public class EmptyIterator<E> extends AbstractEmptyIterator<E> {
|
|||
|
||||
/**
|
||||
* Singleton instance of the iterator.
|
||||
*
|
||||
* @since 3.1
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
|
@ -41,6 +43,7 @@ public class EmptyIterator<E> extends AbstractEmptyIterator<E> {
|
|||
|
||||
/**
|
||||
* Singleton instance of the iterator.
|
||||
*
|
||||
* @since 2.1.1 and 3.1
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
|
@ -48,6 +51,7 @@ public class EmptyIterator<E> extends AbstractEmptyIterator<E> {
|
|||
|
||||
/**
|
||||
* Gets a typed empty iterator instance.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @return Iterator<E>
|
||||
*/
|
||||
|
@ -57,6 +61,7 @@ public class EmptyIterator<E> extends AbstractEmptyIterator<E> {
|
|||
|
||||
/**
|
||||
* Gets a typed resettable empty iterator instance.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @return ResettableIterator<E>
|
||||
*/
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.apache.commons.collections4.ResettableListIterator;
|
|||
* This class provides an implementation of an empty list iterator. This class
|
||||
* provides for binary compatibility between Commons Collections 2.1.1 and 3.1
|
||||
* due to issues with {@code IteratorUtils}.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements returned by this iterator.
|
||||
* @since 2.1.1 and 3.1
|
||||
|
@ -34,6 +35,7 @@ public class EmptyListIterator<E> extends AbstractEmptyIterator<E> implements Re
|
|||
|
||||
/**
|
||||
* Singleton instance of the iterator.
|
||||
*
|
||||
* @since 3.1
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
|
@ -41,6 +43,7 @@ public class EmptyListIterator<E> extends AbstractEmptyIterator<E> implements Re
|
|||
|
||||
/**
|
||||
* Singleton instance of the iterator.
|
||||
*
|
||||
* @since 2.1.1 and 3.1
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
|
@ -48,6 +51,7 @@ public class EmptyListIterator<E> extends AbstractEmptyIterator<E> implements Re
|
|||
|
||||
/**
|
||||
* Gets a typed instance of the iterator.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @return {@link ListIterator}<E>
|
||||
*/
|
||||
|
@ -57,6 +61,7 @@ public class EmptyListIterator<E> extends AbstractEmptyIterator<E> implements Re
|
|||
|
||||
/**
|
||||
* Gets a typed instance of the iterator.
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @return {@link ResettableListIterator}<E>
|
||||
*/
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.apache.commons.collections4.Predicate;
|
|||
* <p>
|
||||
* This iterator decorates the underlying iterator, only allowing through
|
||||
* those elements that match the specified {@link Predicate Predicate}.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements returned by this iterator.
|
||||
* @since 1.0
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.apache.commons.collections4.Predicate;
|
|||
* <p>
|
||||
* This iterator decorates the underlying iterator, only allowing through
|
||||
* those elements that match the specified {@link Predicate Predicate}.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements returned by this iterator.
|
||||
* @since 2.0
|
||||
|
|
|
@ -29,22 +29,27 @@ import java.util.Queue;
|
|||
* method from the Iterator interface is called, the IteratorChain will delegate
|
||||
* to a single underlying Iterator. The IteratorChain will invoke the Iterators
|
||||
* in sequence until all Iterators are exhausted.
|
||||
* </p>
|
||||
* <p>
|
||||
* Under many circumstances, linking Iterators together in this manner is more
|
||||
* efficient (and convenient) than reading out the contents of each Iterator
|
||||
* into a List and creating a new Iterator.
|
||||
* </p>
|
||||
* <p>
|
||||
* Calling a method that adds new Iterator <i>after a method in the Iterator
|
||||
* interface has been called</i> will result in an UnsupportedOperationException.
|
||||
* </p>
|
||||
* <p>
|
||||
* NOTE: As from version 3.0, the IteratorChain may contain no iterators. In
|
||||
* this case the class will function as an empty iterator.
|
||||
* </p>
|
||||
* <p>
|
||||
* NOTE: As from version 4.0, the IteratorChain stores the iterators in a queue
|
||||
* and removes any reference to them as soon as they are not used anymore. Thus,
|
||||
* the methods {@code setIterator(Iterator)} and {@code getIterators()} have been
|
||||
* removed and {@link #size()} will return the number of remaining iterators in
|
||||
* the queue.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements in this iterator.
|
||||
* @since 2.1
|
||||
|
@ -74,6 +79,7 @@ public class IteratorChain<E> implements Iterator<E> {
|
|||
* <p>
|
||||
* You will normally use {@link #addIterator(Iterator)} to add some
|
||||
* iterators after using this constructor.
|
||||
* </p>
|
||||
*/
|
||||
public IteratorChain() {
|
||||
}
|
||||
|
@ -84,6 +90,7 @@ public class IteratorChain<E> implements Iterator<E> {
|
|||
* <p>
|
||||
* This method takes a collection of iterators. The newly constructed
|
||||
* iterator will iterate through each one of the input iterators in turn.
|
||||
* </p>
|
||||
*
|
||||
* @param iteratorChain the collection of iterators, not null
|
||||
* @throws NullPointerException if iterators collection is or contains null
|
||||
|
@ -102,9 +109,11 @@ public class IteratorChain<E> implements Iterator<E> {
|
|||
* This method takes one iterator. The newly constructed iterator will
|
||||
* iterate through that iterator. Thus calling this constructor on its own
|
||||
* will have no effect other than decorating the input iterator.
|
||||
* </p>
|
||||
* <p>
|
||||
* You will normally use {@link #addIterator(Iterator)} to add some more
|
||||
* iterators after using this constructor.
|
||||
* </p>
|
||||
*
|
||||
* @param iterator the first child iterator in the IteratorChain, not null
|
||||
* @throws NullPointerException if the iterator is null
|
||||
|
@ -118,6 +127,7 @@ public class IteratorChain<E> implements Iterator<E> {
|
|||
* <p>
|
||||
* This method takes an array of iterators. The newly constructed iterator
|
||||
* will iterate through each one of the input iterators in turn.
|
||||
* </p>
|
||||
*
|
||||
* @param iteratorChain the array of iterators, not null
|
||||
* @throws NullPointerException if iterators array is or contains null
|
||||
|
@ -133,6 +143,7 @@ public class IteratorChain<E> implements Iterator<E> {
|
|||
* <p>
|
||||
* This method takes two iterators. The newly constructed iterator will
|
||||
* iterate through each one of the input iterators in turn.
|
||||
* </p>
|
||||
*
|
||||
* @param first the first child iterator in the IteratorChain, not null
|
||||
* @param second the second child iterator in the IteratorChain, not null
|
||||
|
|
|
@ -25,9 +25,11 @@ import java.util.Iterator;
|
|||
* method from the Iterator interface is called, the LazyIteratorChain will delegate
|
||||
* to a single underlying Iterator. The LazyIteratorChain will invoke the Iterators
|
||||
* in sequence until all Iterators are exhausted.
|
||||
* </p>
|
||||
* <p>
|
||||
* The Iterators are provided by {@link #nextIterator(int)} which has to be overridden by
|
||||
* subclasses and allows to lazily create the Iterators as they are accessed:
|
||||
* </p>
|
||||
* <pre>
|
||||
* return new LazyIteratorChain<String>() {
|
||||
* protected Iterator<String> nextIterator(int count) {
|
||||
|
@ -39,9 +41,11 @@ import java.util.Iterator;
|
|||
* Once the inner Iterator's {@link Iterator#hasNext()} method returns false,
|
||||
* {@link #nextIterator(int)} will be called to obtain another iterator, and so on
|
||||
* until {@link #nextIterator(int)} returns null, indicating that the chain is exhausted.
|
||||
* </p>
|
||||
* <p>
|
||||
* NOTE: The LazyIteratorChain may contain no iterators. In this case the class will
|
||||
* function as an empty iterator.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements in this iterator.
|
||||
* @since 4.0
|
||||
|
@ -94,6 +98,7 @@ public abstract class LazyIteratorChain<E> implements Iterator<E> {
|
|||
* Gets the next iterator after the previous one has been exhausted.
|
||||
* <p>
|
||||
* This method <b>MUST</b> return null when there are no more iterators.
|
||||
* </p>
|
||||
*
|
||||
* @param count the number of time this method has been called (starts with 1)
|
||||
* @return the next iterator, or null if there are no more.
|
||||
|
@ -106,6 +111,7 @@ public abstract class LazyIteratorChain<E> implements Iterator<E> {
|
|||
* As with next() and hasNext(), this method calls remove() on the underlying Iterator.
|
||||
* Therefore, this method may throw an UnsupportedOperationException if the underlying
|
||||
* Iterator does not support this method.
|
||||
* </p>
|
||||
*
|
||||
* @throws UnsupportedOperationException if the remove operator is not
|
||||
* supported by the underlying Iterator
|
||||
|
|
|
@ -38,10 +38,13 @@ import org.apache.commons.collections4.ResettableListIterator;
|
|||
* This class allows a regular {@code Iterator} to behave as a
|
||||
* {@code ListIterator}. It achieves this by building a list internally
|
||||
* of as the underlying iterator is traversed.
|
||||
* </p>
|
||||
* <p>
|
||||
* The optional operations of {@code ListIterator} are not supported for plain {@code Iterator}s.
|
||||
* </p>
|
||||
* <p>
|
||||
* This class implements ResettableListIterator from Commons Collections 3.2.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements in this iterator.
|
||||
* @since 2.1
|
||||
|
|
|
@ -29,9 +29,11 @@ import org.apache.commons.collections4.ResettableIterator;
|
|||
* The iterator will loop continuously around the provided elements, unless
|
||||
* there are no elements in the collection to begin with, or all the elements
|
||||
* have been {@link #remove removed}.
|
||||
* </p>
|
||||
* <p>
|
||||
* Concurrent modifications are not directly supported, and for most collection
|
||||
* implementations will throw a ConcurrentModificationException.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements returned by this iterator.
|
||||
* @since 3.0
|
||||
|
@ -48,6 +50,7 @@ public class LoopingIterator<E> implements ResettableIterator<E> {
|
|||
* <p>
|
||||
* There is no way to reset an Iterator instance without recreating it from
|
||||
* the original source, so the Collection must be passed in.
|
||||
* </p>
|
||||
*
|
||||
* @param collection the collection to wrap
|
||||
* @throws NullPointerException if the collection is null
|
||||
|
@ -62,6 +65,7 @@ public class LoopingIterator<E> implements ResettableIterator<E> {
|
|||
* <p>
|
||||
* Returns false only if the collection originally had zero elements, or
|
||||
* all the elements have been {@link #remove removed}.
|
||||
* </p>
|
||||
*
|
||||
* @return {@code true} if there are more elements
|
||||
*/
|
||||
|
@ -74,6 +78,7 @@ public class LoopingIterator<E> implements ResettableIterator<E> {
|
|||
* Returns the next object in the collection.
|
||||
* <p>
|
||||
* If at the end of the collection, return the first element.
|
||||
* </p>
|
||||
*
|
||||
* @return the next object
|
||||
* @throws NoSuchElementException if there are no elements
|
||||
|
@ -96,11 +101,13 @@ public class LoopingIterator<E> implements ResettableIterator<E> {
|
|||
* This feature is only supported if the underlying collection's
|
||||
* {@link Collection#iterator()} method returns an implementation
|
||||
* that supports it.
|
||||
* </p>
|
||||
* <p>
|
||||
* This method can only be called after at least one {@link #next} method call.
|
||||
* After a removal, the remove method may not be called again until another
|
||||
* next has been performed. If the {@link #reset} is called, then remove may
|
||||
* not be called until {@link #next} is called again.
|
||||
* </p>
|
||||
*/
|
||||
@Override
|
||||
public void remove() {
|
||||
|
|
|
@ -30,10 +30,12 @@ import org.apache.commons.collections4.ResettableListIterator;
|
|||
* The iterator will loop continuously around the provided list,
|
||||
* unless there are no elements in the collection to begin with, or
|
||||
* all of the elements have been {@link #remove removed}.
|
||||
* </p>
|
||||
* <p>
|
||||
* Concurrent modifications are not directly supported, and for most
|
||||
* collection implementations will throw a
|
||||
* ConcurrentModificationException.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements returned by this iterator.
|
||||
* @since 3.2
|
||||
|
@ -51,6 +53,7 @@ public class LoopingListIterator<E> implements ResettableListIterator<E> {
|
|||
* There is no way to reset a ListIterator instance without
|
||||
* recreating it from the original source, so the List must be
|
||||
* passed in and a reference to it held.
|
||||
* </p>
|
||||
*
|
||||
* @param list the list to wrap
|
||||
* @throws NullPointerException if the list is null
|
||||
|
@ -66,10 +69,12 @@ public class LoopingListIterator<E> implements ResettableListIterator<E> {
|
|||
* The element is inserted before the next element that would be
|
||||
* returned by {@link #next}, if any, and after the next element
|
||||
* that would be returned by {@link #previous}, if any.
|
||||
* </p>
|
||||
* <p>
|
||||
* This feature is only supported if the underlying list's
|
||||
* {@link List#listIterator} method returns an implementation
|
||||
* that supports it.
|
||||
* </p>
|
||||
*
|
||||
* @param obj the element to insert
|
||||
* @throws UnsupportedOperationException if the add method is not
|
||||
|
@ -85,6 +90,7 @@ public class LoopingListIterator<E> implements ResettableListIterator<E> {
|
|||
* <p>
|
||||
* Returns false only if the list originally had zero elements, or
|
||||
* all elements have been {@link #remove removed}.
|
||||
* </p>
|
||||
*
|
||||
* @return {@code true} if there are more elements
|
||||
*/
|
||||
|
@ -98,6 +104,7 @@ public class LoopingListIterator<E> implements ResettableListIterator<E> {
|
|||
* <p>
|
||||
* Returns false only if the list originally had zero elements, or
|
||||
* all elements have been {@link #remove removed}.
|
||||
* </p>
|
||||
*
|
||||
* @return {@code true} if there are more elements
|
||||
*/
|
||||
|
@ -114,6 +121,7 @@ public class LoopingListIterator<E> implements ResettableListIterator<E> {
|
|||
* Returns the next object in the list.
|
||||
* <p>
|
||||
* If at the end of the list, returns the first element.
|
||||
* </p>
|
||||
*
|
||||
* @return the object after the last element returned
|
||||
* @throws NoSuchElementException if there are no elements in the list
|
||||
|
@ -137,6 +145,7 @@ public class LoopingListIterator<E> implements ResettableListIterator<E> {
|
|||
* As would be expected, if the iterator is at the physical end of
|
||||
* the underlying list, 0 is returned, signifying the beginning of
|
||||
* the list.
|
||||
* </p>
|
||||
*
|
||||
* @return the index of the element that would be returned if next() were called
|
||||
* @throws NoSuchElementException if there are no elements in the list
|
||||
|
@ -158,6 +167,7 @@ public class LoopingListIterator<E> implements ResettableListIterator<E> {
|
|||
* <p>
|
||||
* If at the beginning of the list, return the last element. Note
|
||||
* that in this case, traversal to find that element takes linear time.
|
||||
* </p>
|
||||
*
|
||||
* @return the object before the last element returned
|
||||
* @throws NoSuchElementException if there are no elements in the list
|
||||
|
@ -186,6 +196,7 @@ public class LoopingListIterator<E> implements ResettableListIterator<E> {
|
|||
* As would be expected, if at the iterator is at the physical
|
||||
* beginning of the underlying list, the list's size minus one is
|
||||
* returned, signifying the end of the list.
|
||||
* </p>
|
||||
*
|
||||
* @return the index of the element that would be returned if previous() were called
|
||||
* @throws NoSuchElementException if there are no elements in the list
|
||||
|
@ -208,6 +219,7 @@ public class LoopingListIterator<E> implements ResettableListIterator<E> {
|
|||
* This feature is only supported if the underlying list's
|
||||
* {@link List#iterator()} method returns an implementation
|
||||
* that supports it.
|
||||
* </p>
|
||||
* <p>
|
||||
* This method can only be called after at least one {@link #next}
|
||||
* or {@link #previous} method call. After a removal, the remove
|
||||
|
@ -215,6 +227,7 @@ public class LoopingListIterator<E> implements ResettableListIterator<E> {
|
|||
* {@link #previous} has been performed. If the {@link #reset} is
|
||||
* called, then remove may not be called until {@link #next} or
|
||||
* {@link #previous} is called again.
|
||||
* </p>
|
||||
*
|
||||
* @throws UnsupportedOperationException if the remove method is
|
||||
* not supported by the iterator implementation of the underlying
|
||||
|
@ -240,6 +253,7 @@ public class LoopingListIterator<E> implements ResettableListIterator<E> {
|
|||
* This feature is only supported if the underlying list's
|
||||
* {@link List#listIterator} method returns an implementation
|
||||
* that supports it.
|
||||
* </p>
|
||||
*
|
||||
* @param obj the element with which to replace the last element returned
|
||||
* @throws UnsupportedOperationException if the set method is not
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.w3c.dom.NodeList;
|
|||
* <p>
|
||||
* This iterator does not support {@link #remove()} as a {@link NodeList} does not support
|
||||
* removal of items.
|
||||
* </p>
|
||||
*
|
||||
* @since 4.0
|
||||
* @see NodeList
|
||||
|
|
|
@ -25,9 +25,11 @@ import org.apache.commons.collections4.ResettableIterator;
|
|||
* <p>
|
||||
* This iterator does not support {@link #remove}, as the object array cannot be
|
||||
* structurally modified.
|
||||
* </p>
|
||||
* <p>
|
||||
* The iterator implements a {@link #reset} method, allowing the reset of the iterator
|
||||
* back to the start if required.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements returned by this iterator.
|
||||
* @since 3.0
|
||||
|
|
|
@ -25,9 +25,11 @@ import org.apache.commons.collections4.ResettableListIterator;
|
|||
* <p>
|
||||
* This iterator does not support {@link #add} or {@link #remove}, as the object array
|
||||
* cannot be structurally modified. The {@link #set} method is supported however.
|
||||
* </p>
|
||||
* <p>
|
||||
* The iterator implements a {@link #reset} method, allowing the reset of the iterator
|
||||
* back to the start if required.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements returned by this iterator.
|
||||
* @see org.apache.commons.collections4.iterators.ObjectArrayIterator
|
||||
|
@ -172,13 +174,15 @@ public class ObjectArrayListIterator<E> extends ObjectArrayIterator<E>
|
|||
* <p>
|
||||
* This method sets the element that was returned by the last call
|
||||
* to {@link #next()} of {@link #previous()}.
|
||||
*
|
||||
* </p>
|
||||
* <p>
|
||||
* <b>Note:</b> {@link java.util.ListIterator} implementations that support {@code add()}
|
||||
* and {@code remove()} only allow {@code set()} to be called once per call
|
||||
* to {@code next()} or {@code previous} (see the {@link java.util.ListIterator}
|
||||
* Javadoc for more details). Since this implementation does not support
|
||||
* {@code add()} or {@code remove()}, {@code set()} may be
|
||||
* called as often as desired.
|
||||
* </p>
|
||||
*
|
||||
* @param obj the object to set into the array
|
||||
* @throws IllegalStateException if next() has not yet been called.
|
||||
|
|
|
@ -30,8 +30,10 @@ import org.apache.commons.collections4.Transformer;
|
|||
* The iteration starts from a single root object.
|
||||
* It uses a {@code Transformer} to extract the iterators and elements.
|
||||
* Its main benefit is that no intermediate {@code List} is created.
|
||||
* </p>
|
||||
* <p>
|
||||
* For example, consider an object graph:
|
||||
* </p>
|
||||
* <pre>
|
||||
* |- Branch -- Leaf
|
||||
* | \- Leaf
|
||||
|
@ -43,8 +45,10 @@ import org.apache.commons.collections4.Transformer;
|
|||
* |- Tree | /- Leaf
|
||||
* |- Branch -- Leaf
|
||||
* |- Branch -- Leaf</pre>
|
||||
* <p>
|
||||
* The following {@code Transformer}, used in this class, will extract all
|
||||
* the Leaf objects without creating a combined intermediate list:
|
||||
* </p>
|
||||
* <pre>
|
||||
* public Object transform(Object input) {
|
||||
* if (input instanceof Forest) {
|
||||
|
@ -67,9 +71,11 @@ import org.apache.commons.collections4.Transformer;
|
|||
* either an iterator or an object. If the object is an Iterator, the next element
|
||||
* from that iterator is obtained and the process repeats. If the element is an object
|
||||
* it is returned.
|
||||
* </p>
|
||||
* <p>
|
||||
* Under many circumstances, linking Iterators together in this manner is
|
||||
* more efficient (and convenient) than using nested for loops to extract a list.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements returned by this iterator.
|
||||
* @since 3.1
|
||||
|
@ -118,6 +124,7 @@ public class ObjectGraphIterator<E> implements Iterator<E> {
|
|||
* be used to iterate over nested iterators. That is to say that the iterator
|
||||
* passed in here contains other iterators, which may in turn contain further
|
||||
* iterators.
|
||||
* </p>
|
||||
*
|
||||
* @param rootIterator the root iterator, null will result in an empty iterator
|
||||
*/
|
||||
|
@ -208,6 +215,7 @@ public class ObjectGraphIterator<E> implements Iterator<E> {
|
|||
* This method calls remove() on the underlying Iterator, and it may
|
||||
* throw an UnsupportedOperationException if the underlying Iterator
|
||||
* does not support this method.
|
||||
* </p>
|
||||
*
|
||||
* @throws UnsupportedOperationException
|
||||
* if the remove operator is not supported by the underlying Iterator
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Objects;
|
|||
* The decorator supports the removal operation, but an {@link IllegalStateException}
|
||||
* will be thrown if {@link #remove()} is called directly after a call to
|
||||
* {@link #peek()} or {@link #element()}.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements returned by this iterator.
|
||||
* @since 4.0
|
||||
|
@ -36,6 +37,7 @@ public class PeekingIterator<E> implements Iterator<E> {
|
|||
* Decorates the specified iterator to support one-element lookahead.
|
||||
* <p>
|
||||
* If the iterator is already a {@link PeekingIterator} it is returned directly.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param iterator the iterator to decorate
|
||||
|
@ -128,9 +130,11 @@ public class PeekingIterator<E> implements Iterator<E> {
|
|||
* <p>
|
||||
* Note: this method does not throw a {@link NoSuchElementException} if the iterator
|
||||
* is already exhausted. If you want such a behavior, use {@link #element()} instead.
|
||||
* </p>
|
||||
* <p>
|
||||
* The rationale behind this is to follow the {@link java.util.Queue} interface
|
||||
* which uses the same terminology.
|
||||
* </p>
|
||||
*
|
||||
* @return the next element from the iterator
|
||||
*/
|
||||
|
|
|
@ -33,9 +33,11 @@ import java.util.Objects;
|
|||
* The iterator will return exactly n! permutations of the input collection.
|
||||
* The {@code remove()} operation is not supported, and will throw an
|
||||
* {@code UnsupportedOperationException}.
|
||||
* </p>
|
||||
* <p>
|
||||
* NOTE: in case an empty collection is provided, the iterator will
|
||||
* return exactly one empty list as result, as 0! = 1.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of the objects being permuted
|
||||
*
|
||||
|
|
|
@ -26,9 +26,11 @@ import java.util.Objects;
|
|||
* <p>
|
||||
* The decorator stores the pushed back elements in a LIFO manner: the last element
|
||||
* that has been pushed back, will be returned as the next element in a call to {@link #next()}.
|
||||
* </p>
|
||||
* <p>
|
||||
* The decorator does not support the removal operation. Any call to {@link #remove()} will
|
||||
* result in an {@link UnsupportedOperationException}.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements returned by this iterator.
|
||||
* @since 4.0
|
||||
|
@ -39,6 +41,7 @@ public class PushbackIterator<E> implements Iterator<E> {
|
|||
* Decorates the specified iterator to support one-element lookahead.
|
||||
* <p>
|
||||
* If the iterator is already a {@link PushbackIterator} it is returned directly.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the element type
|
||||
* @param iterator the iterator to decorate
|
||||
|
@ -84,6 +87,7 @@ public class PushbackIterator<E> implements Iterator<E> {
|
|||
* Push back the given element to the iterator.
|
||||
* <p>
|
||||
* Calling {@link #next()} immediately afterwards will return exactly this element.
|
||||
* </p>
|
||||
*
|
||||
* @param item the element to push back to the iterator
|
||||
*/
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.apache.commons.collections4.ResettableListIterator;
|
|||
* However, the {@code nextIndex()} method returns the correct
|
||||
* index in the list, thus it starts high and reduces as the iteration
|
||||
* continues. The previous methods work similarly.
|
||||
* </p>
|
||||
*
|
||||
* @param <E> the type of elements returned by this iterator.
|
||||
* @since 3.2
|
||||
|
|
Loading…
Reference in New Issue