home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 15
/
BUGCD1998_06.ISO
/
aplic
/
jbuilder
/
jsamples.z
/
HashSet7.java
< prev
next >
Wrap
Text File
|
1997-07-30
|
1KB
|
35 lines
import java.util.Enumeration;
import COM.objectspace.jgl.*;
/**
* Using another BinaryPredicate for matching
*
* @see COM.objectspace.jgl.HashSet
* @version 2.0.2
* @author ObjectSpace, Inc.
*/
public class HashSet7
{
public static void main( String[] args )
{
HashSet set = new HashSet( new IdenticalTo() );
set.add( new Integer( 6 ) );
set.add( new Integer( 1 ) );
set.add( new Integer( 4 ) );
// this WILL work because it is a seperate object than the other Integer(1)
set.add( new Integer( 1 ) );
System.out.println( set );
System.out.println();
System.out.println( "Add an object Integer(100)" );
Integer tryit = new Integer(100);
System.out.println( "add returns: " + set.add( tryit ) );
System.out.println( "set = " + set );
System.out.println( "Try to add the EXACT same object Integer(100)" );
System.out.println( "add returns: " + set.add( tryit ) );
System.out.println( "set = " + set );
}
}