FileDocCategorySizeDatePackage
SList1.javaAPI DocExample1622Sat Sep 12 03:01:00 BST 1998None

SList1

public class SList1 extends Object
Construction, enumeration, access, pushing, popping.
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.pushBack( "bat" );
    list.add( "cat" );
    list.pushFront( "ape" );
    System.out.println( list );
    System.out.println();

    System.out.println( "Enumerate the SList" );
    Enumeration e = list.elements();
    while ( e.hasMoreElements() )
      System.out.println( e.nextElement() );
    System.out.println();

    System.out.println( "Iterate through the SList" );
    for ( SListIterator i = list.begin(); !i.equals( list.end() ); i.advance() )
      System.out.println( i.get() );
    System.out.println();

    System.out.println( "Demonstrate access" );
    System.out.println( "list.at( 0 ) = " + list.at( 0 ) );
    System.out.println( "list.front() = " + list.front() );
    System.out.println( "list.at( 2 ) = " + list.at( 2 ) );
    System.out.println( "list.back() = " + list.back() );
    System.out.println();

    System.out.println( "Demonstrate modification" );
    list.put( 1, "fox" );
    System.out.println( list );

    System.out.println( "popFront() returns: " + list.popFront() );
    System.out.println( "After popFront() = " + list );

    System.out.println( "popBack() returns: " + list.popBack() );
    System.out.println( "After popBack() = " + list );