# std::bind in python, or passing functions with paramaters can be done in two ways:
# with 'functools' or with lambda functions
# 1. functools: --------------------------
>>> from functools import partial
>>> def foobar(a, b):
... return a+b
>>> p = partial(foobar, 1, 2)
>>> p()
3
>>> p2 = partial(foobar, 1)
>>> p2(2)
3
# 2. lambda: --------------------------
>>> def foobar(a,b):
... return a+b
>>> foobar(1,2) # call normal function
3
>>> bind = lambda x: foobar(x, 2) # bind 2 to foobar
>>> bind(1)
3
>>> bind = lambda: foobar(1,2) # bind all elements
>>> bind()
3
public interface MyInterface {
String doSomething(int param1, String param2);
}
class MyClass {
public MyInterface myInterface = (p1, p2) -> { return p2 + p1; };
}
new Thread(this::someMethod).start();