读书人

List isEmpty()跟size()==0 有什么区别

发布时间: 2012-11-05 09:35:12 作者: rapoo

List isEmpty()和size()==0 有什么区别
没有区别,isEmpty()方法也是判断size是否为0.

/**
* Tests if this list has no elements.
*
* @return <tt>true</tt> if this list has no elements;
* <tt>false</tt> otherwise.
*/
public boolean isEmpty() {
return size == 0;
}

读书人网 >编程

热点推荐