September 2019
Intermediate to advanced
816 pages
18h 47m
English
Constructing a relative path between two locations is a job for the Path.relativize() method.
Basically, the resulted relative path (returned by Path.relativize()) starts from a path and ends on another path. This is a powerful feature that allows us to navigate between different locations using relative paths that are resolved against the previous paths.
Let's consider the following two paths:
Path path1 = Paths.get("JBossTools3.pdf");Path path2 = Paths.get("JavaModernChallenge.pdf");
Notice that JBossTools3.pdf and JavaModernChallenge.pdf are siblings. This means that we can navigate from one to another by going up one level and then down one level. This navigation case is revealed by the following ...