home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 15
/
BUGCD1998_06.ISO
/
aplic
/
jbuilder
/
jsamples.z
/
Deque2.java
< prev
next >
Wrap
Text File
|
1997-07-30
|
1KB
|
40 lines
// Copyright(c) 1996,1997 ObjectSpace, Inc.
import COM.objectspace.jgl.*;
/**
* Counting, finding, erasing, replacing, removing.
*
* @see COM.objectspace.jgl.Deque
* @version 2.0.2
* @author ObjectSpace, Inc.
*/
public class Deque2
{
public static void main( String[] args )
{
Deque deque = new Deque();
deque.add( "ape" );
deque.add( "bat" );
deque.add( "cat" );
deque.add( "bat" );
deque.add( "bat" );
deque.add( "cat" );
System.out.println( deque );
System.out.println();
System.out.println( "deque.count( bat ) = " + deque.count( "bat" ) );
int index = deque.indexOf( "bat" );
System.out.println( "deque.indexOf( bat ) = " + index );
deque.remove( index );
System.out.println( "After deque.remove( " + index + " ) = " + deque );
deque.replace( 0, 2, "bat", "BAT" );
System.out.println( "After deque.replace( 0, 2, bat, BAT ) = " + deque );
System.out.println( "deque.remove( cat ) = " + deque.remove( "cat" ) );
System.out.println( "After deque.remove( cat ) = " + deque );
deque.remove( deque.begin() );
System.out.println( "After deque.remove( begin() ) = " + deque );
}
}