org.apache.commons.collections.primitives

Interface DoubleListIterator

public interface DoubleListIterator extends DoubleIterator

A bi-directional iterator over double values.

Since: Commons Primitives 1.0

Version: $Revision: 1.3 $ $Date: 2003/10/16 20:49:36 $

Author: Rodney Waldhoff

See Also: DoubleListIteratorListIterator

Method Summary
voidadd(double element)
Inserts the specified element into my underlying collection (optional operation).
booleanhasNext()
Returns true iff I have more elements when traversed in the forward direction.
booleanhasPrevious()
Returns true iff I have more elements when traversed in the reverse direction.
doublenext()
Returns the next element in me when traversed in the forward direction.
intnextIndex()
Returns the index of the element that would be returned by a subsequent call to DoubleListIterator, or the number of elements in my iteration if I have no next element.
doubleprevious()
Returns the next element in me when traversed in the reverse direction.
intpreviousIndex()
Returns the index of the element that would be returned by a subsequent call to DoubleListIterator, or -1 if I have no previous element.
voidremove()
Removes from my underlying collection the last element returned by DoubleListIterator or DoubleListIterator (optional operation).
voidset(double element)
Replaces in my underlying collection the last element returned by DoubleListIterator or DoubleListIterator with the specified value (optional operation).

Method Detail

add

public void add(double element)
Inserts the specified element into my underlying collection (optional operation). The element is inserted immediately before the next element that would have been returned by DoubleListIterator, if any, and immediately after the next element that would have been returned by DoubleListIterator, if any.

The new element is inserted immediately before the implied cursor. A subsequent call to DoubleListIterator will return the added element, a subsequent call to DoubleListIterator will be unaffected. This call increases by one the value that would be returned by a call to DoubleListIterator or DoubleListIterator.

Parameters: element the value to be inserted

Throws: UnsupportedOperationException when this operation is not supported IllegalArgumentException if some aspect of the specified element prevents it from being added

hasNext

public boolean hasNext()
Returns true iff I have more elements when traversed in the forward direction. (In other words, returns true iff a call to DoubleListIterator will return an element rather than throwing an exception.

Returns: true iff I have more elements when traversed in the forward direction

hasPrevious

public boolean hasPrevious()
Returns true iff I have more elements when traversed in the reverse direction. (In other words, returns true iff a call to DoubleListIterator will return an element rather than throwing an exception.

Returns: true iff I have more elements when traversed in the reverse direction

next

public double next()
Returns the next element in me when traversed in the forward direction.

Returns: the next element in me

Throws: NoSuchElementException if there is no next element

nextIndex

public int nextIndex()
Returns the index of the element that would be returned by a subsequent call to DoubleListIterator, or the number of elements in my iteration if I have no next element.

Returns: the index of the next element in me

previous

public double previous()
Returns the next element in me when traversed in the reverse direction.

Returns: the previous element in me

Throws: NoSuchElementException if there is no previous element

previousIndex

public int previousIndex()
Returns the index of the element that would be returned by a subsequent call to DoubleListIterator, or -1 if I have no previous element.

Returns: the index of the previous element in me

remove

public void remove()
Removes from my underlying collection the last element returned by DoubleListIterator or DoubleListIterator (optional operation).

Throws: UnsupportedOperationException if this operation is not supported IllegalStateException if neither DoubleListIterator nor DoubleListIterator has yet been called, or DoubleListIterator or DoubleListIterator has already been called since the last call to DoubleListIterator or DoubleListIterator.

set

public void set(double element)
Replaces in my underlying collection the last element returned by DoubleListIterator or DoubleListIterator with the specified value (optional operation).

Parameters: element the value to replace the last returned element with

Throws: UnsupportedOperationException if this operation is not supported IllegalStateException if neither DoubleListIterator nor DoubleListIterator has yet been called, or DoubleListIterator or DoubleListIterator has already been called since the last call to DoubleListIterator or DoubleListIterator. IllegalArgumentException if some aspect of the specified element prevents it from being added

Copyright (c) 2002-2003 - Apache Software Foundation