void (String relPath, boolean isDir) { if (isDir && !relPath.endsWith("/")) relPath += "/"; int index = 0; while ((index = relPath.indexOf('/', index + 1)) != -1) { myDirs.add(relPath.substring(0, index)); } }