In the method signature, I need a parameter that is any class type that extends from Collection (List, Set, etc), so I can return any of them. To try to achieve this I did use the following method: However when I try to use it like: The following error arises: I did search for an answer already solved in Stackoverflow,