What is the difference between m: util.AbstractMap[_, _]
and m: util.AbstractMap
?
PS. The question I think holds for any collection, not just this one.
What is the difference between m: util.AbstractMap[_, _]
and m: util.AbstractMap
?
PS. The question I think holds for any collection, not just this one.
In scala you have to necessarily provide the type argument. So in literal sense, you cannot do new util.AbstractMap
.
Well if you think of it, its correct. In Java, one can avoid giving the parametric type and the code compiles, so as to be backward compatible with pre-java5 code. But in scala, generics have been a part from the start.
If the question was for instead something like this:
trait MonoidK[F[_]]{...}
MonoidK[List].combine[Int](List(1,2,3),List(4))
Where we do not provide the argument types for List
, then List
in this case is a Type Constructor to which arguments have to be provided later (in combine
method). MonoidK
in this case is supporsedly called higher kinded type. This is a good read on this topic for more details.