WeakLogic { public static <T> boolean weakEquals(T x, T y) { return x == null ? y == null : x.equals(y); } private  WeakLogic(); static Comparator<T> weakComparator(Comparator<? super T> comparator); static Comparator<T> weakComparator(); static BinaryOperator<T> weakBinaryOperator(BinaryOperator<T> op); static UnaryOperator<T> weakUnaryOperator(UnaryOperator<T> op); static Function<F, T> weakFunction(Function<F, T> f); static boolean weakEquals(T x, T y);  }
@Test public void testWeakEquals() { boolean b = weakEquals(null, null); assertTrue(b); b = weakEquals("xxx", null); assertFalse(b); b = weakEquals(null, "xxx"); assertFalse(b); b = weakEquals("xxx", "xxx"); assertTrue(b); }