home *** CD-ROM | disk | FTP | other *** search
/ BUG 15 / BUGCD1998_06.ISO / aplic / jbuilder / jsamples.z / Algorithms4.java < prev    next >
Encoding:
Java Source  |  1997-07-30  |  756 b   |  27 lines

  1. // Copyright(c) 1996,1997 ObjectSpace, Inc.
  2. import COM.objectspace.jgl.*;
  3.  
  4. /**
  5.  * Finding provides algorithms for locating elements in a container.
  6.  *
  7.  * @see COM.objectspace.jgl.Finding
  8.  * @version 2.0.2
  9.  * @author ObjectSpace, Inc.
  10.  */
  11.  
  12. public class Algorithms4
  13.   {
  14.   public static void main( String[] args )
  15.     {
  16.     int ints[] = { 3, 7, 8, 2, -5, 8, 9, -2 };
  17.     IntArray array = new IntArray( ints );
  18.     System.out.println( "array = " + array );
  19.  
  20.     Integer negative = (Integer) Finding.detect( array, new NegativeNumber() );
  21.     System.out.println( "first negative = " + negative );
  22.  
  23.     boolean some = Finding.some( array, new NegativeNumber() );
  24.     System.out.println( "some items are negative = " + some );
  25.     }
  26.   }
  27.