Error
Lambda expression's signature does not match the signature of the functional interface method apply(String, String)
Error Type
Compile Time ( Java 8 )
Sample Code
Map<String,String> intMap = new HashMap<String,String>();
intMap.put("Key1","Value1");
intMap.put("Key2", "Value2");
intMap.computeIfPresent("Key1",e->e.concat("ComputedValue"));
Cause
The method computeIfPresent expects the second argument as the Function of two arguments.
Resolution
Specify the function with two arguments as the second argument.
intMap.computeIfAbsent("Key3", (k,v)->v+k);
Lambda expression's signature does not match the signature of the functional interface method apply(String, String)
Error Type
Compile Time ( Java 8 )
Sample Code
Map<String,String> intMap = new HashMap<String,String>();
intMap.put("Key1","Value1");
intMap.put("Key2", "Value2");
intMap.computeIfPresent("Key1",e->e.concat("ComputedValue"));
Cause
The method computeIfPresent expects the second argument as the Function of two arguments.
Resolution
Specify the function with two arguments as the second argument.
intMap.computeIfAbsent("Key3", (k,v)->v+k);