home *** CD-ROM | disk | FTP | other *** search
/ ActiveX Programming Unleashed CD / AXU.iso / jgl_1_1 / jgl_1_1.exe / examples / Overview9.java < prev    next >
Encoding:
Java Source  |  1996-07-14  |  643 b   |  21 lines

  1. // Copyright(c) 1996 ObjectSpace, Inc.
  2. import jgl.*;
  3.  
  4. public class Overview9
  5.   {
  6.   public static void main( String[] args )
  7.     {
  8.     Array array1 = new Array();
  9.     array1.add( new Integer( 3 ) );
  10.     array1.add( new Integer( -1 ) );
  11.     array1.add( new Integer( 2 ) );
  12.     UnaryPredicate predicate = new PositiveInteger();
  13.     int n = Counting.countIf( array1, predicate );
  14.     System.out.println( "# of positive numbers in " + array1 + " = " + n );
  15.     Array array2 = new Array();
  16.     Removing.removeCopyIf( array1, array2, predicate );
  17.     System.out.println( "Array without positive numbers = " + array2 );
  18.     }
  19.   }
  20.  
  21.