That's why you can't do it. Just like you can't do: interface A { void blah(Set set); void blah(Set set); } Same problem The type information isn't available at runtime (ie type erasure).
No there isn't. You have to remember that someone could call your method with just a vanilla Set, in which case which one would be called? That's why you can't do it.
Just like you can't do: interface A { void blah(Set set); void blah(Set set); } Same problem. The type information isn't available at runtime (ie type erasure).
Sorry, the bad news is that you cannot do this: public class Algorithm> { public void compute(Set objects) { } public void compute(Set pairs) { } } Due to erasure, both will erase to the same signature. There is no way around this short of renaming one of the methods.
1 Renaming one of the methods might not be a bad idea anyway - since they'll both be doing (slightly) different things (I guess). – harto Jul 10 '09 at 0:45.
Sadly, this is the major area where Java Generics falls down... there is just no good solution. I've generally resorted to making a new class, with the interface as Set>, but that wraps Set> (without extending it, which would cause the same problem).
I've written an article about type erasure which can be of your interest. It gives the common widely known solution and also a tricky way to circumvent the problem. I don't know if it will be relevant for you.
Anyway, it contains some techniques which may be useful under certain circumstances. See also: Using TypeTokens to retrieve generic parameters I hope it helps.
I've written an article about type erasure which can be of your interest. It gives the common widely known solution and also a tricky way to circumvent the problem. I don't know if it will be relevant for you.
Anyway, it contains some techniques which may be useful under certain circumstances.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.