What does this type mean exactly and in what scen...
# announcements
k
What does this type mean exactly and in what scenario is it use ? "Function<*, *> means Function<in Nothing, out Any?>."
s
For a
Function
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<*>
)
On occasion the
out 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.