I've tried this code (list is ArrayList<List<Integer>>):
list.stream().flatMap(Stream::of).collect(Collectors.toList());
but it doesn't do anything; the list is still a 2D list. How can I convert this 2D list to a 1D list?
I've tried this code (list is ArrayList<List<Integer>>):
list.stream().flatMap(Stream::of).collect(Collectors.toList());
but it doesn't do anything; the list is still a 2D list. How can I convert this 2D list to a 1D list?