com.sun.sgs.app.util
Class ScalableDeque.BidirectionalDequeIterator<E>

java.lang.Object
  extended by com.sun.sgs.app.util.ScalableDeque.BidirectionalDequeIterator<E>
Type Parameters:
E - the type of elements returned by the iterator
All Implemented Interfaces:
Serializable, Iterator<E>
Enclosing class:
ScalableDeque<E>

static class ScalableDeque.BidirectionalDequeIterator<E>
extends Object
implements Iterator<E>, Serializable

A implementation of the iterator for the ScalableDeque that allows element traverse from head-to-tail or tail-to-head as required.

If an iterator is created for an empty deque, and then serialized, it will remain valid upon any subsequent deserialization. An iterator in this state, where it has been created but next has never been called, will always begin an the first entry in the map, if any, since its deserialization.


Constructor Summary
ScalableDeque.BidirectionalDequeIterator(ScalableDeque<E> deque, boolean isReverse)
          Constructs a new BidirectionalDequeIterator.
 
Method Summary
 boolean hasNext()
          
 E next()
          Returns the next element in the ScalableDeque.
 void remove()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScalableDeque.BidirectionalDequeIterator

ScalableDeque.BidirectionalDequeIterator(ScalableDeque<E> deque,
                                         boolean isReverse)
Constructs a new BidirectionalDequeIterator.

Parameters:
deque - the deque that will be iterated over
isReverse - whether this iterator should traverse the provided deque from tail to head
Method Detail

hasNext

public boolean hasNext()

Specified by:
hasNext in interface Iterator<E>

next

public E next()
Returns the next element in the ScalableDeque. This method will throw a ConcurrentModificationException if the next element that the iterator was set to return has been removed from the deque, and hasNext() as not been called first.

Specified by:
next in interface Iterator<E>
Returns:
the next element in the ScalableDeque
Throws:
NoSuchElementException - if no further entries exist
ConcurrentModificationException - if the next element of this iterator has been removed from the deque and hasNext() had not been called prior to this method.

remove

public void remove()

Specified by:
remove in interface Iterator<E>

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved