Given that I have two arrays in Java, A
and B
I want to add the elements, element-wise, which results in a sum array. Doing this implicitly with a loop is easy but I was wondering if there was a more elegant solution, perhaps with the guava collections or build in java utils. Or perhaps a python-ish way which makes is easy with list comprehensions.
Example:
A = [2,6,1,4]
B = [2,1,4,4]
sum = [4,7,5,8]