how i can convert Array List Path to ArrayList String | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 2

how i can convert Array List Path to ArrayList String

of: List<Path> paths = new ArrayList<>(); to: List<String> lineas = new ArrayList<>();

15th Apr 2018, 7:33 AM
Gerardo Jaimes
Gerardo Jaimes - avatar
1 Respuesta
+ 10
You could do something like that: List<String> lineas = paths .stream() .map(p -> p.toString()) .collect(Collectors.toList()); Make sure the toString representation is the string you want. If not, use the File class: p.toFile().getPath(), getAbsolutePath(), (...).
15th Apr 2018, 8:38 AM
Tashi N
Tashi N - avatar