KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > uk > co > jezuk > mango > binarypredicates > NotEqualTo


1 package uk.co.jezuk.mango.binarypredicates;
2
3 /**
4  * <code>BinaryPredicate</code> testing for inequality
5  * @author Jez Higgins, jez@jezuk.co.uk
6  * @version $Id: NotEqualTo.java 51 2002-06-11 18:43:59Z jez $
7  */

8 public class NotEqualTo implements uk.co.jezuk.mango.BinaryPredicate
9 {
10   /**
11    * @return <code>true</code> if <code>!(x.equals(y))</code>, <code>(x == null && y != null)</code> or <code>(x != null && y == null)</code>
12    */

13   public boolean test(Object JavaDoc x, Object JavaDoc y)
14   {
15     if(x == null && y == null)
16       return false;
17     if(x == null || y == null)
18       return true;
19
20     return !(x.equals(y));
21   } // test
22
} // NotEqualTo
23
Popular Tags