FileDocCategorySizeDatePackage
Replacing1.javaAPI DocExample1193Sat Sep 12 03:01:00 BST 1998None

Replacing1

public class Replacing1 extends Object
Replacing an element in a native array of primitives, copy during replacement.
see
com.objectspace.jgl.algorithms.Replacing
version
3.0.0
author
ObjectSpace, Inc.

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

    int intArray[] = { 3, 6, 2, 1, 9, 6, 4, 2 };
    IntArray i = new IntArray( intArray );
    System.out.print( "Before: " );
    Printing.println( i.start(), i.finish() );
    Replacing.replace( i.start(), i.finish(), new Integer( 6 ), new Integer( 0 ) );
    System.out.print( "After: " );
    Printing.println( i.start(), i.finish() );

    Array array = new Array();
    array.add( "ape" );
    array.add( "cat" );
    array.add( "bat" );
    array.add( "cat" );
    Deque deque = new Deque();
    Replacing.replaceCopy( array, new InsertIterator( deque ), "cat", "emu" );
    System.out.println( "array = " + array + ", deque = " + deque );