Browse files

In getNodes, initialize the HashSet s with the right capacity.

  • Loading branch information...
1 parent 6010d30 commit 8edd688ee016936d9daec6319c8d82fb9ac2b7a2 @ijuma ijuma committed Apr 4, 2009
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/java/voldemort/routing/ConsistentRoutingStrategy.java
View
4 src/java/voldemort/routing/ConsistentRoutingStrategy.java
@@ -28,6 +28,8 @@
import voldemort.utils.FnvHashFunction;
import voldemort.utils.HashFunction;
+import com.google.common.collect.Sets;
+
/**
* A Routing strategy that routes each request to the first N nodes where N is a
* user defined replication factor.
@@ -93,7 +95,7 @@ public ConsistentRoutingStrategy(HashFunction hash, Collection<Node> nodes, int
}
public Set<Node> getNodes() {
- Set<Node> s = new HashSet<Node>();
+ Set<Node> s = Sets.newHashSetWithExpectedSize(partitionToNode.length);
for(Node n: this.partitionToNode)
s.add(n);
return s;

0 comments on commit 8edd688

Please sign in to comment.