java.util.List翻译(2)

2008-02-23 09:33:40来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

- element to be stored at the specified position. 存储在指定位置的元素。
Returns:
the element previously at the specified position. 指定位置的原元素。
Throws:
UnsupportedOperationException - if the set method is not supported by this list. 如果列表不支持set方法时抛出。
ClassCastException - if the class of the specified element prevents it from being added to this list. 如果指定元素的类型阻止其加入列表时抛出。
NullPointerException - if the specified element is null and this list does not support null elements. 如果指定元素为null而列表不支持null元素时抛出。
IllegalArgumentException - if some aspect of the specified element prevents it from being added to this list. 如果指定元素的某些方面不允许它加入当前列表则抛出。
IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size()). 如果下标超出(index < 0 || index >= size())的范围时抛出。

Object element)
Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices). 向列表指定位置插入指定元素(可选操作)。当前位置的元素(若有)和所有后续元素右移(下标加1)。

Parameters:
index - index at which the specified element is to be inserted. 要插入指定元素的位置。
element - element to be inserted. 要插入的元素。
Throws:
UnsupportedOperationException - if the add method is not supported by this list. 如果列表不支持add方法时抛出。
ClassCastException - if the class of the specified element prevents it from being added to this list. 如果指定元素的类型阻止其加入列表时抛出。
NullPointerException - if the specified element is null and this list does not support null elements. 如果指定元素为null而列表不支持null元素时抛出。
IllegalArgumentException - if some aspect of the specified element prevents it from being added to this list. 如果指定元素的某些方面不允许它加入当前列表则抛出。
IndexOutOfBoundsException - if the index is out of range (index < 0 || index > size()). 如果下标超出(index < 0 || index > size())的范围时抛出。

int toIndex)
Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive. (If fromIndex and toIndex are equal, the returned list is empty.) The returned list is backed by this list, so non-structural changes in the returned list are reflected in this list, and vice-versa. The returned list supports all of the optional list operations supported by this list. 返回从fromIndex(含)到toIndex(不含)的部分列表视图。如果fromIndex和toIndex 相等,返回列表为空。返回列表由当前列表得出,因此返回列表的非结构性更改会影响到当前列表。 返回列表支持当前列表支持的所有可选操作。

This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays). Any operation that expects a list can be used as a range operation by passing a subList view instead of a whole list. For example, the following idiom removes a range of elements from a list: 该方法克服了显式范围操作时需将列表转换成数组的弊端。 对于希望将列表用于范围操作的方法只需要传递给子列表视图代之整个列表。 例如,以下语法删除列表中某个范围的元素:

	    list.subList(from, to).clear();

 
Similar idioms may be constructed for indexOf and lastIndexOf, and all of the algorithms in the Collections class can be applied to a subList. 对于indexOf和lastIndexOf的用法相似,Collections类的所有算法 都可以在子列表中应用。

The semantics of the list returned by this method become undefined if the backing list (i.e., this list) is structurally modified in any way other than via the returned list. (Structural modifications are those that change the size of this list, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results.) 如果返回列表通过某种方式使当前列表发生了结构性的改变,该方法返回的列表语义 将变得不能确定。(结构性的改变指改变列表的大小,或者在迭代过程中 以其它方式使得生成结果不正确。)

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:PDF背景灰色图片设定方法

下一篇:[oracle]使用Oracle10g jdbc 驱动中ConnectionCaching所产生的问