Java Collection Null trimToNull(T collection)

Here you can find the source of trimToNull(T collection)

Description

trim To Null

License

Apache License

Declaration

public static <T extends Collection<?>> T trimToNull(T collection) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Collection;

public class Main {

    public static <T extends Collection<?>> T trimToNull(T collection) {
        return isEmpty(collection) ? null : collection;
    }/*from   w w  w . j a va2  s.  c  om*/

    public static boolean isEmpty(Collection<?> collection) {
        return collection == null || collection.isEmpty();
    }
}

Related

  1. removeNulls(Collection p_collection)
  2. removeNulls(F collection)
  3. removeNulls(final Collection collection)
  4. sortNumbers( Collection values, boolean removeNull)
  5. stripNulls(T collection)