Java List Null Empty nullsafeAsList(T... elements)

Here you can find the source of nullsafeAsList(T... elements)

Description

nullsafe As List

License

Open Source License

Declaration

@SafeVarargs
    public static <T> List<T> nullsafeAsList(T... elements) 

Method Source Code


//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
}

Related

  1. newListWhenNull(List list)
  2. newListWithOneNull()
  3. nullOrEmpty(List s)
  4. nullOrEmptyList(List list)
  5. nullSafeAdd(List list, T elem)
  6. nullSafeList(List list)
  7. nullToEmpty(List in)
  8. nullToEmpty(List list)
  9. nullToEmpty(List nullable)