William Nerem wrote:Trying to just apply a function toDo to all the elements in the array, why + operator broke for double[]?
I think everybody's pretty much explained that, but my question to you is: why did you think that '+' would be correct in the first place?
Even without the more generic lambdas, you could have created something that worked for any array of number
Objects with a bit of generics, viz:
and then your code might look something like:
and I suspect you could make it even simpler by creating a utility class for numeric arrays.
HIH
Winston