def check( x: Int, y: Int) (z: Int) = {
x+y+z
} //> check: (x: Int, y: Int)(z: Int)Int
def curried = check _ //> curried: => (Int, Int) => Int => Int
def z = curried(0,0) //> z: => Int => Int
z(3) //> res0: Int = 3
check(1,2)(3) //> res1: Int = 6
check(1,2)(_) //> res2: Int => Int = <function1>
I have this code in Scala and what I'm trying to achieve is to call check in this way
check(1,2)
without the third parameter in order to call check in three ways
check(1,2)(3) // with three parameters
z(3) // with just one and
check(1,2) with two parameters.
How can I do this in Scala and Java? Can I declare z as an implicit in Java? Thank you in advance.