PCJ API
Version 1.2

bak.pcj.adapter
Class CharListIteratorToListIteratorAdapter

java.lang.Object
  extended bybak.pcj.adapter.CharListIteratorToListIteratorAdapter
All Implemented Interfaces:
Iterator, ListIterator

public class CharListIteratorToListIteratorAdapter
extends Object
implements ListIterator

This class represents adaptions of primitive list iterators over char values to Java Collections Framework list iterators.

Since:
1.0

Field Summary
protected  CharListIterator iterator
          The underlying primitive iterator.
 
Constructor Summary
CharListIteratorToListIteratorAdapter(CharListIterator iterator)
          Creates a new adaption of a primitive list iterator over char values to a Java Collections Framework list iterator.
 
Method Summary
 void add(Object o)
          Adds a specified element to the list at this iterator's current position.
 boolean hasNext()
          Indicates whether more values can be returned by this iterator.
 boolean hasPrevious()
          Indicates whether more values can be returned by this iterator by calling previous().
 Object next()
          Returns the next value of this iterator.
 int nextIndex()
          Returns the index of the element that would be returned by a call to next().
 Object previous()
          Returns the previous value of this iterator.
 int previousIndex()
          Returns the index of the element that would be returned by a call to previous().
 void remove()
          Removes the last value returned from the underlying collection.
 void set(Object o)
          Sets the last element returned to a specified value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iterator

protected CharListIterator iterator
The underlying primitive iterator.

Constructor Detail

CharListIteratorToListIteratorAdapter

public CharListIteratorToListIteratorAdapter(CharListIterator iterator)
Creates a new adaption of a primitive list iterator over char values to a Java Collections Framework list iterator.

Parameters:
iterator - the primitive iterator to adapt.
Throws:
NullPointerException - if iterator is null.
Method Detail

add

public void add(Object o)
Adds a specified element to the list at this iterator's current position.

Specified by:
add in interface ListIterator
Parameters:
o - the element to add.
Throws:
UnsupportedOperationException - if addition is not supported by this iterator.
ClassCastException - if o is not of class Character.
NullPointerException - if o is null.

hasNext

public boolean hasNext()
Indicates whether more values can be returned by this iterator.

Specified by:
hasNext in interface ListIterator
Returns:
true if more values can be returned by this iterator; returns false otherwise.
See Also:
next()

hasPrevious

public boolean hasPrevious()
Indicates whether more values can be returned by this iterator by calling previous().

Specified by:
hasPrevious in interface ListIterator
Returns:
true if more values can be returned by this iterator in backwards direction; returns false otherwise.
See Also:
previous()

next

public Object next()
Returns the next value of this iterator.

Specified by:
next in interface ListIterator
Returns:
the next value of this iterator.
Throws:
NoSuchElementException - if no more elements are available from this iterator.
See Also:
hasNext()

nextIndex

public int nextIndex()
Returns the index of the element that would be returned by a call to next().

Specified by:
nextIndex in interface ListIterator
Returns:
the index of the element that would be returned by a call to next().
See Also:
next()

previous

public Object previous()
Returns the previous value of this iterator.

Specified by:
previous in interface ListIterator
Returns:
the previous value of this iterator.
Throws:
NoSuchElementException - if no more elements are available from this iterator in backwards direction.
See Also:
hasPrevious()

previousIndex

public int previousIndex()
Returns the index of the element that would be returned by a call to previous().

Specified by:
previousIndex in interface ListIterator
Returns:
the index of the element that would be returned by a call to previous(); if no more elements are available in backwards direction, -1 is returned.
See Also:
previous()

remove

public void remove()
Removes the last value returned from the underlying collection.

Specified by:
remove in interface ListIterator
Throws:
UnsupportedOperationException - if removal is not supported by this iterator.
IllegalStateException - if no element has been returned by this iterator yet.

set

public void set(Object o)
Sets the last element returned to a specified value.

Specified by:
set in interface ListIterator
Parameters:
o - the new value of the element.
Throws:
UnsupportedOperationException - if replacement is not supported by this iterator.
IllegalStateException - if no element has been returned by this iterator yet.
ClassCastException - if o is not of class Character.
NullPointerException - if o is null.

PCJ API
Version 1.2

Report a bug or request a feature.
Further information on the development and latest release of PCJ can be found at the project homepage.

Primitive Collections for Java is released under the GNU Lesser General Public License.
Copyright © 2002, 2003 Søren Bak. All Rights Reserved.

Hosted by SourceForge.net
SourceForge.net Logo