|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.electric.database.text.ArrayIterator<E>
public class ArrayIterator<E>
An iterator over an array.
Field Summary | |
---|---|
static com.sun.electric.database.text.ArrayIterator.EmptyIterator |
EMPTY_ITERATOR
The empty iterator (immutable). |
Method Summary | ||
---|---|---|
static
|
emptyIterator()
Returns the empty iterator (immutable). |
|
boolean |
hasNext()
Returns true if the iteration has more elements. |
|
static
|
iterator(E[] array)
Returns iterator over elements of array. |
|
static
|
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). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final com.sun.electric.database.text.ArrayIterator.EmptyIterator EMPTY_ITERATOR
emptyIterator()
Method Detail |
---|
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 range
java.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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |