mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Find shortest qualified name using Stream#min() instead of hand-written loop
This commit is contained in:
@@ -85,13 +85,7 @@ public class QualifiedNameFinder {
|
||||
|
||||
@Nullable
|
||||
private static QualifiedName shortestQName(@NotNull List<QualifiedName> qNames) {
|
||||
QualifiedName result = null;
|
||||
for (QualifiedName name : qNames) {
|
||||
if (result == null || name.getComponentCount() < result.getComponentCount()) {
|
||||
result = name;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return qNames.stream().min((o1, o2) -> o1.getComponentCount() - o2.getComponentCount()).orElse(null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user