home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-07-15 | 551 b | 18 lines |
- // Copyright(c) 1996 ObjectSpace, Inc.
- import jgl.*;
-
- public class Functions1
- {
- public static void main( String[] args )
- {
- Array array = new Array();
- array.add( new Integer( 3 ) );
- array.add( new Integer( -2 ) );
- array.add( new Integer( 3 ) );
- array.add( new Integer( -5 ) );
- array.add( new Integer( -4 ) );
- UnaryPredicate predicate = new PositiveInteger();
- int n = Counting.countIf( array, predicate );
- System.out.println( "Number of positive Integers in " + array + " = " + n );
- }
- }