/** * gives an {@link URLPath}, which contains all elements in the given range. * * @param start index (including) * @param end index (excluding) * @return the {@link URLPath} with the sub elements */ public URLPath getSubPath(int start, int end) { List<String> parts = getSegments(); List<String> newSegments = parts.subList(start, end); URLPath newPath = new URLPath(newSegments); if (newPath.isEmpty()) { return EMPTY; } if (newPath.isRoot()) { return ROOT; } return newPath; }