Skip to content

Commit 7ecddab

Browse files
author
Gary Gregory
committed
Stream instead of loop
1 parent f022d77 commit 7ecddab

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

src/main/java/org/apache/commons/io/input/BOMInputStream.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,7 @@ public BOMInputStream(final InputStream delegate, final ByteOrderMark... boms) {
172172
* @return The matched BOM or null if none matched
173173
*/
174174
private ByteOrderMark find() {
175-
for (final ByteOrderMark bom : boms) {
176-
if (matches(bom)) {
177-
return bom;
178-
}
179-
}
180-
return null;
175+
return boms.stream().filter(this::matches).findFirst().orElse(null);
181176
}
182177

183178
/**

0 commit comments

Comments
 (0)