org.joda.primitives.listiterator.impl
Class ArrayByteListIterator

java.lang.Object
  extended by org.joda.primitives.listiterator.impl.ArrayByteListIterator
All Implemented Interfaces:
Iterator<Byte>, ListIterator<Byte>, ByteIterator, PrimitiveIterator<Byte>, ByteListIterator, PrimitiveListIterator<Byte>

public class ArrayByteListIterator
extends Object
implements ByteListIterator

An iterator over an array of byte values.

This class implements ListIterator allowing seamless integration with other APIs.

The iterator can be reset to the start if required. add() and remove() are unsupported, but set() is supported.

Since:
1.0
Version:
CODE GENERATED
Author:
Stephen Colebourne, Jason Tiscione

Field Summary
protected  byte[] array
          The array to iterate over
protected  int cursor
          Cursor position
protected  int last
          Last returned position
 
Constructor Summary
ArrayByteListIterator(byte[] array)
          Constructs an iterator over an array of byte values.
 
Method Summary
 void add(byte value)
          Adds the specified value to the list underlying the iterator at the current iteration index (optional operation).
 void add(Byte value)
           
static ArrayByteListIterator copyOf(byte[] array)
          Creates an iterator over a copy of an array of byte values.
 boolean hasNext()
           
 boolean hasPrevious()
           
 boolean isModifiable()
          Checks whether the iterator can currently be modified.
 boolean isResettable()
          Checks whether the iterator can be reset.
 Byte next()
           
 byte nextByte()
          Gets the next value from the iterator
 int nextIndex()
           
 Byte previous()
           
 byte previousByte()
          Gets the previous value from the iterator.
 int previousIndex()
           
 void remove()
           
 void reset()
          Resets the iterator back to its initial state (optional operation).
 void set(byte value)
          Sets the last retrieved value from the iterator (optional operation).
 void set(Byte value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

array

protected final byte[] array
The array to iterate over


cursor

protected int cursor
Cursor position


last

protected int last
Last returned position

Constructor Detail

ArrayByteListIterator

public ArrayByteListIterator(byte[] array)
Constructs an iterator over an array of byte values.

The array is assigned internally, thus the caller holds a reference to the internal state of the returned iterator. It is not recommended to modify the state of the array after construction.

Parameters:
array - the array to iterate over, must not be null
Throws:
IllegalArgumentException - if the array is null
Method Detail

copyOf

public static ArrayByteListIterator copyOf(byte[] array)
Creates an iterator over a copy of an array of byte values.

The specified array is copied, ensuring the original data is unaltered. Note that the class is not immutable due to the set methods.

Parameters:
array - the array to iterate over, must not be null
Throws:
IllegalArgumentException - if the array is null

isModifiable

public boolean isModifiable()
Description copied from interface: PrimitiveIterator
Checks whether the iterator can currently be modified.

Specified by:
isModifiable in interface PrimitiveIterator<Byte>
Returns:
true if the modification methods of the iterator can be used

isResettable

public boolean isResettable()
Description copied from interface: PrimitiveIterator
Checks whether the iterator can be reset.

Specified by:
isResettable in interface PrimitiveIterator<Byte>
Returns:
true if the object can be reset

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<Byte>
Specified by:
hasNext in interface ListIterator<Byte>

nextIndex

public int nextIndex()
Specified by:
nextIndex in interface ListIterator<Byte>

nextByte

public byte nextByte()
Description copied from interface: ByteIterator
Gets the next value from the iterator

Specified by:
nextByte in interface ByteIterator
Returns:
the next available value

next

public Byte next()
Specified by:
next in interface Iterator<Byte>
Specified by:
next in interface ListIterator<Byte>

hasPrevious

public boolean hasPrevious()
Specified by:
hasPrevious in interface ListIterator<Byte>

previousIndex

public int previousIndex()
Specified by:
previousIndex in interface ListIterator<Byte>

previousByte

public byte previousByte()
Description copied from interface: ByteListIterator
Gets the previous value from the iterator.

Specified by:
previousByte in interface ByteListIterator
Returns:
the previous available value

previous

public Byte previous()
Specified by:
previous in interface ListIterator<Byte>

add

public void add(byte value)
Description copied from interface: ByteListIterator
Adds the specified value to the list underlying the iterator at the current iteration index (optional operation).

Specified by:
add in interface ByteListIterator
Parameters:
value - the value to add

add

public void add(Byte value)
Specified by:
add in interface ListIterator<Byte>

remove

public void remove()
Specified by:
remove in interface Iterator<Byte>
Specified by:
remove in interface ListIterator<Byte>

set

public void set(byte value)
Description copied from interface: ByteListIterator
Sets the last retrieved value from the iterator (optional operation).

Specified by:
set in interface ByteListIterator
Parameters:
value - the value to set

set

public void set(Byte value)
Specified by:
set in interface ListIterator<Byte>

reset

public void reset()
Description copied from interface: PrimitiveIterator
Resets the iterator back to its initial state (optional operation).

Specified by:
reset in interface PrimitiveIterator<Byte>


Copyright © 2005-2010 Joda.org. All Rights Reserved.