HashMap map = new HashMap( true ); // allow duplicates
Object value;
value = map.add( "Dog", "Marble" );
System.out.println( "value from add = " + value );
value = map.add( "Cat", "Beauty" );
System.out.println( "value from add = " + value );
System.out.println( "map = " + map );
value = map.add( "Cat", "Agatha" );
System.out.println( "value from add = " + value );
System.out.println( "map = " + map );
value = map.get( "Cat" );
System.out.println( "Cat name is " + value );
value = map.get( "Ape" );
System.out.println( "Ape name is " + value );
value = map.put( "Cat", "Agatha" );
System.out.println( "value from put = " + value );
System.out.println( "map = " + map );
String name3 = (String) map.get( "Cat" );
System.out.println( "Cat name is " + name3 );