FilePathCollapser extends AbstractPathCollapser implements StringCollapser { public FilePathCollapser(int collapseThreshold) { super("*", "-", collapseThreshold, 0); } FilePathCollapser(int collapseThreshold); @Override Map<String, Collection<T>> collapse(Map<String, Collection<T>> input); boolean pathNameMatches(String matcher, String matchee);  }
@Test public void testFilePathCollapser() { List<String> paths = Arrays.asList( "/a/b/c/d", "/a/b/c/e", "/b/c/d/e", "/b/c/d/f", "/b/d/d/e", "/b/d/d/f", "/b/e/e/f", "/c/d/e/f", "/e/f/g/h", "/e/f/g/g", "/e/f/h/h", "/e/f/h/i"); paths = new ArrayList<String>(new FilePathCollapser(2).collapse(nullMap(paths)).keySet()); Collections.sort(paths); assertEquals(paths, Arrays.asList( "/a/b/c/*", "/b/c/d/*", "/b/d/d/*", "/b/e/e/f", "/c/d/e/f", "/e/f/-")); }