1 16 package org.apache.commons.collections.functors; 17 18 import java.io.Serializable ; 19 import java.util.HashSet ; 20 import java.util.Set ; 21 22 import org.apache.commons.collections.Predicate; 23 24 33 public final class UniquePredicate implements Predicate, Serializable { 34 35 36 static final long serialVersionUID = -3319417438027438040L; 37 38 39 private final Set iSet = new HashSet (); 40 41 47 public static Predicate getInstance() { 48 return new UniquePredicate(); 49 } 50 51 55 public UniquePredicate() { 56 super(); 57 } 58 59 66 public boolean evaluate(Object object) { 67 return iSet.add(object); 68 } 69 70 } 71 | Popular Tags |