Error
The method merge(String, String, BiFunction<? super String,? super String,? extends String>) in the type Map<String,String> is not applicable for the arguments (String, 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");
String str = strMap.merge("Key4","Value56","text");
Cause
The method merge expects the third argument as the Function and not the String.
Resolution
Specify the function as the second argument.
String str = strMap.merge("Key4","Value56",(k,v)->k+v);
The method merge(String, String, BiFunction<? super String,? super String,? extends String>) in the type Map<String,String> is not applicable for the arguments (String, 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");
String str = strMap.merge("Key4","Value56","text");
Cause
The method merge expects the third argument as the Function and not the String.
Resolution
Specify the function as the second argument.
String str = strMap.merge("Key4","Value56",(k,v)->k+v);