Description
- Prefer ArrayList to LinkedList when simply adding/iterating
- Prefer HashSet to TreeSet when no ordering is required
- Other performance improvements
- Check style fixes
https://stackoverflow.com/questions/322715/when-to-use-linkedlist-over-arraylist-in-java
final Set<Node> excludedNodes = new HashSet<>(); for(BlockReconstructionWork rw : reconWork){ // Do no bother wasting time clearing out the collection, let GC do that work later excludedNodes.clear(); // use {{addAll}} here for (DatanodeDescriptor dn : rw.getContainingNodes()) { excludedNodes.add(dn); }