@Test public void equalsWithDifferentName() throws Exception { AttributeKey<Number> key1 = new AttributeKey<Number>(Number.class, "key1"); AttributeKey<Number> key2 = new AttributeKey<Number>(Number.class, "key2"); assertThat(key1.equals(key2), is(false)); assertThat(key2.equals(key1), is(false)); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AttributeKey<?> other = (AttributeKey<?>) obj; return hashCode == other.hashCode; }
AttributeKey { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AttributeKey<?> other = (AttributeKey<?>) obj; return hashCode == other.hashCode; } }
AttributeKey { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AttributeKey<?> other = (AttributeKey<?>) obj; return hashCode == other.hashCode; } AttributeKey(Class<T> attributeType, String attributeName); }
AttributeKey { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AttributeKey<?> other = (AttributeKey<?>) obj; return hashCode == other.hashCode; } AttributeKey(Class<T> attributeType, String attributeName); static AttributeKey<T> createKey(Class<T> attributeType, String attributeName); String getName(); Class<T> getType(); @Override int hashCode(); @Override boolean equals(Object obj); }
AttributeKey { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AttributeKey<?> other = (AttributeKey<?>) obj; return hashCode == other.hashCode; } AttributeKey(Class<T> attributeType, String attributeName); static AttributeKey<T> createKey(Class<T> attributeType, String attributeName); String getName(); Class<T> getType(); @Override int hashCode(); @Override boolean equals(Object obj);  }