home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 15
/
BUGCD1998_06.ISO
/
aplic
/
jbuilder
/
jsamples.z
/
Maps2.java
< prev
next >
Wrap
Text File
|
1997-07-30
|
1KB
|
36 lines
// Copyright(c) 1996,1997 ObjectSpace, Inc.
import COM.objectspace.jgl.*;
public class Maps2
{
public static void main( String[] args )
{
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 );
}
}