Skip to content

Commit f4af93f

Browse files
krzykphilwebb
authored andcommitted
Use for loop rather than iterator
See gh-33987
1 parent 55a50d5 commit f4af93f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/ConfigTreePropertySource.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,7 +26,6 @@
2626
import java.util.Arrays;
2727
import java.util.Collections;
2828
import java.util.EnumSet;
29-
import java.util.Iterator;
3029
import java.util.Map;
3130
import java.util.Set;
3231
import java.util.TreeMap;
@@ -229,9 +228,8 @@ private static boolean isPropertyFile(Path path, BasicFileAttributes attributes)
229228
}
230229

231230
private static boolean hasHiddenPathElement(Path path) {
232-
Iterator<Path> iterator = path.iterator();
233-
while (iterator.hasNext()) {
234-
if (iterator.next().toString().startsWith("..")) {
231+
for (Path element : path) {
232+
if (element.toString().startsWith("..")) {
235233
return true;
236234
}
237235
}

0 commit comments

Comments
 (0)