Skip to content

Commit

Permalink
Slightly rewrite matchesFor
Browse files Browse the repository at this point in the history
Signed-off-by: TheSilkMiner <thesilkminer@outlook.com>
  • Loading branch information
TheSilkMiner committed Feb 28, 2022
1 parent f31575d commit dd4d16e
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -166,7 +166,9 @@ public Optional<SourceFile> toSourceFile() {
@Override
public List<IPreprocessor.Match> matchesFor(final IPreprocessor preprocessor) {

return Collections.unmodifiableList(this.matches.getOrDefault(preprocessor, List.of()));
return Optional.ofNullable(this.matches.get(preprocessor))
.map(Collections::unmodifiableList)
.orElseGet(Collections::emptyList);
}

private PreprocessedData preprocess() {
Expand Down

0 comments on commit dd4d16e

Please sign in to comment.