home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
inprise
/
JSAMPLES.Z
/
Maps2.java
< prev
next >
Wrap
Text File
|
1998-05-08
|
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 );
}
}