Skip to content

Commit

Permalink
feat: stream을 적용하여 메서드 로직 변경(망고 피드백 반영)
Browse files Browse the repository at this point in the history
  • Loading branch information
the9kim committed Sep 25, 2023
1 parent fb5e04e commit 1e1974a
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ public void addHandlerAdapter(HandlerAdapter handlerAdapter) {
}

public HandlerAdapter getHandlerAdapter(Object handler) {
for (HandlerAdapter handlerAdapter : this.handlerAdapters) {
if (handlerAdapter.isSupport(handler)) {
return handlerAdapter;
}
}
throw new IllegalArgumentException("해당 handler를 찾을 수 없습니다.");
return this.handlerAdapters.stream()
.filter(handlerAdapter -> handlerAdapter.isSupport(handler))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("해당 handler를 찾을 수 없습니다."));
}
}

0 comments on commit 1e1974a

Please sign in to comment.