Skip to content

Commit

Permalink
Merge pull request #386 from scijava/fix-object-widget-duplication
Browse files Browse the repository at this point in the history
AbstractInputHarvester: make getObjects() not return duplicates
  • Loading branch information
ctrueden authored Jun 19, 2020
2 parents dc8ea6d + ca7bf72 commit 73743b0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/org/scijava/widget/AbstractInputHarvester.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
package org.scijava.widget;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.scijava.AbstractContextual;
import org.scijava.convert.ConvertService;
Expand Down Expand Up @@ -129,10 +131,10 @@ private <T> WidgetModel addInput(final InputPanel<P, W> inputPanel,
@SuppressWarnings("unchecked")
private List<?> getObjects(final Class<?> type) {
@SuppressWarnings("rawtypes")
List compatibleInputs =
new ArrayList(convertService.getCompatibleInputs(type));
Set compatibleInputs =
new HashSet(convertService.getCompatibleInputs(type));
compatibleInputs.addAll(objectService.getObjects(type));
return compatibleInputs;
return new ArrayList<>(compatibleInputs);
}

}

0 comments on commit 73743b0

Please sign in to comment.