未验证 提交 8e5e7138 编写于 作者: O Oleg Nenashev 提交者: GitHub

Merge pull request #3666 from oltruong/JENKINS-53847

[JENKINS-53847] Improve JavaDoc for Util.fixNull (Hacktoberfest)
......@@ -1200,6 +1200,7 @@ public class Util {
/**
* Convert {@code null} to a default value.
* @param defaultValue Default value. It may be immutable or not, depending on the implementation.
* @since TODO
*/
@Nonnull
......@@ -1227,21 +1228,57 @@ public class Util {
return fixEmpty(s.trim());
}
/**
*
* @param l list to check.
* @param <T>
* Type of the list.
* @return
* {@code l} if l is not {@code null}.
* An empty <b>immutable list</b> if l is {@code null}.
*/
@Nonnull
public static <T> List<T> fixNull(@CheckForNull List<T> l) {
return fixNull(l, Collections.<T>emptyList());
}
/**
*
* @param l set to check.
* @param <T>
* Type of the set.
* @return
* {@code l} if l is not {@code null}.
* An empty <b>immutable set</b> if l is {@code null}.
*/
@Nonnull
public static <T> Set<T> fixNull(@CheckForNull Set<T> l) {
return fixNull(l, Collections.<T>emptySet());
}
/**
*
* @param l collection to check.
* @param <T>
* Type of the collection.
* @return
* {@code l} if l is not {@code null}.
* An empty <b>immutable set</b> if l is {@code null}.
*/
@Nonnull
public static <T> Collection<T> fixNull(@CheckForNull Collection<T> l) {
return fixNull(l, Collections.<T>emptySet());
}
/**
*
* @param l iterable to check.
* @param <T>
* Type of the iterable.
* @return
* {@code l} if l is not {@code null}.
* An empty <b>immutable set</b> if l is {@code null}.
*/
@Nonnull
public static <T> Iterable<T> fixNull(@CheckForNull Iterable<T> l) {
return fixNull(l, Collections.<T>emptySet());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册