FileDocCategorySizeDatePackage
MinMax1.javaAPI DocExample1180Sat Sep 12 03:01:00 BST 1998None

MinMax1

public class MinMax1 extends Object
Minimum and maximum elements of an SGL container and a native array of ints.
see
com.objectspace.jgl.algorithms.MinMax
version
3.0.0
author
ObjectSpace, Inc.

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    Array array = new Array();
    array.add( "cat" );
    array.add( "ape" );
    array.add( "bat" );
    ArrayIterator min = (ArrayIterator)MinMax.minElement( array, new LessString() );
    System.out.println( "array = " + array );
    System.out.println( "min = " + min.get() + " at index " + min.index() );

    int intArray[] = { 3, 2, 7, 8, 1, 6 };
    IntIterator begin = IntIterator.begin( intArray );
    IntIterator end = IntIterator.end( intArray );
    IntIterator max = (IntIterator)MinMax.maxElement( begin, end );
    System.out.println( "intArray = " + Printing.toString( begin, end ) );
    System.out.println( "max = " + max.get() + " at index " + max.index() );