I need to convert this code using streams but I don't know how to do it.
List<String> lines = Files2.linesFromFile(ruta);
List<List<String>> res = new ArrayList<>();
for (String line : lines) {
List<String> aux = new ArrayList<>();
for (String element : line.split(",")) {
aux.add(element);
}
res.add(aux);
}
If I show the content of res I got:
[[ejercicios, practica, propuesta], [cadena, recomendar, definir], [elemento, implementar, sol], [ala, map, public, static]]
The content of lines is:
[ejercicios,practica,propuesta, cadena,recomendar,definir, elemento,implementar,sol, ala,map,public,static]
And I need to get the same output using stream, can somebody help me? Thanks in advance.