KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to override equals method for a parameterized class. @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Tuple)) return false; Tuple<E> other = (Tuple<E>) obj; //unchecked cast if (!a0.equals(other.a0) && !a0.equals(other.a1)) { return false; } if (!a1.equals(other.a1) && !a1.equals(other.a0)) { return false; } return true; } How can I make sure that <E> of the other object is the same as this ?
Tags (comma-separated)
Save Edits
Cancel