Attempt at implementing first class functions in java