I'm trying to take a Set of Strings and convert them like below using the most efficient algorithm possible. Any ideas?

```
Set<String> directoryList = new HashSet<String>() {
      {
        add("a/a1/a2/a3");
        add("b/b1/b2/b3");
        add("c/c1/c2/c3/c4");
      }
    };

    //need construct a new Set<String> which contains:
    a
    a/a1
    a/a1/a2
    a/a1/a2/a3
    b
    b/b1
    b/b1/b2
    b/b1/b2/b3
    c
    c/c1
    c/c1/c2
    c/c1/c2/c3
    c/c1/c2/c3/c4

```