Error
The method compute(String, BiFunction<? super String,? super String,? extends String>) in the type Map<String,String> is not applicable for the arguments (String, String)
Error Type
Compile Time ( Java 8 )
Sample Code
Map<String,String> intMap = new HashMap<String,String>();
strMap.put("Key1","Value1");
strMap.put("Key2", "Value2");
strMap.compute("Key1","Value1");
Cause
The method compute expects the second argument as the Function and not the String.
Resolution
Specify the function as the second argument.
strMap.compute("Key3", (k,v)->v+k);
The method compute(String, BiFunction<? super String,? super String,? extends String>) in the type Map<String,String> is not applicable for the arguments (String, String)
Error Type
Compile Time ( Java 8 )
Sample Code
Map<String,String> intMap = new HashMap<String,String>();
strMap.put("Key1","Value1");
strMap.put("Key2", "Value2");
strMap.compute("Key1","Value1");
Cause
The method compute expects the second argument as the Function and not the String.
Resolution
Specify the function as the second argument.
strMap.compute("Key3", (k,v)->v+k);