I'm coming from C++ and I feel a little bit frustrated and confused. I was googling for help for a while and I still can't find an answer, so I am here.
How in Java can I implement a NavigableMap<String, ?>
where at the question mark is an object which can be called with two arguments and then return a value.
I would like it to look like so:
NavigableMap<String, SomeFunctorClass> container;
// I also don't know how to write a lambda thing in java, so it won't work.
// [](double a, double b) -> double { return a + b; } // in C++
container.put("add", (double a, double b) -> { return a + b; });
// Expected to be 10.
double result = container.get("add")(4, 6);