一样的
看看Javadoc原文This method is identical in functionality to the add(Object) method (which is part of the List interface).
只是一个是继承来的
看看Javadoc原文This method is identical in functionality to the add(Object) method (which is part of the List interface).
只是一个是继承来的
public synchronized void addElement(Object obj) {
modCount++;
ensureCapacityHelper(elementCount + 1);
elementData[elementCount++] = obj;
}
public synchronized boolean add(Object o) {
modCount++;
ensureCapacityHelper(elementCount + 1);
elementData[elementCount++] = o;
return true;
}
你说有什么区别?自己看代码就是了。