public class ArrayIterator<E>
extends java.lang.Object
implements java.util.Iterator<E>
Modifier and Type | Field and Description |
---|---|
static com.sun.electric.database.text.ArrayIterator.EmptyIterator |
EMPTY_ITERATOR
The empty iterator (immutable).
|
Modifier and Type | Method and Description |
---|---|
static <E> java.util.Iterator<E> |
emptyIterator()
Returns the empty iterator (immutable).
|
boolean |
hasNext()
Returns true if the iteration has more elements.
|
static <E> java.util.Iterator<E> |
iterator(E[] array)
Returns iterator over elements of array.
|
static <E> java.util.Iterator<E> |
iterator(E[] array,
int start,
int limit)
Returns iterator over range [start,limit) of elements of array.
|
E |
next()
Returns the next element in the iteration.
|
void |
remove()
Removes from the underlying collection the last element returned by the
iterator (unsupported operation).
|
public static final com.sun.electric.database.text.ArrayIterator.EmptyIterator EMPTY_ITERATOR
emptyIterator()
public static <E> java.util.Iterator<E> iterator(E[] array)
array
- array with elements or null.public static <E> java.util.Iterator<E> iterator(E[] array, int start, int limit)
array
- array with elements or null.start
- start index of the range.limit
- limit of the rangejava.lang.IndexOutOfBoundsException
- if start or limit are not correctpublic boolean hasNext()
hasNext
in interface java.util.Iterator<E>
public E next()
hasNext()
method returns false will
return each element in the underlying collection exactly once.next
in interface java.util.Iterator<E>
java.util.NoSuchElementException
- iteration has no more elements.public void remove()
remove
in interface java.util.Iterator<E>
java.lang.UnsupportedOperationException
public static final <E> java.util.Iterator<E> emptyIterator()
This example illustrates the type-safe way to obtain an empty set:
Iterator<String> s = ArrayIterator.emptyIterator();Implementation note: Implementations of this method need not create a separate Iterator object for each call. Using this method is likely to have comparable cost to using the like-named field. (Unlike this method, the field does not provide type safety.)
EMPTY_ITERATOR