Java Map Compute BiFunction Cannot Recognize Lambda Function -


i learning map class in java , cannot manage compute method work.

i found tutorial here demonstrate how can pass bifunction or lambda function compute, in way this:

system.out.println(map.compute("a",      (k, v) -> v == null ? 42 : v + 41));  

the logic pretty straightforward, value key 'a', check if value null, set value 42, otherwise, existing value plus 41.

however, when try run code in eclipse, complaining

multiple markers @ line - v cannot resolved variable - syntax error, insert "assignmentoperator expression" complete   assignment - v cannot resolved variable - syntax error on token ">", invalid ( - v cannot resolved variable - syntax error, insert ")" complete expression - k cannot resolved variable 

i pretty sure jre environment have been using java 8, , wondering if can here. did validation removing other java environments in eclipse , adding in system.out.println(system.getproperty("java.version")); double check output 1.8.0_65.

enter image description here


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -