FileDocCategorySizeDatePackage
Removing1.javaAPI DocExample1211Sat Sep 12 03:01:00 BST 1998None

Removing1

public class Removing1 extends Object
Removing element from a container, conditional removal.
see
com.objectspace.jgl.algorithms.Removing
version
3.0.0
author
ObjectSpace, Inc.

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

    Array array = new Array();
    array.add( "ape" );
    array.add( "cat" );
    array.add( "dog" );
    array.add( "cat" );
    array.add( "emu" );
    System.out.println( "Before = " + array );
    Removing.remove( array, "cat" );
    System.out.println( "After = " + array );

    Deque deque = new Deque();
    deque.add( new Integer( 3 ) );
    deque.add( new Integer( 8 ) );
    deque.add( new Integer( 4 ) );
    deque.add( new Integer( 10 ) );
    DList result = new DList();
    UnaryPredicate predicate = new BindSecondPredicate( new LessNumber(), new Integer( 5 ) );
    Removing.removeCopyIf( deque, new InsertIterator( result ), predicate );
    System.out.println( "deque = " + deque + ", result = " + result );