C
crazzybugger
Hi,
I am stuck with a compiler warning while trying to cast an
object inside equals method.
Consider class A<I>{ }
inside this class, I am trying to override equals method. However, I
am not able to cast the received object into the proper type without
compiler warning.
Consider this implementation of equals
public boolean equals(Object that){
if(that instanceof A){
A<I> that1 = this.getClass().cast(that); // here I am
getting compiler warning.
// perform comparisons...
}
}
what is the right way to cast here ?
thank you...
I am stuck with a compiler warning while trying to cast an
object inside equals method.
Consider class A<I>{ }
inside this class, I am trying to override equals method. However, I
am not able to cast the received object into the proper type without
compiler warning.
Consider this implementation of equals
public boolean equals(Object that){
if(that instanceof A){
A<I> that1 = this.getClass().cast(that); // here I am
getting compiler warning.
// perform comparisons...
}
}
what is the right way to cast here ?
thank you...