mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
introduce single-param null-aware of(item)
This commit is contained in:
@@ -148,6 +148,14 @@ public abstract class JBIterable<E> implements Iterable<E> {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@code JBIterable} containing the one {@code element}.
|
||||
*/
|
||||
@NotNull
|
||||
public static <E> JBIterable<E> of(@Nullable E element) {
|
||||
return element == null ? JBIterable.<E>empty() : from(Collections.singletonList(element));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@code JBIterable} containing {@code elements} in the specified order.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user