Skip to content

Commit 73743b0

Browse files
authored
Merge pull request #386 from scijava/fix-object-widget-duplication
AbstractInputHarvester: make getObjects() not return duplicates
2 parents dc8ea6d + ca7bf72 commit 73743b0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/org/scijava/widget/AbstractInputHarvester.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
package org.scijava.widget;
3131

3232
import java.util.ArrayList;
33+
import java.util.HashSet;
3334
import java.util.List;
35+
import java.util.Set;
3436

3537
import org.scijava.AbstractContextual;
3638
import org.scijava.convert.ConvertService;
@@ -129,10 +131,10 @@ private <T> WidgetModel addInput(final InputPanel<P, W> inputPanel,
129131
@SuppressWarnings("unchecked")
130132
private List<?> getObjects(final Class<?> type) {
131133
@SuppressWarnings("rawtypes")
132-
List compatibleInputs =
133-
new ArrayList(convertService.getCompatibleInputs(type));
134+
Set compatibleInputs =
135+
new HashSet(convertService.getCompatibleInputs(type));
134136
compatibleInputs.addAll(objectService.getObjects(type));
135-
return compatibleInputs;
137+
return new ArrayList<>(compatibleInputs);
136138
}
137139

138140
}

0 commit comments

Comments
 (0)