Skip to content

Commit

Permalink
Merge pull request Netflix#1219 from mebigfatguy/master
Browse files Browse the repository at this point in the history
avoid map lookups, in loops
  • Loading branch information
mattrjacobs committed May 26, 2016
2 parents 3ff2b00 + da37420 commit 4e470d6
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,7 @@ public void call(BatchReturnType batchReturnType) {
@Override
public void call(Throwable t) {
Exception ex = getExceptionFromThrowable(t);
for (K key: requestsByKey.keySet()) {
CollapsedRequest<ResponseType, RequestArgumentType> collapsedReq = requestsByKey.get(key);
for (CollapsedRequest<ResponseType, RequestArgumentType> collapsedReq : requestsByKey.values()) {
collapsedReq.setException(ex);
}
}
Expand All @@ -212,8 +211,9 @@ public void call(Throwable t) {
@Override
public void call() {

for (K key : requestsByKey.keySet()) {
CollapsedRequest<ResponseType, RequestArgumentType> collapsedReq = requestsByKey.get(key);
for (Map.Entry<K, CollapsedRequest<ResponseType, RequestArgumentType>> entry : requestsByKey.entrySet()) {
K key = entry.getKey();
CollapsedRequest<ResponseType, RequestArgumentType> collapsedReq = entry.getValue();
if (!seenKeys.contains(key)) {
try {
onMissingResponse(collapsedReq);
Expand Down

0 comments on commit 4e470d6

Please sign in to comment.