I have a list of such lists:
List<List<Wrapper>> listOfLists = new ArrayList<>(); class Wrapper { private int value = 0; public int getValue() { return value; } }
so that it looks like this:
[ [Wrapper(3), Wrapper(4), Wrapper(5)], [Wrapper(1), Wrapper(2), Wrapper(9)], [Wrapper(4), Wrapper(10), Wrapper(11)], ]
Is there a concise way to smooth this list of lists as shown below using lambda functions in Java 8:
(per column): [Wrapper(8), Wrapper(16), Wrapper(25)] (per row): [Wrapper(12), Wrapper(12), Wrapper(25)]
potentially it could work with different sizes of internal lists:
[ [Wrapper(3), Wrapper(5)], [Wrapper(1), Wrapper(2), Wrapper(9)], [Wrapper(4)], ]
this will lead to:
(per column): [Wrapper(8), Wrapper(7), Wrapper(9)] (per row): [Wrapper(8), Wrapper(11), Wrapper(4)]
seems more complicated than that: Rotate a list of lists to a list using Lambdas and also 3 ways to flatten a list of lists. Is there a reason to prefer one of them?
and what i originally did seems to be albeit for lists: https://stackoverflow.com/a/316618/
Thanks!