In this question, What is the equivalent of C ++ Pair <L, R> in Java? , there is this example code that I will use in my code
public boolean equals(Object other) {
if (other instanceof Pair) {
Pair otherPair = (Pair) other;
return
(( this.first == otherPair.first ||
( this.first != null && otherPair.first != null &&
this.first.equals(otherPair.first))) &&
( this.second == otherPair.second ||
( this.second != null && otherPair.second != null &&
this.second.equals(otherPair.second))) );
}
return false;
}
Eclipse warns me on the line "Pair otherPair = (Pair)"; that "Pair is a raw type. References to the general type of Pair must be parameterized." I tried to rewrite it to “Pair”, “B” and “Other” = (“Pair”, “B”) another; but the warning still exists. How can I print another correctly so that there are no warnings? Thank!
Jairo source
share