diff --git a/platform/util/src/com/intellij/util/containers/JBIterable.java b/platform/util/src/com/intellij/util/containers/JBIterable.java index e7df7259c74e..92eb82980572 100644 --- a/platform/util/src/com/intellij/util/containers/JBIterable.java +++ b/platform/util/src/com/intellij/util/containers/JBIterable.java @@ -148,6 +148,14 @@ public abstract class JBIterable implements Iterable { }; } + /** + * Returns a {@code JBIterable} containing the one {@code element}. + */ + @NotNull + public static JBIterable of(@Nullable E element) { + return element == null ? JBIterable.empty() : from(Collections.singletonList(element)); + } + /** * Returns a {@code JBIterable} containing {@code elements} in the specified order. */