Entry (String path) { Entry parent = this; for (String each : Paths.split(path)) { Entry nextParent = parent.findChild(each); if (nextParent == null) { parent.addChild(nextParent = new DirectoryEntry(each)); } parent = nextParent; } return parent; }