FileDocCategorySizeDatePackage
Array1.javaAPI DocExample1551Sat Sep 12 03:01:00 BST 1998None

Array1

public class Array1 extends Object
Construction, enumeration, access, pushing, popping.
see
com.objectspace.jgl.Array
version
3.0.0
author
ObjectSpace, Inc.

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

    Array array = new Array();
    array.pushBack( "bat" );
    array.add( "cat" );
    array.pushFront( "ape" );
    System.out.println( array );
    System.out.println();

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

    System.out.println( "Iterate through the Array" );
    for ( ArrayIterator i = array.begin(); !i.equals( array.end() ); i.advance() )
      System.out.println( i.get() );
    System.out.println();

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

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

    array.popFront();
    System.out.println( "After popFront() = " + array );

    array.popBack();
    System.out.println( "After popBack() = " + array );