Stream-map-flatMap ... complexe lambda code for doing simple cartesian product
Here is a simple cartesian product
Using Jdk8 Lambda … you can do much more complex (but not more compact/readable..)
This-one is still readable..
Then this one:
Also the non-indented version, make it a good candidate for Obfuscated Code Contest (JCC as CCC ??)
As far, as Good
Little more ... Eclipse Bug in type inference
Doing the same with 3 cartesian products instead of 2 … it compiles in maven/javac but does not compile anymore in Eclipse !!
Eclipse says Compile Error:
“Type mismatch: cannot convert from List<Object> to List<String>”
This bug is already referenced in eclipse Bugzilla.
For example here Eclipse Bugzilla #502158
A workaround is pretty easy, just add an explicit cast to the map() argument:
You can find this source code on my github here:
https://github.com/Arnaud-Nauwynck/test-snippets/tree/master/test-map-flatMap