Skip to content

Commit

Permalink
Minor tweak for getChildPaths : moved invariant out of loop
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelmay committed Feb 16, 2018
1 parent 6016385 commit 5b47c9e
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,11 @@ public List<String> getChildPaths(String path) throws IOException {
}
long[] children = dirmap.get(rootNodeId);
List<String> childPaths = new ArrayList<>();
final String pathWithTrailingSlash = ("/".equals(path) ? path : path + '/');
for (long cid : children) {
final FsImageProto.INodeSection.INode inode = fromINodeId(cid);
if (inode.getType() == FsImageProto.INodeSection.INode.Type.DIRECTORY) {
childPaths.add(("/".equals(path) ? path : path + '/') + inode.getName().toStringUtf8());
childPaths.add(pathWithTrailingSlash + inode.getName().toStringUtf8());
}
}
return childPaths;
Expand Down

0 comments on commit 5b47c9e

Please sign in to comment.