Skip to content

Commit cbe7097

Browse files
committed
AbstractAutoCompleter: fix duplicate removal logic
1 parent 2ecfbef commit cbe7097

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/org/scijava/script/AbstractAutoCompleter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,11 @@ else if (code.contains(".")) {
8585
}
8686

8787
// Remove duplicates
88-
matches.stream().distinct().collect(Collectors.toList());
88+
final List<String> unique = //
89+
matches.stream().distinct().collect(Collectors.toList());
8990

9091
// Sort alphabetically, ignoring case
91-
Collections.sort(matches, new Comparator<Object>() {
92+
Collections.sort(unique, new Comparator<Object>() {
9293

9394
@Override
9495
public int compare(final Object o1, final Object o2) {
@@ -99,7 +100,7 @@ public int compare(final Object o1, final Object o2) {
99100
});
100101

101102
// Return results. For now we ignore index and startIndex.
102-
return new AutoCompletionResult(matches, startIndex);
103+
return new AutoCompletionResult(unique, startIndex);
103104
}
104105

105106
private List<String> engineVariablesCompleter(final String code,

0 commit comments

Comments
 (0)