FileDocCategorySizeDatePackage
HashMap2.javaAPI DocExample1304Sat Sep 12 03:01:00 BST 1998None

HashMap2

public class HashMap2 extends Object
Accessing keys and values.
see
com.objectspace.jgl.HashMap
version
3.0.0
author
ObjectSpace, Inc.

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

    HashMap map = new HashMap();
    map.add( "cat", "Meow" );
    map.add( "ape", "Squeak" );
    map.add( "dog", "Woof" );
    map.add( "bat", "Squeak" );
    System.out.println( "map = " + map );

    System.out.print( "Enumerate the HashMap: " );
    Enumeration e = map.elements();
    while ( e.hasMoreElements() )
      System.out.print( e.nextElement() + " ");
    System.out.println();

    System.out.print( "map.keys() = " );
    e = map.keys();
    while ( e.hasMoreElements() )
      System.out.print( e.nextElement() + " ");
    System.out.println();

    System.out.print( "map.keys( Squeak ) = " );
    e = map.keys( "Squeak" );
    while ( e.hasMoreElements() )
      System.out.print( e.nextElement() + " ");
    System.out.println();

    System.out.print( "map.values( bat ) = " );
    e = map.values( "bat" );
    while ( e.hasMoreElements() )
      System.out.print( e.nextElement() + " ");
    System.out.println();