1 16 package org.apache.commons.collections.functors; 17 18 import java.io.Serializable ; 19 20 import org.apache.commons.collections.Predicate; 21 22 31 public final class IdentityPredicate implements Predicate, Serializable { 32 33 34 static final long serialVersionUID = -89901658494523293L; 35 36 37 38 private final Object iValue; 39 40 47 public static Predicate getInstance(Object object) { 48 if (object == null) { 49 return NullPredicate.INSTANCE; 50 } 51 return new IdentityPredicate(object); 52 } 53 54 60 public IdentityPredicate(Object object) { 61 super(); 62 iValue = object; 63 } 64 65 72 public boolean evaluate(Object object) { 73 return (iValue == object); 74 } 75 76 82 public Object getValue() { 83 return iValue; 84 } 85 86 } 87 | Popular Tags |