Skip to content

Commit

Permalink
Use .putAll instead of for loop or .forEach
Browse files Browse the repository at this point in the history
  • Loading branch information
rsvoboda committed Nov 24, 2021
1 parent 41ff661 commit 9f8c2e7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ private IndexView buildApplicationIndex(ArcConfig config, ApplicationArchivesBui
.initBeanDefiningAnnotations(additionalBeanDefiningAnnotations.stream()
.map(bda -> new BeanDefiningAnnotation(bda.getName(), bda.getDefaultScope()))
.collect(Collectors.toList()), stereotypes);
for (DotName customScopeAnnotationName : customScopes.getCustomScopeNames()) {
beanDefiningAnnotations.add(customScopeAnnotationName);
}
beanDefiningAnnotations.addAll(customScopes.getCustomScopeNames());
// Also include archives that are not bean archives but contain qualifiers or interceptor bindings
beanDefiningAnnotations.add(DotNames.QUALIFIER);
beanDefiningAnnotations.add(DotNames.INTERCEPTOR_BINDING);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,7 @@ private void processCloudEvent(RoutingContext routingContext) {
responseEvent.put(dsName, outputCloudEvent.dataSchema());
}

outputCloudEvent.extensions()
.entrySet()
.forEach(e -> responseEvent.put(e.getKey(), e.getValue()));
responseEvent.putAll(outputCloudEvent.extensions());

String dataContentType = outputCloudEvent.dataContentType();
if (dataContentType != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ public void setNodeName(final TransactionManagerConfiguration transactions) {
public void setDefaultProperties(Properties properties) {
//TODO: this is a huge hack to avoid loading XML parsers
//this needs a proper SPI
for (Map.Entry<Object, Object> i : System.getProperties().entrySet()) {
properties.put(i.getKey(), i.getValue());
}
properties.putAll(System.getProperties());

try {
Field field = PropertiesFactory.class.getDeclaredField("delegatePropertiesFactory");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ public List<DevChannelInfo> get() {

// Unfortunately, there is no easy way to obtain the connectors metadata
Connectors connectors = container.instance(Connectors.class).get();
for (Entry<String, Component> entry : connectors.outgoingConnectors.entrySet()) {
publishers.put(entry.getKey(), entry.getValue());
}
publishers.putAll(connectors.outgoingConnectors);
for (Entry<String, Component> entry : connectors.incomingConnectors.entrySet()) {
consumers.computeIfAbsent(entry.getKey(), fun)
.add(entry.getValue());
Expand Down

0 comments on commit 9f8c2e7

Please sign in to comment.