FileDocCategorySizeDatePackage
Stack1.javaAPI DocExample974Sat Sep 12 03:01:00 BST 1998None

Stack1

public class Stack1 extends Object
Construction, enumeration, pushing, popping.
see
com.objectspace.jgl,Stack
version
3.0.0
author
ObjectSpace, Inc.

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

    // Use an Slist as the underlying data structure.
    Stack stack = new Stack();
    stack.push( "bat" );
    stack.push( "cat" );
    stack.push( "dog" );

    System.out.println( "Print the Stack." );
    System.out.println( stack );
    System.out.println();

    System.out.println( "Non-destructively enumerate the Stack." );
    Enumeration e = stack.elements();
    while ( e.hasMoreElements() )
      System.out.println( e.nextElement() );
    System.out.println();

    System.out.println( "Pop and print each element." );
    while ( !stack.isEmpty() )
      System.out.println( stack.pop() );