FileDocCategorySizeDatePackage
Iterators6.javaAPI DocExample829Sat Sep 12 03:01:00 BST 1998None

Iterators6

public class Iterators6 extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    HashMap map = new HashMap( true ); // allow duplicates
    map.add( "cat", "beauty" );
    map.add( "dog", "marble" );
    map.add( "cat", "agatha" );
    map.add( "fox", "paula" );
    System.out.println( "map = " + map );

    Range range = map.equalRange( "cat" );
    HashMapIterator iterator = (HashMapIterator) range.begin;
    HashMapIterator last = (HashMapIterator) range.end;
    while ( !iterator.equals( last ) )
      {
      System.out.print( "pair = " + iterator.get() );
      System.out.print( ", key = " + iterator.key() );
      System.out.println( ", value = " + iterator.value() );
      iterator.advance();
      }