Here you can find the source of nullsafeAsList(T... elements)
@SafeVarargs public static <T> List<T> nullsafeAsList(T... elements)
//package com.java2s; import java.util.Arrays; import java.util.List; public class Main { @SafeVarargs public static <T> List<T> nullsafeAsList(T... elements) { return elements == null ? null : Arrays.asList(elements); }//from w w w. j a v a 2 s .com }