FileDocCategorySizeDatePackage
Comparing1.javaAPI DocExample1565Sat Sep 12 03:01:00 BST 1998None

Comparing1

public class Comparing1 extends Object
Mismatching, equality, lexicographical comparison.
see
com.objectspace.jgl.algorithms.Comparing
version
3.0.0
author
ObjectSpace, Inc.

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

    Object median = Comparing.median( "cat", "ape", "dog", new LessString() );
    System.out.println( "median of cat, ape and dog = " + median );
    System.out.println();

    Array array1 = new Array();
    array1.add( "ape" );
    array1.add( "bat" );
    array1.add( "emu" );

    Array array2 = new Array();
    array2.add( "ape" );
    array2.add( "bat" );
    array2.add( "dog" );
    array2.add( "cat" );

    System.out.println( "array1 = " + array1 );
    System.out.println( "array2 = " + array2 );

    Pair pair = Comparing.mismatch( array1, array2 );
    System.out.println( "array1 mismatch @ " + ( (ArrayIterator)pair.first).get() );
    System.out.println( "array2 mismatch @ " + ( (ArrayIterator)pair.second).get() );

    Deque deque1 = new Deque();
    deque1.add( "ape" );
    deque1.add( "bat" );
    deque1.add( "dog" );
    deque1.add( "cat" );
    System.out.println( "array2 equals deque1? " + Comparing.equal( array2, deque1 ) );

    boolean result = Comparing.lexicographicalCompare( array1, deque1, new LessString() );
    System.out.println( "(array1 < deque1) = " + result );