如使用继承则设计,应当文档说明,否则不该使用

This commit is contained in:
sjsdfg
2019-03-15 11:41:56 +08:00
parent b9de3b60d4
commit deb37f1719

View File

@@ -8,6 +8,7 @@
```java
public boolean remove(Object o)
Removes a single instance of the specified element from this collection, if it is present (optional operation). More formally, removes an element e such that Objects.equals(o, e), if this collection contains one or more such elements. Returns true if this collection contained the specified element (or equivalently, if this collection changed as a result of the call).
Implementation Requirements: This implementation iterates over the collection looking for the specified element. If it finds the element, it removes the element from the collection using the iterators remove method. Note that this implementation throws an UnsupportedOperationException if the iterator returned by this collections iterator method does not implement the remove method and this collection contains the specified object.
@@ -27,13 +28,16 @@ Implementation Requirements: This implementation iterates over the collection lo
```java
protected void removeRange(int fromIndex, int toIndex)
Removes from this list all of the elements whose index is between fromIndex, inclusive, and toIndex, exclusive. Shifts any succeeding elements to the left (reduces their index). This call shortens the list by (toIndex - fromIndex) elements. (If toIndex == fromIndex, this operation has no effect.)
This method is called by the clear operation on this list and its sublists. Overriding this method to take advantage of the internals of the list implementation can substantially improve the performance of the clear operation on this list and its sublists.
Implementation Requirements: This implementation gets a list iterator positioned before fromIndex and repeatedly calls ListIterator.nextfollowed by ListIterator.remove, until the entire range has been removed. Note: If ListIterator.remove requires linear time, this implementation requires quadratic time.
Parameters:
fromIndex index of first element to be removed.
toIndex index after last element to be removed.
fromIndex index of first element to be removed.
toIndex index after last element to be removed.
```
  从此列表中删除索引介于 `fromIndex`(包含)和 `inclusive`(不含)之间的所有元素。 将任何后续元素向左移(减少索引)。 这个调用通过(`toIndex - fromIndex`)元素来缩短列表。 (如果 `toIndex == fromIndex`,则此操作无效。)