Skip to content

Instantly share code, notes, and snippets.

@Romain-P
Created October 26, 2017 12:30
Show Gist options
  • Select an option

  • Save Romain-P/ea96ea8eb9477f318c5e803625d4dadf to your computer and use it in GitHub Desktop.

Select an option

Save Romain-P/ea96ea8eb9477f318c5e803625d4dadf to your computer and use it in GitHub Desktop.
what's the most maintainable? ;")
for (...) {
Class found = null;
for (Class i: bc.getInterfaces()) {
if (i == requestClass) {
success.add(new RetrievedBinding(requestClass, bc.getInstance(), bd.named(), bd.singleton()));
found = i;
break;
}
}
if (found != null) break;
}
for (...) {
if (bc.getInterfaces().stream()
.filter(i -> i == requestClass).findFirst()
.map(i -> success.add(new RetrievedBinding(requestClass, bc.getInstance(), bd.named(), bd.singleton())))
.isPresent())
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment