FileDocCategorySizeDatePackage
Filtering2.javaAPI DocExample1254Sat Sep 12 03:01:00 BST 1998None

Filtering2

public class Filtering2 extends Object
Selecting and rejecting elements from a container
see
com.objectspace.jgl.algorithms.Filtering
version
3.0.0
author
ObjectSpace, Inc.

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

    HashSet set = new HashSet( true ); // allow duplicates
    set.add( "dog" );
    set.add( "monkey" );
    set.add( "lion" );
    set.add( "dog" );
    set.add( "armadillo" );
    set.add( "zebra" );
    System.out.println( "Original set: " + set + "\n" );

    System.out.println
      (
      "Collecting strings > 5 chars: " + Filtering.select
        (
        set,
        new Filtering2UnaryPredicate()
        )
      );
    System.out.println
      (
      " Rejecting strings > 5 chars: " + Filtering.reject
        (
        set,
        new Filtering2UnaryPredicate()
        )
      );