Skip to content

Commit

Permalink
Merge pull request #170 from kevinsawicki/jedis
Browse files Browse the repository at this point in the history
---

This corrects a [findbugs](http://findbugs.sourceforge.net/) warning about how iteration over a key set followed by a call to ```get``` is less efficient than iterating over an entry set.
  • Loading branch information
ewhauser committed Sep 13, 2011
2 parents 7b24682 + 97bbfdc commit 7803f5b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/redis/clients/jedis/BinaryClient.java
Expand Up @@ -11,6 +11,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import redis.clients.jedis.Protocol.Command;
import redis.clients.jedis.Protocol.Keyword;
Expand Down Expand Up @@ -205,9 +206,9 @@ public void hmset(final byte[] key, final Map<byte[], byte[]> hash) {
final List<byte[]> params = new ArrayList<byte[]>();
params.add(key);

for (final byte[] field : hash.keySet()) {
params.add(field);
params.add(hash.get(field));
for (final Entry<byte[], byte[]> entry : hash.entrySet()) {
params.add(entry.getKey());
params.add(entry.getValue());
}
sendCommand(HMSET, params.toArray(new byte[params.size()][]));
}
Expand Down

0 comments on commit 7803f5b

Please sign in to comment.