This will depend on your definition of functional programming.
In any case, the answer to your question will be No. No. Lambdas should appear in Java7 at some point, but they will appear only in Java8. It looks like with Java8 you can do a lot with the new lambda notation in conjunction with the usual JDK8 class libraries (collections in especially) before you need something like FunctionalJava, but it depends on how much you want to do. Many people from OO will be very pleased only with the taste of FP - a common example is collections with map , filter , etc. That in itself will no doubt bring Java closer to FP - and there may just be enough FP for you.
The question is, even then, would it be possible to implement true (even "unclean") functional programming in Java? Yes and no. Yes, because any language with lexical closures and lambda notation could theoretically be enough. No, because FP supported by Haskell , F# , OCAML and Scala will still be impractical.
Some examples:
- Lack of Algebraic Data Types - They are considered as a key component of the statically typed family of FP languages ββand are particularly well combined with many FP idioms.
- While not quite a requirement for FP, almost all statically typed languages ββof FP are some form of type inference.
- Statements should behave like expressions for a lot of functional programming. Idioms should be convenient -
if , try , etc. need to return the value. - Execution (as in Haskell) or encouragement (as in Scala) is one purpose, as well as the immutability and useful collection of data structures and libraries for this purpose.
Other languages, such as Lisp / Scheme or Erlang, are also considered functional; but in a less strict sense; requirements (1) and (2) do not apply, since they start with dynamic input.
You could say then that Javascript is about as functional as Lisp (an impure dynamic functional language), because Javascript always had lambdas and first-class functions. But Java, located in a statically typed family, has nothing better (than Javascript) and, of course, not as good as the existing statically typed FP languages.
Regarding (4. (Continuous / side effect free)), it seems that in JDK8 existing mutable classes will be modified using lambda-consumption methods, so that something that (at least temporarily) will limit far you can take FP paradigms in Java8.
I found these links very useful - I haven't tracked for a while, so I'm not sure if this is the best / latest info on this. But worth reading:
http://cr.openjdk.java.net/~briangoetz/lambda/lambda-state-final.html
http://cr.openjdk.java.net/~briangoetz/lambda/collections-overview.html