Let's say you've got a method which takes a class which is an instance of the interface Parent
as the first and only parameter, just like this one:
public void doSomething(Parent parent) {}
Let's also say we've got a class Child
which implements
the interface Parent
.
Why are many people using this method head:
public <T extends Parent> doSomething(T parent) {}
instead of this one:
public void doSomething(Parent parent) {}
Are there any advantages? Thanks for your help!