FileDocCategorySizeDatePackage
Algorithms3.javaAPI DocExample979Sat Sep 12 03:01:00 BST 1998None

Algorithms3

public class Algorithms3 extends Object
Counting provides algorithms for tabulating the elements of a container.
see
com.objectspace.jgl.algorithms.Counting
version
3.0.0
author
ObjectSpace, Inc.

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.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 NegativeNumber() );
    System.out.println( "Occurences of a negative = " + n2 );