I have a generic class that contains a compareTo() method
I'm getting an error on the method it'self that goes something like;
How do I fix it?Name clash: the method compareTo(T) of type twos<T N> has the same erasure as compareTo(T) of type Compareable<T> but does not override it.
here's my class
public class twos<P,N> implements Comparable<twos<P,N>>{ private P a; private N b; } public twos(P puu, N paa ){ a=puu; b=paa;} public P getP(){ return a;} public N getN(){ return b;} public compareTo(P bee){ int num1 = ((Comparable<twos<P, N>>) this.a).compareTo( (twos<P, N>) bee.b ); if (num1 != 0) return num1; if (this.a < bee.a) return -1; if (this.a > bee.a) return 1; return 0; } } }//end of class
Any help is appreciated