Evertiro :
I'm really not sure how to best ask this, so hopefully someone can figure out what I'm talking about.
Assume a List that looks something like this:
[
"Harum beatae autem occaecati. Incidunt quis",
"eius perferendis itaque dolorum dolores doloribus.",
"Veniam voluptate mollitia\net aut qui magnam. Ut",
"quos unde nulla qui. Earum odit dolores non illo illum."
]
I want to split it at the "\n" like so :
[
"Harum beatae autem occaecati. Incidunt quis",
"eius perferendis itaque dolorum dolores doloribus.",
"Veniam voluptate mollitia",
"et aut qui magnam. Ut",
"quos unde nulla qui. Earum odit dolores non illo illum."
]
YCF_L :
If you are using Java 8 you can use stream and flatMap
like this :
List<String> result = list.stream()
.flatMap(s -> Arrays.stream(s.split("\n")))
.collect(Collectors.toList());
If not you can use a simple loop like so :
List<String> result = new ArrayList<>();
for (String s : list){
result.addAll(Arrays.asList(s.split("\n")));
}