ERROR - The method merge(String, String, BiFunction) in the type Map is not applicable for the arguments (String, String, String)


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("Key2", "Value2");
String str = strMap.merge("Key4","Value56","text");


The method merge expects the third argument as the Function and not the String. 


Specify the function as the second argument.

String str = strMap.merge("Key4","Value56",(k,v)->k+v);