I am always hearing people talk about how Java does not support first class functions, that it is an advantage you get from functional languages, the only way to simulate it in Java is through the use of anonymous inner classes etc..
However, from what I can see Java does support first functions through the use of its reflection API. For example I can create a method object from a class and then call it on a number of objects of that class. I realize it is not as powerful as first class functions in other languages. For example in Python you can do the following:
class Test:
def __init__(self, num):
self.number = num
def add(self, num):
self.number += num
test = Test(1)
method = test.add
method(2)
You cannot do this in Java because you need to have a reference to the object you want to invoke the method on. However you can still treat the method as an object which is what defines first class functions. I guess the method object is not really the actual function but rather a meta-data object, although using reflection it can be treated as such. Maybe I just need clarification on what defines a first class function.