I have this list (List):
[\"a\", \"b\", null, \"c\", null, \"d\", \"e\"]
And I\'d like something like this:
I was watching the video on Thinking in Parallel by Stuart. So decided to solve it before seeing his response in the video. Will update the solution with time. for now
Arrays.asList(IntStream.range(0, abc.size()-1).
filter(index -> abc.get(index).equals("#") ).
map(index -> (index)).toArray()).
stream().forEach( index -> {for (int i = 0; i < index.length; i++) {
if(sublist.size()==0){
sublist.add(new ArrayList(abc.subList(0, index[i])));
}else{
sublist.add(new ArrayList(abc.subList(index[i]-1, index[i])));
}
}
sublist.add(new ArrayList(abc.subList(index[index.length-1]+1, abc.size())));
});