home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-07-15 | 673 b | 27 lines |
- // Copyright(c) 1996 ObjectSpace, Inc.
- import jgl.*;
- import java.util.Enumeration;
-
- public class Iterators9
- {
- public static void main( String[] args )
- {
- Array array = new Array();
- array.add( "ape" );
- array.add( "bat" );
- array.add( "cat" );
-
- OutputStreamIterator output = new OutputStreamIterator( System.out );
- Enumeration input = array.elements();
-
- while( input.hasMoreElements() )
- output.put( input.nextElement() );
- System.out.println(); // Flush output.
-
- // You can use an algorithm to do the same thing.
- Copying.copy( array, output );
- System.out.println(); // Flush output.
- }
- }
-
-