Java examples for File Path IO:Path
Get from Iterable Path into an array of Path
import java.nio.file.FileSystems; import java.nio.file.Path; import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] args) { Iterable<Path> dirs = FileSystems.getDefault().getRootDirectories(); List<Path> list = new ArrayList<Path>(); for (Path name : dirs) { System.out.println(name);// w w w . jav a2 s . c o m list.add(name); } Path[] arr = new Path[list.size()]; list.toArray(arr); for (Path path : arr) { System.out.println(path); } } }