Java 8: HashMap initialization with lambda expressions
问题 I'm trying to declare and define larger hash map at once. This is how I do it: public HashMap<Integer, Callable<String>> opcode_only = new HashMap<Integer, Callable<String>>() {{ put(x, y); put(x, y); }}; But, when I try to use lambda expressions in body of put , I'm hitting on eclipse warrning/error. This is how I use lambda in HashMap: public HashMap<Integer, Callable<String>> opcode_only = new HashMap<Integer, Callable<String>>() {{ put(0, () -> { return "nop"; }); put(1, () -> { return