Java: Phương thức iterator()
Iterator<Path> iterator()
Returns an iterator over the name elements of this path.
The first element returned by the iterator represents the name element that is closest to the root in the directory hierarchy, the second element is the next closest, and so on. The last element returned is the name of the file or directory denoted by this path. The root
component, if present, is not returned by the iterator.
Specified by:
iterator
in interface Iterable<Path>
Returns:
an iterator over the name elements of this path.