com.sun.sgs.app.util
Class ScalableHashMap.ConcurrentIterator<E,K,V>

java.lang.Object
  extended by com.sun.sgs.app.util.ScalableHashMap.ConcurrentIterator<E,K,V>
All Implemented Interfaces:
Serializable, Iterator<E>
Enclosing class:
ScalableHashMap<K,V>

abstract static class ScalableHashMap.ConcurrentIterator<E,K,V>
extends Object
implements Iterator<E>, Serializable

A concurrent, persistable Iterator implementation for the ScalableHashMap. This implementation is stable with respect to concurrent changes to the associated collection, but may ignore additions and removals made to the collection during iteration, and may also visit more than once a key value that is removed and re-added.


Constructor Summary
ScalableHashMap.ConcurrentIterator(ScalableHashMap<K,V> root)
          Constructs a new ConcurrentIterator.
 
Method Summary
 boolean hasNext()
          
(package private)  Map.Entry<K,V> nextEntry()
          Returns the next entry in the ScalableHashMap.
 void remove()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Iterator
next
 

Constructor Detail

ScalableHashMap.ConcurrentIterator

ScalableHashMap.ConcurrentIterator(ScalableHashMap<K,V> root)
Constructs a new ConcurrentIterator.

Parameters:
root - the root node of the ScalableHashMap
Method Detail

hasNext

public boolean hasNext()

Specified by:
hasNext in interface Iterator<E>

nextEntry

Map.Entry<K,V> nextEntry()
Returns the next entry in the ScalableHashMap. Note that due to the concurrent nature of this iterator, this method may skip elements that have been added after the iterator was constructed. Likewise, it may return new elements that have been added. This implementation is guaranteed never to return an element more than once.

This method will never throw a ConcurrentModificationException.

Returns:
the next entry in the ScalableHashMap
Throws:
NoSuchElementException - if no further entries exist

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