ssing keys/values through an iterator: for ( TDoubleObjectIterator it = map.iterator(); it.hasNext(); ) { it.advance(); if ( satisfiesCondition( it.key() ) ) { doSomethingWithValue( it.value() ); } }
// modifying values in-place through iteration: for ( TDoubleObjectIterator it = map.iterator(); it.hasNext(); ) { it.advance(); if ( satisfiesCondition( it.key() ) ) { it.setValue( newValueForKey( it.key() ) ); } }
// deleting entries during iteration: for ( TDoubleObjectIterator it = map.iterator(); it.hasNext(); ) { it.advance(); if ( satisfiesCondition( it.key() ) ) { it.remove(); } }
// faster iteration by avoiding hasNext(): TDoubleObjectIterator iterator = map.iterator(); for ( int i = map.size(); i-- > 0; ) { iterator.advance(); doSomethingWithKeyAndValue( iterator.key(), iterator.value() ); }
@author Eric D. Friedman
@author Rob Eden
@author Jeff Randall
@version $Id: _E_ObjectIterator.template,v 1.1.2.1 2009/09/15 02:38:31 upholderoftruth Exp $