KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Possible Duplicate: Java erasure with generic overloading (not overriding) How to overloading method with generic parameter in java? Say I have following class import java.util.List; public class C { public void foo(List<String> a){ } public void foo(List<Integer> b){ } } This gives compilation error and rightly so as erasure is doing it's job and removing the type information, so after compilation both the methods will have same parameter of list only. If I don't want to use public void foo(List<T> a){ } Is there any other way to overload the method foo()?
Tags (comma-separated)
Save Edits
Cancel