org.apache.commons.collections.primitives
Interface BooleanListIterator

All Superinterfaces:
BooleanIterator
All Known Implementing Classes:
ListIteratorBooleanListIterator, RandomAccessBooleanList.RandomAccessBooleanListIterator

public interface BooleanListIterator
extends BooleanIterator

A bi-directional iterator over boolean values.

Since:
Commons Primitives 1.1
Version:
$Revision: 480460 $ $Date: 2006-11-29 09:14:21 +0100 (Wed, 29 Nov 2006) $
See Also:
BooleanListIteratorListIterator, org.apache.commons.collections.primitives.adapters.BooleanIteratorBooleanListIterator

Method Summary
 void add(boolean element)
          Inserts the specified element into my underlying collection (optional operation).
 boolean hasNext()
          Returns true iff I have more elements when traversed in the forward direction.
 boolean hasPrevious()
          Returns true iff I have more elements when traversed in the reverse direction.
 boolean next()
          Returns the next element in me when traversed in the forward direction.
 int nextIndex()
          Returns the index of the element that would be returned by a subsequent call to next(), or the number of elements in my iteration if I have no next element.
 boolean previous()
          Returns the next element in me when traversed in the reverse direction.
 int previousIndex()
          Returns the index of the element that would be returned by a subsequent call to previous(), or -1 if I have no previous element.
 void remove()
          Removes from my underlying collection the last element returned by next() or previous() (optional operation).
 void set(boolean element)
          Replaces in my underlying collection the last element returned by next() or previous() with the specified value (optional operation).
 

Method Detail

add

void add(boolean 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 next(), if any, and immediately after the next element that would have been returned by previous(), if any.

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

Parameters:
element - the value to be inserted
Throws:
java.lang.UnsupportedOperationException - when this operation is not supported
java.lang.IllegalArgumentException - if some aspect of the specified element prevents it from being added

hasNext

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

Specified by:
hasNext in interface BooleanIterator
Returns:
true iff I have more elements when traversed in the forward direction

hasPrevious

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

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

next

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

Specified by:
next in interface BooleanIterator
Returns:
the next element in me
Throws:
java.util.NoSuchElementException - if there is no next element

nextIndex

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

Returns:
the index of the next element in me

previous

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

Returns:
the previous element in me
Throws:
java.util.NoSuchElementException - if there is no previous element

previousIndex

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

Returns:
the index of the previous element in me

remove

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

Specified by:
remove in interface BooleanIterator
Throws:
java.lang.UnsupportedOperationException - if this operation is not supported
java.lang.IllegalStateException - if neither next() nor previous() has yet been called, or remove() or add(boolean) has already been called since the last call to next() or previous().

set

void set(boolean element)
Replaces in my underlying collection the last element returned by next() or previous() with the specified value (optional operation).

Parameters:
element - the value to replace the last returned element with
Throws:
java.lang.UnsupportedOperationException - if this operation is not supported
java.lang.IllegalStateException - if neither next() nor previous() has yet been called, or remove() or add(boolean) has already been called since the last call to next() or previous().
java.lang.IllegalArgumentException - if some aspect of the specified element prevents it from being added


Copyright © 2002-2009 Apache Software Foundation. All Rights Reserved.