com.qa.framework.library.base.CollectionHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of smart-api-framework Show documentation
Show all versions of smart-api-framework Show documentation
Support web service api automaton test based on testng and httpclient
package com.qa.framework.library.base;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import java.util.Collection;
import java.util.Map;
/**
* Created by kcgw001 on 2016/3/31.
*/
public class CollectionHelper {
/**
* 判断 Collection 是否为空
*
* @param collection the collection
* @return the boolean
*/
public static boolean isEmpty(Collection> collection) {
return CollectionUtils.isEmpty(collection);
}
/**
* 判断 Collection 是否非空
*
* @param collection the collection
* @return the boolean
*/
public static boolean isNotEmpty(Collection> collection) {
return !isEmpty(collection);
}
/**
* 判断 Map 是否为空
*
* @param map the map
* @return the boolean
*/
public static boolean isEmpty(Map, ?> map) {
return MapUtils.isEmpty(map);
}
/**
* 判断 Map 是否非空
*
* @param map the map
* @return the boolean
*/
public static boolean isNotEmpty(Map, ?> map) {
return !isEmpty(map);
}
}