public static List<String> split(String path) {
    //
    String[] pathelements = path.split("/");
    List<String> dirs = new ArrayList<String>(pathelements.length);
    for (String pathelement : pathelements) {
      if (!pathelement.isEmpty()) {
        dirs.add(pathelement);
      }
    }
    return dirs;
  }
@Test
  public void testSplitting() throws Throwable {
    assertEquals(1, split("/a").size());
    assertEquals(0, split("/").size());
    assertEquals(3, split("/a/b/c").size());
    assertEquals(3, split("/a/b/c/").size());
    assertEquals(3, split("a/b/c").size());
    assertEquals(3, split("/a/b//c").size());
    assertEquals(3, split("//a/b/c/").size());
    List<String> split = split("//a/b/c/");
    assertEquals("a", split.get(0));
    assertEquals("b", split.get(1));
    assertEquals("c", split.get(2));
  }