FileDocCategorySizeDatePackage
Sorting3.javaAPI DocExample1139Sat Sep 12 03:01:00 BST 1998None

Sorting3

public class Sorting3 extends Object
Changing the order of traversal for containers.
see
com.objectspace.jgl.algorithms.Sorting
version
1.0
author
ObjectSpace, Inc.

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

    HashSet s = new HashSet();
    s.add( "Austin" );
    s.add( "Texas" );
    s.add( "Fight" );
    s.add( "longhorn" );
    s.add( "Bevo" );

    // show in the default order
    System.out.print( "normal: " );
    Printing.println( s.begin(), s.end() );

    // show sorted
    System.out.print( "less: " );
    Range r = Sorting.iterSort( s, new LessString() );
    Printing.println( r.begin, r.end );

    // show sorted a different way
    System.out.print( "greater: " );
    r = Sorting.iterSort( s, new GreaterString() );
    Printing.println( r.begin, r.end );

    // show that iterSort() doesn't sort container
    System.out.print( "normal: " );
    Printing.println( s.begin(), s.end() );