I faced with code, which compilation result was surprised for me.
public class Test3{
public static<K,V> Map<K,V> map(){return new HashMap<K,V>();}
}
class A{
static void f(Map<String,Integer> bcMap){}
public static void main(String[] args){
f(Test3.map()) //not valid
Map<String,Integer> m = Test3.map();//valid
}
}
Always I supposed that if I pass value to method it means that method argument assigns to passed value.
Is it wrong ratification?
return new HashMap<K,V>();
need not use the generic type arguments. – Ambidexter