-
Enhancement
-
Resolution: Fixed
-
P5
-
None
-
b18
LinkedHashMap<IndexNode, IndexNode> ZipFileSystem.inodes contains only non-null values.
if (inodes.containsKey(lookup)) {
parent = inodes.get(lookup);
node.sibling = parent.child;
parent.child = node;
break;
}
It means instead of separate containsKey+get calls, we can use single LinkedHashMap.get call and then compare result with null.
Result code is a bit simpler and faster.
parent = inodes.get(lookup);
if (parent != null) {
node.sibling = parent.child;
parent.child = node;
break;
}
if (inodes.containsKey(lookup)) {
parent = inodes.get(lookup);
node.sibling = parent.child;
parent.child = node;
break;
}
It means instead of separate containsKey+get calls, we can use single LinkedHashMap.get call and then compare result with null.
Result code is a bit simpler and faster.
parent = inodes.get(lookup);
if (parent != null) {
node.sibling = parent.child;
parent.child = node;
break;
}