This week's book giveaway is in the Agile and Other Processes forum. We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line! See this thread for details.
Remembering that Java® doesn's actually support 2D arrays; it supports arrays of arrays, which are better . . .
Don't know, but have a few hints:-
1: Indent Streams code differently. Every time you call a method on a Stream after the first call, push the enter key and indent the code so the dots align vertically.
2: Use an IDE. If you hover your mouse over the method call you will get a popup with its return type shown e.g. Stream<Foo>. At least that is what Eclipse does, so I expect NetBeans and IntelliJ will have similar functionality.
3: Consider not using arrays of primitives; maybe use Doubles instead.
4: I am 99% sure that flatMap takes a Stream<Foo> and creates a Stream<Foo>, so it is probably doing the exact opposite of what you want.
5: Rather than assigning the arrays in lines 4 and 6, consider printing them with System.out.println(Arrays.deepToString(...
6: Use the peek() method to view the contents of your Streams whilst in development for debugging.
What is wrong with writing a method which takes a double as its parameter and returns a new double with changed values? Call that method with a λ from the map() method.
Actually, by going through by hand and working out the types, there is quite a simple solution and you are not that far off. Here it is I think a few misspellings have been introduced in copying but you can retain about half of your line 6 and change the other half.