greedyzebra
Technical User
Hi,
I know that in JavaScript you can assign reference to a function and access it's members like any other object, but can this be done with Java? And if so, what would be its functionality?
My situation is this: I'm wanting a function that will call multiple functions. The issue is how to decide which of those functions to call. While it is possible to use a switch statement and call the appropriate function based on a "key" provided as a parameter, there are many possible functions and the number of "cases" would be prohibitive.
If there is some way to reference a function call, then perhaps I could call the function with that reference after the reference has been passed as a parameter.
I'm sure there are other ways to achieve this that I haven't thought of... any suggestions are welcome.
Thanks!
I know that in JavaScript you can assign reference to a function and access it's members like any other object, but can this be done with Java? And if so, what would be its functionality?
My situation is this: I'm wanting a function that will call multiple functions. The issue is how to decide which of those functions to call. While it is possible to use a switch statement and call the appropriate function based on a "key" provided as a parameter, there are many possible functions and the number of "cases" would be prohibitive.
If there is some way to reference a function call, then perhaps I could call the function with that reference after the reference has been passed as a parameter.
I'm sure there are other ways to achieve this that I haven't thought of... any suggestions are welcome.
Thanks!