What's the nearest substitute for a function pointer in Java?
Posted
by Bill the Lizard
on Stack Overflow
See other posts from Stack Overflow
or by Bill the Lizard
Published on 2008-09-23T17:20:10Z
Indexed on
2010/05/04
18:48 UTC
Read the original article
Hit count: 334
I have a method that's about 10 lines of code. I want to create more methods that do the exact same thing except for a calculation that's going to change one line of code. This is a perfect application for passing in a function pointer to replace that one line, but Java doesn't have function pointers. What's my best alternative?
© Stack Overflow or respective owner