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

List isEmpty()和size()0 有什么区别没有区别,isEmpty()方法也是判断size是否为0./*** Tests if this li

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;
  }