Top Description Fields Constructors Methods
org.wildfly.common.array

public final Class ArrayIterator<E>

extends Object
implements ListIterator<E>, EnumerationIterator<E>
Class Inheritance
All Implemented Interfaces
org.wildfly.common.iteration.EnumerationIterator, java.util.Iterator, java.util.Enumeration, java.util.ListIterator
Imports
java.util.ListIterator, .NoSuchElementException, org.wildfly.common.Assert, org.wildfly.common.iteration.EnumerationIterator

A read-only iterator over an array.
Author
David M. Lloyd

Field Summary

Modifier and TypeField and Description
private final boolean
private final E[]
private int

Constructor Summary

AccessConstructor and Description
public
ArrayIterator(final E[]
the elements to iterate over
elements
)

Construct a new instance.

public
ArrayIterator(final E[]
the elements to iterate over
elements
,
final boolean
true to iterate in descending order, false otherwise
descending
)

Construct a new instance.

public
ArrayIterator(final E[]
the elements to iterate over
elements
,
final int
the starting index (must be within the bounds of elements)
startIdx
)

Construct a new instance.

public
ArrayIterator(final E[]
the elements to iterate over
elements
,
final boolean
true to iterate in descending order, false otherwise
descending
,
final int
the starting index (must be within the bounds of elements)
startIdx
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public void
add(final E
ignored
e
)

Implements java.util.ListIterator.add.

Unsupported.
public boolean

Returns:

true if there are more elements, false otherwise
hasNext
()

Implements java.util.ListIterator.hasNext, java.util.Iterator.hasNext.

Determine if there are more elements to iterate over in the direction of this iterator.
public boolean

Returns:

true if there are more elements, false otherwise
hasPrevious
()

Implements java.util.ListIterator.hasPrevious.

Determine if there are more elements to iterate over in the reverse direction of this iterator.
public E

Returns:

the next element
next
()

Implements java.util.ListIterator.next, java.util.Iterator.next.

Get the next element in the direction of this iterator.
public int

Returns:

the next index
nextIndex
()

Implements java.util.ListIterator.nextIndex.

Get the next index in the direction of this iterator.
public E

Returns:

the next element
previous
()

Implements java.util.ListIterator.previous.

Get the next element in the reverse direction of this iterator.
public int

Returns:

the next index
previousIndex
()

Implements java.util.ListIterator.previousIndex.

Get the next index in the reverse direction of this iterator.
public void
remove()

Overrides default java.util.Iterator.remove.

Implements java.util.ListIterator.remove.

Unsupported.
public void
set(final E
ignored
e
)

Implements java.util.ListIterator.set.

Unsupported.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

descendingback to summary
private final boolean descending
elementsback to summary
private final E[] elements
idxback to summary
private int idx

Constructor Detail

ArrayIteratorback to summary
public ArrayIterator(final E[] elements)

Construct a new instance.

Parameters
elements:E[]

the elements to iterate over

ArrayIteratorback to summary
public ArrayIterator(final E[] elements, final boolean descending)

Construct a new instance.

Parameters
elements:E[]

the elements to iterate over

descending:boolean

true to iterate in descending order, false otherwise

ArrayIteratorback to summary
public ArrayIterator(final E[] elements, final int startIdx)

Construct a new instance.

Parameters
elements:E[]

the elements to iterate over

startIdx:int

the starting index (must be within the bounds of elements)

ArrayIteratorback to summary
public ArrayIterator(final E[] elements, final boolean descending, final int startIdx)

Construct a new instance.

Parameters
elements:E[]

the elements to iterate over

descending:boolean

true to iterate in descending order, false otherwise

startIdx:int

the starting index (must be within the bounds of elements)

Method Detail

addback to summary
public void add(final E e)

Implements java.util.ListIterator.add.

Unsupported.

Parameters
e:E

ignored

hasNextback to summary
public boolean hasNext()

Implements java.util.ListIterator.hasNext, java.util.Iterator.hasNext.

Determine if there are more elements to iterate over in the direction of this iterator.

Returns:boolean

true if there are more elements, false otherwise

hasPreviousback to summary
public boolean hasPrevious()

Implements java.util.ListIterator.hasPrevious.

Determine if there are more elements to iterate over in the reverse direction of this iterator.

Returns:boolean

true if there are more elements, false otherwise

nextback to summary
public E next()

Implements java.util.ListIterator.next, java.util.Iterator.next.

Get the next element in the direction of this iterator.

Returns:E

the next element

nextIndexback to summary
public int nextIndex()

Implements java.util.ListIterator.nextIndex.

Get the next index in the direction of this iterator.

Returns:int

the next index

previousback to summary
public E previous()

Implements java.util.ListIterator.previous.

Get the next element in the reverse direction of this iterator.

Returns:E

the next element

previousIndexback to summary
public int previousIndex()

Implements java.util.ListIterator.previousIndex.

Get the next index in the reverse direction of this iterator.

Returns:int

the next index

removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Implements java.util.ListIterator.remove.

Unsupported.

setback to summary
public void set(final E e)

Implements java.util.ListIterator.set.

Unsupported.

Parameters
e:E

ignored