PathAddress implements Iterable<String> { public PathAddress subAddress(int start) { return new PathAddress(pathList.subList(start, pathList.size())); } PathAddress(final List<String> pathList);   PathAddress(final List<String> pathList, final List<PathTemplateResolver> resolvers); static PathAddress empty(); static PathAddress pathAddress(String... paths); static PathAddress pathAddress(String addressPath); PathAddress append(String path); PathAddress append(PathAddress address); PathAddress subAddress(int start); PathAddress subAddress(int start, int end); String getLastElement(); String get(int index); String resolvePathTemplate(String templateName); void addPathTemplateResolver(PathTemplateResolver resolver); List<PathTemplateResolver> getPathTemplateResolvers(); boolean accepts(PathTemplateFilter filter); @Override PathAddressIterator iterator(); int size(); PathAddress copy(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final PathAddress EMPTY_ADDRESS; }
@Test public void testSubAddress() { PathAddress address = PathAddress.pathAddress("one", "two", "three"); assertEquals(PathAddress.pathAddress("two", "three"), address.subAddress(1)); PathAddress sub1 = address.subAddress(1, 3); assertEquals(PathAddress.pathAddress("two", "three"), sub1); PathAddress sub2 = address.subAddress(2, 3); assertEquals(PathAddress.pathAddress("three"), sub2); }