Help me clarify in my mind something that I think is related really closely if not the same concept entirely.
Java has always had a sort method where you pass in an implementation of the Comparator interface.
This same concept is super handy and can be used for all kinds of things. One example I whipped up is generating any series of numbers with a Generator interface, see this
gist of example code.
What do you call this concept? Callbacks? But I've read that it is not really a true callback due to the scope inside this passed-in implementation. Is that correct?
Now...is it also basically the same as Lambdas? Just with syntactic sugar? If not, what makes the new Java 8 lambda any different?
Finally, how does this relate to the visitor
pattern? That also seems like a related, if not the same, thing to me.
Thanks for your thoughts!