Here we want to get a "root node" ('a' in yours example) to check it was already created or we should create it. Then we add a child to this node (child format is b/c/f.txt, and inside addChild() we do exactly the same.

Yes we can use here substring(0, indexOf("/")) instead of splitting.