protected <T> void myMethod(T obj, Class<?> type)
I have seen this method signature and I don't understand why the type of the first argument explicitly passed as an argument. In fact I can get the type from obj.getClass()
;
protected <T> void myMethod(T obj) {
Class type = obj.getClass();
}
Is this just a design choice? Is there anything beneficial for doing the first method?