I have an ArrayList
which follows this form { a/b/c ; d/e/f ; ...}
and I want to mutate it and have it in this form { a ; b ; c ; d ; e ; ...}
.
I mean I know I can make two functions, one that takes care of removing the /
character and one that does the rest. But I'm really curious if I can use some built-in functions that can help me do that quickly for me.
Ok here is one try:
List<String> purgedList = new ArrayList<>();
for (String s : listFromFile) {
purgedList.addAll(Arrays.asList(s.split("/")));
}