home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 15
/
BUGCD1998_06.ISO
/
aplic
/
jbuilder
/
jsamples.z
/
Swapping1.java
< prev
next >
Wrap
Text File
|
1997-07-30
|
968b
|
35 lines
// Copyright(c) 1996,1997 ObjectSpace, Inc.
import COM.objectspace.jgl.*;
/**
* Swapping two elements, swapping two sequences.
*
* @see COM.objectspace.jgl.Swapping
* @version 2.0.2
* @author ObjectSpace, Inc.
*/
public class Swapping1
{
public static void main( 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 );
}
}