Collection Closure : Collection « Apache Common « Java






Collection Closure

import org.apache.commons.collections.Closure;
import org.apache.commons.collections.ClosureUtils;
import org.apache.commons.collections.PredicateUtils;

public class ClosureExample {
  public static void main(String args[]) {
    Closure ifClosure = ClosureUtils.ifClosure(
                       PredicateUtils.equalPredicate(new Integer(20)),
                       ClosureUtils.nopClosure(),
                       ClosureUtils.exceptionClosure());
    ifClosure.execute(new Integer(20));
//    ifClosure.execute(new Integer(30));
  }
}
           
       








ApacheCollectionClosureExample.zip( 513 k)

Related examples in the same category

1.Collection Bag
2.Transformer Example
3.Collection BidiMap
4.Collection Buffer
5.Comparator Example For BuildIn Data Type
6.Comparator Example For User Defined Class
7.Cookie Bag 2
8.Factory Example 1
9.HashMap Example 1
10.List Example 1
11.MapHeaven 1
12.Multi Key Example 1
13.MultiKey Example 2
14.Set Example 1
15.Set Example 2
16.Bean Comparator ( Sorting based on Properties of class )Bean Comparator ( Sorting based on Properties of class )