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()
)
);