01: package uk.co.jezuk.mango.binarypredicates;
02:
03: /**
04: * <code>BinaryPredicate</code> testing for inequality
05: * @author Jez Higgins, jez@jezuk.co.uk
06: * @version $Id: NotEqualTo.java 51 2002-06-11 18:43:59Z jez $
07: */
08: public class NotEqualTo implements uk.co.jezuk.mango.BinaryPredicate {
09: /**
10: * @return <code>true</code> if <code>!(x.equals(y))</code>, <code>(x == null && y != null)</code> or <code>(x != null && y == null)</code>
11: */
12: public boolean test(Object x, Object y) {
13: if (x == null && y == null)
14: return false;
15: if (x == null || y == null)
16: return true;
17:
18: return !(x.equals(y));
19: } // test
20: } // NotEqualTo
|