FileDocCategorySizeDatePackage
Sequences4.javaAPI DocExample1201Sat Sep 12 03:01:00 BST 1998None

Sequences4

public class Sequences4 extends Object

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

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

    array.insert( 0, 9, "x" );
    System.out.print( "array = " + array + ", size = " + array.size() );
    System.out.println( ", capacity = " + array.capacity() );

    for ( int i = 0; i < 2; i++ )
      {
      array.add( "x" ); // Causes reallocation of internal storage.
      System.out.print( "array = " + array + ", size = " + array.size() );
      System.out.println( ", capacity = " + array.capacity() );
      }

    array.ensureCapacity( 1000 ); // Force reallocation of internal storage.
    System.out.print( "array = " + array + ", size = " + array.size() );
    System.out.println( ", capacity = " + array.capacity() );

    array.trimToSize(); // Reduce capacity to the minimum required.
    System.out.print( "array = " + array + ", size = " + array.size() );
    System.out.println( ", capacity = " + array.capacity() );