Java List Null Empty nullToEmpty(List in)

Here you can find the source of nullToEmpty(List in)

Description

null To Empty

License

Open Source License

Declaration

public static <T> List<T> nullToEmpty(List<T> in) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Collections;
import java.util.List;
import java.util.Set;

public class Main {
    public static <T> List<T> nullToEmpty(List<T> in) {
        return in == null ? Collections.<T>emptyList() : in;
    }//from  w  ww.  j av a  2  s. c o m

    public static <T> Set<T> nullToEmpty(Set<T> in) {
        return in == null ? Collections.<T>emptySet() : in;
    }
}

Related

  1. nullOrEmpty(List s)
  2. nullOrEmptyList(List list)
  3. nullSafeAdd(List list, T elem)
  4. nullsafeAsList(T... elements)
  5. nullSafeList(List list)
  6. nullToEmpty(List list)
  7. nullToEmpty(List nullable)