PathAddress implements Iterable<String> { public static PathAddress pathAddress(String... paths) { if (paths == null || paths.length == 0) return empty(); PathAddress address = PathAddress.empty(); for (String path : paths) { address = address.append(path); } return address; } 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 testPathAddressSlashes() { PathAddress address = PathAddress.pathAddress("one", "two", "three"); assertEquals(address, PathAddress.pathAddress("one/two", "three")); assertEquals(address, PathAddress.pathAddress("one/two/", "three")); assertEquals(address, PathAddress.pathAddress("/one/two/", "three")); assertEquals(address, PathAddress.pathAddress("one", "/two/three")); }