home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
inprise
/
JSAMPLES.Z
/
Sets2.java
< prev
next >
Wrap
Text File
|
1998-05-08
|
861b
|
28 lines
// Copyright(c) 1996,1997 ObjectSpace, Inc.
import com.objectspace.jgl.*;
import Widget;
import java.util.Enumeration;
public class Sets2
{
public static void main( String[] args )
{
HashSet set = new HashSet( true ); // allow duplicates
Object value;
value = set.add( new Widget( "button", 100 ) );
System.out.println( "value from add = " + value );
value = set.add( new Widget( "menu", 200 ) );
System.out.println( "value from add = " + value );
System.out.println( "set = " + set );
value = set.add( new Widget( "button", 300 ) );
System.out.println( "value from add = " + value );
System.out.println( "set = " + set );
value = set.put( new Widget( "button", 300 ) );
System.out.println( "value from put = " + value );
System.out.println( "set = " + set );
}
}