FileDocCategorySizeDatePackage
SList2.javaAPI DocExample1403Sat Sep 12 03:01:00 BST 1998None

SList2

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

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

    SList list = new SList();
    list.add( "ape" );
    list.add( "bat" );
    list.add( "cat" );
    list.add( "bat" );
    list.add( "bat" );
    list.add( "cat" );
    System.out.println( list );
    System.out.println();

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

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

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