Skip to content

Commit 5051850

Browse files
stsypanovjhoeller
authored andcommitted
SPR-17074 Replace iteration over Map::ketSet with Map::entrySet
1 parent 3c65c17 commit 5051850

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/AbstractAspectJAdvisorFactory.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,10 @@ public AspectJAnnotation(A annotation) {
208208
}
209209

210210
private AspectJAnnotationType determineAnnotationType(A annotation) {
211-
for (Class<?> type : annotationTypes.keySet()) {
211+
for (Map.Entry<Class<?>, AspectJAnnotationType> typeEntry : annotationTypes.entrySet()) {
212+
Class<?> type = typeEntry.getKey();
212213
if (type.isInstance(annotation)) {
213-
return annotationTypes.get(type);
214+
return typeEntry.getValue();
214215
}
215216
}
216217
throw new IllegalStateException("Unknown annotation type: " + annotation.toString());

spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,9 +1273,10 @@ protected Map<String, Object> findAutowireCandidates(
12731273
String[] candidateNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(
12741274
this, requiredType, true, descriptor.isEager());
12751275
Map<String, Object> result = new LinkedHashMap<>(candidateNames.length);
1276-
for (Class<?> autowiringType : this.resolvableDependencies.keySet()) {
1276+
for (Map.Entry<Class<?>, Object> classObjectEntry : this.resolvableDependencies.entrySet()) {
1277+
Class<?> autowiringType = classObjectEntry.getKey();
12771278
if (autowiringType.isAssignableFrom(requiredType)) {
1278-
Object autowiringValue = this.resolvableDependencies.get(autowiringType);
1279+
Object autowiringValue = classObjectEntry.getValue();
12791280
autowiringValue = AutowireUtils.resolveAutowiringValue(autowiringValue, requiredType);
12801281
if (requiredType.isInstance(autowiringValue)) {
12811282
result.put(ObjectUtils.identityToString(autowiringValue), autowiringValue);

spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,11 +1344,12 @@ else if (aliasPresent) {
13441344
}
13451345

13461346
// Replace any remaining placeholders with actual default values
1347-
for (String attributeName : attributes.keySet()) {
1347+
for (Map.Entry<String, Object> attributeEntry : attributes.entrySet()) {
1348+
String attributeName = attributeEntry.getKey();
13481349
if (valuesAlreadyReplaced.contains(attributeName)) {
13491350
continue;
13501351
}
1351-
Object value = attributes.get(attributeName);
1352+
Object value = attributeEntry.getValue();
13521353
if (value instanceof DefaultValueHolder) {
13531354
value = ((DefaultValueHolder) value).defaultValue;
13541355
attributes.put(attributeName,

0 commit comments

Comments
 (0)