mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ContainerUtil.notNullize for Set
This commit is contained in:
@@ -103,6 +103,7 @@ public class CollectionListModel<T> extends AbstractListModel implements Editabl
|
||||
Collections.sort(myItems, comparator);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<T> getItems() {
|
||||
return Collections.unmodifiableList(myItems);
|
||||
}
|
||||
|
||||
@@ -2274,9 +2274,15 @@ public class ContainerUtil extends ContainerUtilRt {
|
||||
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
public static <T, C extends Collection<T>> C notNullize(@Nullable C collection) {
|
||||
public static <T> List<T> notNullize(@Nullable List<T> list) {
|
||||
return list == null ? ContainerUtilRt.<T>emptyList() : list;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Contract(pure=true)
|
||||
public static <T> Set<T> notNullize(@Nullable Set<T> set) {
|
||||
//noinspection unchecked
|
||||
return collection == null ? (C)ContainerUtilRt.emptyList() : collection;
|
||||
return set == null ? Collections.<T>emptySet() : set;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -126,6 +126,7 @@ public class VcsStructureChooser extends DialogWrapper {
|
||||
return myModulesSet;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Collection<VirtualFile> getSelectedFiles() {
|
||||
return ((CollectionListModel) mySelectedList.getModel()).getItems();
|
||||
}
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ class StructureFilterPopupComponent extends FilterPopupComponent<VcsLogStructure
|
||||
new ArrayList<VirtualFile>(myRoots));
|
||||
if (chooser.showAndGet()) {
|
||||
myFiles.clear();
|
||||
myFiles.addAll(ContainerUtil.notNullize(chooser.getSelectedFiles()));
|
||||
myFiles.addAll(chooser.getSelectedFiles());
|
||||
setValue(myFiles);
|
||||
applyFilters();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user