home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-06-26 | 688 b | 26 lines |
- // Copyright(c) 1996 ObjectSpace, Inc.
-
- import jgl.*;
-
- public class Algorithms3
- {
- public static void main( String[] args )
- {
- SList list = new SList();
- list.add( new Integer( -1 ) );
- list.add( new Integer( 1 ) );
- list.add( new Integer( -2 ) );
- list.add( new Integer( 1 ) );
- list.add( new Integer( -3 ) );
- System.out.println( "list = " + list );
-
- Object value = new Integer( 1 );
- int n1 = Counting.count( list, value );
- System.out.println( "Occurences of " + value + " = " + n1 );
-
- int n2 = Counting.countIf( list, new NegativeInteger() );
- System.out.println( "Occurences of a negative = " + n2 );
- }
- }
-
-