FileDocCategorySizeDatePackage
Sequences5.javaAPI DocExample1259Sat Sep 12 03:01:00 BST 1998None

Sequences5

public class Sequences5 extends Object

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

    String strings1[] = { "ape", "bat", "cat" };
    Array array = new Array( strings1 );

    System.out.print( "array = " + array + ", size = " + array.size() );
    System.out.println( ", capacity = " + array.capacity() );

    array.put( 2, "CAT" );
    System.out.println( "array = " + array );
    System.out.print( "Original = " );
    for ( int i = 0; i < strings1.length; i++ )
      System.out.print( strings1[ i ] + " " );
    System.out.println();

    array.add( "dog" ); // Forces reallocation of storage.
    System.out.print( "array = " + array + ", size = " + array.size() );
    System.out.println( ", capacity = " + array.capacity() );
    System.out.print( "Original = " );
    for ( int i = 0; i < strings1.length; i++ )
      System.out.print( strings1[ i ] + " " );
    System.out.println();

    String string2[] = new String[ array.size() ];
    array.copyTo( string2 ); // Copy contents of array into native array.

    for ( int i = 0; i < string2.length; i++ )
      System.out.print( string2[ i ] + " " );
    System.out.println();