public class IntPred implements Predicate { int i; public IntPred(int j) { i = j; } // constructor public boolean predicate(Object b) { if (b instanceof Integer) { int k = ((Integer)b).intValue(); return (i == k); } else { throw new RuntimeException("Bad predicate test"); } } } /* IntPred is a Predicate, and has a method called predicate that takes an object and delivers true or false. The constructor IntPred(3) delivers a test "is the object 3?" and can be thought of as something similar to a partially applicable function. Do a search on Currying if you want to know more */