01: /**
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */package com.tc.util;
04:
05: /**
06: * An {@link EqualityComparator} that compares objects with {@link Object#equals(Object)}.
07: */
08: public class EqualsEqualityComparator implements EqualityComparator {
09:
10: public static final EqualsEqualityComparator INSTANCE = new EqualsEqualityComparator();
11:
12: private EqualsEqualityComparator() {
13: // Use INSTANCE instead.
14: }
15:
16: public boolean isEquals(Object one, Object two) {
17: if ((one == null) != (two == null))
18: return false;
19: if (one == null)
20: return true;
21:
22: return one.equals(two);
23: }
24:
25: }
|