Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java convert 2d array to 1d stream

list.stream().flatMap(x -> x.stream()).collect(Collectors.toList());
// or, alternatively, with a 2d array of ints (my use-case):
Arrays.stream(list).flatMapToInt(Arrays::stream).sum();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #convert #array #stream
ADD COMMENT
Topic
Name
7+9 =