@Test public void testEquals() { StrokeMap m1 = new StrokeMap(); StrokeMap m2 = new StrokeMap(); assertEquals(m1, m1); assertEquals(m1, m2); assertFalse(m1.equals(null)); assertFalse(m1.equals("ABC")); m1.put("K1", new BasicStroke(1.1f)); assertFalse(m1.equals(m2)); m2.put("K1", new BasicStroke(1.1f)); assertEquals(m1, m2); m1.put("K2", new BasicStroke(2.2f)); assertFalse(m1.equals(m2)); m2.put("K2", new BasicStroke(2.2f)); assertEquals(m1, m2); m1.put("K2", null); assertFalse(m1.equals(m2)); m2.put("K2", null); assertEquals(m1, m2); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof StrokeMap)) { return false; } StrokeMap that = (StrokeMap) obj; if (this.store.size() != that.store.size()) { return false; } Set<Comparable> keys = this.store.keySet(); for (Comparable key : keys) { Stroke s1 = getStroke(key); Stroke s2 = that.getStroke(key); if (!ObjectUtilities.equal(s1, s2)) { return false; } } return true; }
StrokeMap implements Cloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof StrokeMap)) { return false; } StrokeMap that = (StrokeMap) obj; if (this.store.size() != that.store.size()) { return false; } Set<Comparable> keys = this.store.keySet(); for (Comparable key : keys) { Stroke s1 = getStroke(key); Stroke s2 = that.getStroke(key); if (!ObjectUtilities.equal(s1, s2)) { return false; } } return true; } }
StrokeMap implements Cloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof StrokeMap)) { return false; } StrokeMap that = (StrokeMap) obj; if (this.store.size() != that.store.size()) { return false; } Set<Comparable> keys = this.store.keySet(); for (Comparable key : keys) { Stroke s1 = getStroke(key); Stroke s2 = that.getStroke(key); if (!ObjectUtilities.equal(s1, s2)) { return false; } } return true; } StrokeMap(); }
StrokeMap implements Cloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof StrokeMap)) { return false; } StrokeMap that = (StrokeMap) obj; if (this.store.size() != that.store.size()) { return false; } Set<Comparable> keys = this.store.keySet(); for (Comparable key : keys) { Stroke s1 = getStroke(key); Stroke s2 = that.getStroke(key); if (!ObjectUtilities.equal(s1, s2)) { return false; } } return true; } StrokeMap(); Stroke getStroke(Comparable key); boolean containsKey(Comparable key); void put(Comparable key, Stroke stroke); void clear(); @Override boolean equals(Object obj); @Override Object clone(); }
StrokeMap implements Cloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof StrokeMap)) { return false; } StrokeMap that = (StrokeMap) obj; if (this.store.size() != that.store.size()) { return false; } Set<Comparable> keys = this.store.keySet(); for (Comparable key : keys) { Stroke s1 = getStroke(key); Stroke s2 = that.getStroke(key); if (!ObjectUtilities.equal(s1, s2)) { return false; } } return true; } StrokeMap(); Stroke getStroke(Comparable key); boolean containsKey(Comparable key); void put(Comparable key, Stroke stroke); void clear(); @Override boolean equals(Object obj); @Override Object clone();  }