@Test public void testTupleEquals() { Tuple<String, String> t1 = new Tuple<String, String>("S1", "S2"); assertTrue(t1.equals(t1)); assertFalse(t1.equals(null)); Tuple<String, String> t2 = new Tuple<String, String>("S1", "S2"); assertTrue(t1.equals(t2)); assertTrue(t2.equals(t1)); Tuple<String, String> t3 = new Tuple<String, String>("S2", "S1"); assertFalse(t1.equals(t3)); assertFalse(t3.equals(t1)); assertEquals(new Tuple<Integer, Integer>(null, null), new Tuple<String, String>(null, null)); }
@Override public boolean equals(Object obj) { if ((obj == null) || (!(obj instanceof Tuple<?, ?>))) { return false; } Tuple<?, ?> that = (Tuple<?, ?>) obj; return EqualsUtil.areEqual(this.first, that.first) && EqualsUtil.areEqual(this.second, that.second); }
Tuple { @Override public boolean equals(Object obj) { if ((obj == null) || (!(obj instanceof Tuple<?, ?>))) { return false; } Tuple<?, ?> that = (Tuple<?, ?>) obj; return EqualsUtil.areEqual(this.first, that.first) && EqualsUtil.areEqual(this.second, that.second); } }
Tuple { @Override public boolean equals(Object obj) { if ((obj == null) || (!(obj instanceof Tuple<?, ?>))) { return false; } Tuple<?, ?> that = (Tuple<?, ?>) obj; return EqualsUtil.areEqual(this.first, that.first) && EqualsUtil.areEqual(this.second, that.second); } Tuple(T firstValue, U secondValue); }
Tuple { @Override public boolean equals(Object obj) { if ((obj == null) || (!(obj instanceof Tuple<?, ?>))) { return false; } Tuple<?, ?> that = (Tuple<?, ?>) obj; return EqualsUtil.areEqual(this.first, that.first) && EqualsUtil.areEqual(this.second, that.second); } Tuple(T firstValue, U secondValue); @Override boolean equals(Object obj); T getFirst(); U getSecond(); @Override int hashCode(); @Override String toString(); }
Tuple { @Override public boolean equals(Object obj) { if ((obj == null) || (!(obj instanceof Tuple<?, ?>))) { return false; } Tuple<?, ?> that = (Tuple<?, ?>) obj; return EqualsUtil.areEqual(this.first, that.first) && EqualsUtil.areEqual(this.second, that.second); } Tuple(T firstValue, U secondValue); @Override boolean equals(Object obj); T getFirst(); U getSecond(); @Override int hashCode(); @Override String toString();  }