FileDocCategorySizeDatePackage
Maps4.javaAPI DocExample791Sat Sep 12 03:01:00 BST 1998None

Maps4

public class Maps4 extends Object

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

    // Order key-value pairs based on the hash value of the key.
    OrderedMap map1 = new OrderedMap();
    map1.put( new Integer( 1 ), "one" );
    map1.put( new Integer( 3 ), "three" );
    map1.put( new Integer( 2 ), "two" );
    System.out.println( "map1 = " + map1 );

    // Order key-value pairs in descending numeric order of key.
    OrderedMap map2 = new OrderedMap( new GreaterNumber() );
    map2.put( new Integer( 1 ), "one" );
    map2.put( new Integer( 3 ), "three" );
    map2.put( new Integer( 2 ), "two" );
    System.out.println( "map2 = " + map2 );