0

Is there any equivalent to what is in C++ pointer to function in Java. For example

double (*f)(double)

And is there any way to have a function with similar to what is pointer to function in C++, as parameter list.

  • 2
    @MattBall the accepted answer does contemplate Java 8 – E_net4 Jul 25 '15 at 18:56
  • @MattBall: Can you not mark it as a duplicate? As E_net4 pointed out, there is an easy solution in Java 8 (using a functional interface). – Dave Doknjas Jul 26 '15 at 22:46
  • @DaveDoknjas I don't understand. The second sentence of your comment specifically argues in favor of closing as a duplicate. – Matt Ball Jul 27 '15 at 01:44
  • @MattBall: The existing answer referenced does not give the concise Java 8 solution (i.e., functional interface). – Dave Doknjas Jul 27 '15 at 01:47
  • The 'answer' referenced has one note about Java 8 lambdas, but lambdas *do not* provide function pointer or delegate functionality - they support assigning to functional interface instances, which *do* provide function pointer or delegate functionality. – Dave Doknjas Jul 27 '15 at 01:51

0 Answers0