FileDocCategorySizeDatePackage
Swapping1.javaAPI DocExample1019Sat Sep 12 03:01:00 BST 1998None

Swapping1

public class Swapping1 extends Object
Swapping two elements, swapping two sequences.
see
com.objectspace.jgl.algorithms.Swapping
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( "dog" );
    array.add( "emu" );
    System.out.println( "array = " + array );
    ArrayIterator finish = array.end();
    finish.retreat();
    Swapping.iterSwap( array.begin(), finish );
    System.out.println( "After swapping first and last elements = " + array );

    Deque deque = new Deque();
    deque.add( "pig" );
    deque.add( "hog" );
    System.out.println( "deque = " + deque + ", array = " + array );
    Swapping.swapRanges( deque.begin(), deque.end(), array.begin() );
    System.out.println( "deque = " + deque + ", array = " + array );