FileDocCategorySizeDatePackage
Maps5.javaAPI DocExample862Sat Sep 12 03:01:00 BST 1998None

Maps5

public class Maps5 extends Object

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

    // Order key-value pairs in descending lexicographical order of keys.
    OrderedMap map = new OrderedMap( new GreaterString(), true );
    map.add( "10", "X" );
    map.add( "10", "ten" );
    map.add( "5", "V" );
    map.add( "5", "five" );

    System.out.println( "map = " + map );
    int n = map.count( "10" );
    System.out.println( "There are " + n + " key-value pairs with key 10" );

    System.out.println( "Removing all occurrences of 10..." );
    map.remove( "10" );

    n = map.count( "10" );
    System.out.println( "There are now " + n + " key-value pairs with key 10" );
    System.out.println( "map = " + map );