home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 October A / Pcwk10a98.iso / Inprise / TRIAL / JBUILDER / JSAMPLES.Z / Overview2.java < prev    next >
Text File  |  1998-05-08  |  683b  |  26 lines

  1. // Copyright(c) 1996,1997 ObjectSpace, Inc.
  2. import com.objectspace.jgl.*;
  3.  
  4. public class Overview2
  5.   {
  6.   public static void main( String[] args )
  7.     {
  8.     HashSet set1 = new HashSet();
  9.     set1.add( "red" );
  10.     set1.add( "blue" );
  11.     set1.add( "green" );
  12.  
  13.     HashSet set2 = new HashSet();
  14.     set2.add( "yellow" );
  15.     set2.add( "blue" );
  16.  
  17.     HashSet set3 = set1.union( set2 );
  18.     HashSet set4 = set1.intersection( set2 );
  19.  
  20.     System.out.println( "set1 = " + set1 );
  21.     System.out.println( "set2 = " + set2 );
  22.     System.out.println( "union of set1 and set2 = " + set3 );
  23.     System.out.println( "intersection of set1 and set2 = " + set4 );
  24.     }
  25.   }
  26.