I've a read only method that should be able to take either
1. Map<Date, List<X>>
or
2. Map<Date, List<Y>>
as a parameter.
Here, I've the following two options to define the method.
A. private <T> List<Date> myMethod(Map<Date, List<T>> map)
B. private List<Date> myMethod(Map<Date, List<?>> map)
Both work fine for me, which one is preferable?
Thanks.
The first one gives you access to the T type in case you need that (for example, if you need to cast something to type T or something like that). With the latter, you simply state that you don't give a damn what sort of elements that List contains.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With