FileDocCategorySizeDatePackage
DList2.javaAPI DocExample1431Sat Sep 12 03:01:00 BST 1998None

DList2

public class DList2 extends Object
Counting, finding, erasing, replacing, removing.
see
com.objectspace.jgl.DList
version
3.0.0
author
ObjectSpace, Inc.

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

    DList dlist = new DList();
    dlist.add( "ape" );
    dlist.add( "bat" );
    dlist.add( "cat" );
    dlist.add( "bat" );
    dlist.add( "bat" );
    dlist.add( "cat" );
    System.out.println( dlist );
    System.out.println();

    System.out.println( "dlist.count( bat ) = " + dlist.count( "bat" ) );
    DListIterator iterator = dlist.find( "bat" );
    if ( !iterator.atEnd() )
      {
      System.out.println( "object at dlist.find( bat ) = " + iterator.get() );
      dlist.remove( iterator );
      System.out.println( "After dlist.remove( iterator ) = " + dlist );
      }

    DListIterator start = dlist.begin();
    DListIterator finish = dlist.begin();
    finish.advance( 3 );
    dlist.replace( start, finish, "bat", "BAT" );
    System.out.println( "After dlist.replace( start, finish, bat, BAT ) = " + dlist );

    System.out.println( "dlist.remove( cat ) = " + dlist.remove( "cat" ) );
    System.out.println( "After dlist.remove( cat ) = " + dlist );
    dlist.remove( dlist.begin() );
    System.out.println( "After dlist.remove( begin() ) = " + dlist );