ken
02/09/2020, 10:27 PMstreetsofboston
02/09/2020, 11:18 PMFunction
it doesn't make much sense to use wildcards. The interface only has one method and calling it when it has wildcards doesn't make much sense.
However, with other interfaces that take generic type parameters, you can use a wildcard if you never call any methods of that interface that take or return a type of that wildcarded type-parameter (eg calling size
or isEmpty
on a List<*>
)streetsofboston
02/09/2020, 11:21 PMout Any
type of wildcard can be used to see if the return value is null or not.... Still, you'd want another method of that interface that does the same and is more clear and descriptive.