package nc.vo.pf.util;
import java.lang.reflect.Array;
import java.util.List;
public class ListUtil {
private ListUtil() {
super();
}
public static boolean isEmpty(List list) {
if ((list == null) || (list.size() == 0)) {
return true;
}
return false;
}
@SuppressWarnings("unchecked")
public static E[] toArray(List list) {
if (ListUtil.isEmpty(list)) {
return null;
}
E notNullItem = null;
boolean find = false;
for (E e : list) {
if (find) {
break;
}
if (e != null) {
notNullItem = e;
find = true;
}
}
E[] result = null;
if (notNullItem != null) {
result = (E[]) Array.newInstance(notNullItem.getClass(), list.size());
result = list.toArray(result);
}
return result;
}
}