All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.luoshu.util.CollectionUtils Maven / Gradle / Ivy

package org.luoshu.util;

import java.util.Collection;
import java.util.Map;

/**
 * @author inme
 * create: 2020-04-12 21:33
 */
public class CollectionUtils {

    public static boolean isEmpty(Collection collection){
        return collection == null || collection.size() == 0;
    }
    public static boolean isNotEmpty(Collection collection){
        return !isEmpty(collection);
    }
    public static boolean isEmpty(Map map){
        return map == null || map.size() == 0;
    }
    public static boolean isNotEmpty(Map map){
        return !isEmpty(map);
    }

    public static String toString(Collection collection){
        StringBuilder sb = new StringBuilder();
        for (Object o : collection) {
            sb.append(String.valueOf(o)).append(",");
        }
        return sb.substring(0 , sb.length() - 1);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy