| 
PCJ API Version 1.2  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbak.pcj.adapter.ListIteratorToByteListIteratorAdapter
This class represents adaptions of Java Collections Framework list iterators to primitive list iterators over byte values.
Adapters from JCF collections to primitive collections will fail if the JCF collection contains null values or values of the wrong class. However, adapters are not fast failing in the case that the underlying collection should contain illegal values. To implement fast failure would require every operation to check every element of the underlying collection before doing anything. Instead validation methods are provided. They can be called using the assertion facility in the client code:
      CollectionToByteCollectionAdapter s;
      ...
      assert s.validate();
  
  or by letting the adapter throw an exception on illegal values:
  
      CollectionToByteCollectionAdapter s;
      ...
      s.evalidate();  // Throws an exception on illegal values
  
  Either way, validation must be invoked directly by the client
  code.
| Field Summary | |
protected  ListIterator | 
iterator
The underlying iterator.  | 
| Constructor Summary | |
ListIteratorToByteListIteratorAdapter(ListIterator iterator)
Creates a new adaption of a list iterator to a primitive list iterator over byte values.  | 
|
| Method Summary | |
 void | 
add(byte v)
Adds a specified element to the list at this iterator's current position.  | 
 boolean | 
hasNext()
Indicates whether more byte values can be returned by this iterator.  | 
 boolean | 
hasPrevious()
Indicates whether more byte values can be returned by this iterator by calling previous().  | 
 byte | 
next()
Returns the next byte value of this iterator.  | 
 int | 
nextIndex()
Returns the index of the element that would be returned by a call to next().  | 
 byte | 
previous()
Returns the previous byte 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 byte value returned from the underlying collection.  | 
 void | 
set(byte v)
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 | 
protected ListIterator iterator
| Constructor Detail | 
public ListIteratorToByteListIteratorAdapter(ListIterator iterator)
iterator - the iterator to adapt to a primitive iterator.
NullPointerException - if iterator is null.| Method Detail | 
public void add(byte v)
ByteListIterator
add in interface ByteListIteratorv - the element to add.public boolean hasNext()
ByteIterator
hasNext in interface ByteIteratorByteIterator.next()public boolean hasPrevious()
ByteListIterator
hasPrevious in interface ByteListIteratorByteListIterator.previous()public byte next()
ByteIterator
next in interface ByteIteratorByteIterator.hasNext()public int nextIndex()
ByteListIterator
nextIndex in interface ByteListIteratorByteIterator.next()public byte previous()
ByteListIterator
previous in interface ByteListIteratorByteListIterator.hasPrevious()public int previousIndex()
ByteListIterator
previousIndex in interface ByteListIteratorByteListIterator.previous()public void remove()
ByteIterator
remove in interface ByteIteratorpublic void set(byte v)
ByteListIterator
set in interface ByteListIteratorv - the new value of the element.
  | 
PCJ API Version 1.2  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||