com.neeve.lang
Class XBooleanArrayIterator

java.lang.Object
  extended by com.neeve.lang.XBooleanArrayIterator
All Implemented Interfaces:
XBooleanIterator

public class XBooleanArrayIterator
extends Object
implements XBooleanIterator

An XBooleanIterator that wraps a boolean array.


Constructor Summary
XBooleanArrayIterator(boolean[] array)
          Constructs a new array iterator.
XBooleanArrayIterator(boolean[] array, int offset, int length)
          Constructs a new array iterator.
 
Method Summary
 boolean[] array()
          The array backing this iterator.
 boolean hasNext()
          Returns true if the iteration has more elements.
 int length()
          Gets the length of the iterator (the number of elements it returns starting with the offset).
 boolean next()
          Returns the next element in the iteration.
 int offset()
          Gets the offset into the backing array at which this iterator starts.
 void remove()
          Remove is not supported for array iterators.
 XBooleanIterator toFirst()
          Resets the iterator to the beginning.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XBooleanArrayIterator

public XBooleanArrayIterator(boolean[] array)
Constructs a new array iterator.

Parameters:
array - The array to iterate.

XBooleanArrayIterator

public XBooleanArrayIterator(boolean[] array,
                             int offset,
                             int length)
Constructs a new array iterator.

Parameters:
array - The backing array.
offset - The offset into the array.
length - The length the number of elements including the offset to iterate.
Method Detail

array

public final boolean[] array()
The array backing this iterator.

Returns:
The array backing the iterator.

offset

public final int offset()
Gets the offset into the backing array at which this iterator starts.

Returns:
The backing array offset.

length

public final int length()
Gets the length of the iterator (the number of elements it returns starting with the offset).

Returns:
The length of elements returned from the iterator's offset.

hasNext

public final boolean hasNext()
Description copied from interface: XBooleanIterator
Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Specified by:
hasNext in interface XBooleanIterator
Returns:
true if the iterator has more elements.

next

public final boolean next()
Description copied from interface: XBooleanIterator
Returns the next element in the iteration.

Specified by:
next in interface XBooleanIterator
Returns:
the next element in the iteration.

remove

public final void remove()
Remove is not supported for array iterators.

Specified by:
remove in interface XBooleanIterator
Throws:
UnsupportedOperationException - If called.

toFirst

public final XBooleanIterator toFirst()
Description copied from interface: XBooleanIterator
Resets the iterator to the beginning.

Specified by:
toFirst in interface XBooleanIterator


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.