FileDocCategorySizeDatePackage
Maps3.javaAPI DocExample824Sat Sep 12 03:01:00 BST 1998None

Maps3

public class Maps3 extends Object

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

    HashMap map = new HashMap( true ); // allow duplicates
    map.add( new Pair( "Dog", "Marble" ) );
    map.add( new Pair( "Cat", "Beauty" ) );
    map.add( new Pair( "Cat", "Agatha" ) );
    System.out.println( "map = " + map );

    System.out.println( "Enumerator through values..." );
    Enumeration values = map.elements();
    while ( values.hasMoreElements() )
      System.out.println( "  " + values.nextElement() );

    System.out.println( "Enumerate through keys..." );
    Enumeration keys = map.keys();
    while ( keys.hasMoreElements() )
      System.out.println( "  " + keys.nextElement() );