分享
 
 
 

java.util.ListIterator翻译

王朝java/jsp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

[/url] [url=file:///F:/资料/文字资料/j2sdk-1_4_2-doc/docs/api/overview-summary.html]Overview

Package

Class

Use

Tree

Deprecated

Index

Help

JavaTM 2 Platform

Std. Ed. v1.4.2

PREV CLASS NEXT CLASS

FRAMES NO FRAMES All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

java.util

Interface ListIteratorAll Superinterfaces: Iterator public interface ListIterator extends IteratorAn iterator for lists that allows the programmer to traverse the list in either direction, modify the list during iteration, and obtain the iterator's current position in the list. A ListIterator has no current element; its cursor position always lies between the element that would be returned by a call to previous() and the element that would be returned by a call to next(). In a list of length n, there are n+1 valid index values, from 0 to n, inclusive. 列表的迭代器允许程序员以不同方向遍历列表,遍历中修改列表,获得列表中迭代器的当前位置。 ListIterator没有当前元素,光标位置总是位于调用previous()返回的元素和 调用next()返回的元素之间。在长度为n的列表中,有n+1个有效下标值。 包括从0到n。

Element(0) Element(1) Element(2) ... Element(n)

^ ^ ^ ^ ^

Index: 0 1 2 3 n+1

Note that the remove() and set(Object) methods are not defined in terms of the cursor position; they are defined to operate on the last element returned by a call to next() or previous(). 注意remove()和set(Object)方法没有定义为和光标位置相关,它们 定义为操作调用next()或previous()后返回的元素。

This interface is a member of the Java Collections Framework. 该接口是Java集合框架的成员之一。

Since: 1.2 See Also: Collection, List, Iterator, EnumerationMethod Summary

void

add(Object o)

Inserts the specified element into the list (optional operation). 向列表插入指定元素(可选操作)。

boolean

hasNext()

Returns true if this list iterator has more elements when traversing the list in the forward direction. 正向遍历列表时,如果列表迭代器还有元素,返回true。

boolean

hasPrevious()

Returns true if this list iterator has more elements when traversing the list in the reverse direction. 逆向遍历列表时,如果列表迭代器还有元素,返回true。

Object

next()

Returns the next element in the list. 返回列表的下一个元素。

int

nextIndex()

Returns the index of the element that would be returned by a subsequent call to next. 返回接下去调用next所返回元素的下标。

Object

previous()

Returns the previous element in the list. 返回列表的前一个元素。

int

previousIndex()

Returns the index of the element that would be returned by a subsequent call to previous. 返回接下去调用previous所返回元素的下标。

void

remove()

Removes from the list the last element that was returned by next or previous (optional operation). 从列表中删除next或previous返回的元素(可选操作)。

void

set(Object o)

Replaces the last element returned by next or previous with the specified element (optional operation). 用指定元素替换next或previous返回的元素(可选操作)。

Method Detail

hasNextpublic boolean hasNext()

Returns true if this list iterator has more elements when traversing the list in the forward direction. (In other words, returns true if next would return an element rather than throwing an exception.) 正向遍历列表时,如果列表迭代器还有元素,返回true。(换句话说,如果next返回一个元素而不是抛出异常, 返回true。)

Specified by: hasNext in interface IteratorReturns: true if the list iterator has more elements when traversing the list in the forward direction. 正向遍历列表时,如果列表迭代器还有元素,返回true。nextpublic Object next()

Returns the next element in the list. This method may be called repeatedly to iterate through the list, or intermixed with calls to previous to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.) 返回列表的下一个元素。该方法可能重复调用以遍历列表,或者和previous 联合调用来向后或向前。(注意交替调用next和previous将重复返回相同的元素。)

Specified by: next in interface IteratorReturns: the next element in the list. 列表的下一个元素。 Throws: NoSuchElementException - if the iteration has no next element. 如果迭代中没有下一个元素抛出。hasPreviouspublic boolean hasPrevious()

Returns true if this list iterator has more elements when traversing the list in the reverse direction. (In other words, returns true if previous would return an element rather than throwing an exception.) 逆向遍历列表时,如果列表迭代器还有元素,返回true。(换句话说,如果previous返回一个元素而不是抛出异常, 返回true。)

Returns: true if the list iterator has more elements when traversing the list in the reverse direction. 逆向遍历列表时,如果列表迭代器还有元素,返回true。previouspublic Object previous()

Returns the previous element in the list. This method may be called repeatedly to iterate through the list backwards, or intermixed with calls to next to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.) 返回列表的前一个元素。该方法可能重复调用以向后遍历列表,或者和next 联合调用来向后或向前。(注意交替调用next和previous将重复返回相同的元素。)

Returns: the previous element in the list. 列表的前一个元素。 Throws: NoSuchElementException - if the iteration has no previous element. 如果迭代中没有前一个元素抛出。nextIndexpublic int nextIndex()

Returns the index of the element that would be returned by a subsequent call to next. (Returns list size if the list iterator is at the end of the list.) 返回接下去调用next所返回元素的下标。(如果列表迭代器已位于列表末尾,返回列表大小。)

Returns: the index of the element that would be returned by a subsequent call to next, or list size if list iterator is at end of list. 接下去调用next所返回元素的下标,如果列表迭代器已位于列表末尾,返回列表大小。previousIndexpublic int previousIndex()

Returns the index of the element that would be returned by a subsequent call to previous. (Returns -1 if the list iterator is at the beginning of the list.) 返回接下去调用previous所返回元素的下标。(如果列表迭代器已位于列表起始,返回-1。)

Returns: the index of the element that would be returned by a subsequent call to previous, or -1 if list iterator is at beginning of list. 接下去调用previous所返回元素的下标,如果列表迭代器已位于列表起始,返回-1。removepublic void remove()

Removes from the list the last element that was returned by next or previous (optional operation). This call can only be made once per call to next or previous. It can be made only if ListIterator.add has not been called after the last call to next or previous. 从列表中删除next或previous返回的元素(可选操作)。该调用只能在每次调用 next或者previous后执行一次。而且只能在调用next或previous后而没有调用 ListIterator.add前执行。

Specified by: remove in interface IteratorThrows: UnsupportedOperationException - if the remove operation is not supported by this list iterator. 如果列表迭代器不支持remove操作时抛出。 IllegalStateException - neither next nor previous have been called, or remove or add have been called after the last call to * next or previous. 如果next和previous还没被调用或者在调用next或previous之后调用了remove或add抛出。setpublic void set(Object o)

Replaces the last element returned by next or previous with the specified element (optional operation). This call can be made only if neither ListIterator.remove nor ListIterator.add have been called after the last call to next or previous. 用指定元素替换next或previous返回的元素(可选操作)。该调用只能在 调用next或previous后而没有调用ListIterator.remove和ListIterator.add前执行。

Parameters: o - the element with which to replace the last element returned by next or previous. 替换由next或previous返回元素的元素。 Throws: UnsupportedOperationException - if the set operation is not supported by this list iterator. 如果列表迭代器不支持set操作时抛出。 ClassCastException - if the class of the specified element prevents it from being added to this list. 如果指定元素的类型不允许其加入列表时抛出。 IllegalArgumentException - if some aspect of the specified element prevents it from being added to this list. 如果指定元素的某些方面不允许其加入列表时抛出。 IllegalStateException - if neither next nor previous have been called, or remove or add have been called after the last call to next or previous. 如果next和previous还没被调用或者在调用next或previous之后调用了remove或add抛出。addpublic void add(Object o)

Inserts the specified element into the list (optional operation). The element is inserted immediately before the next element that would be returned by next, if any, and after the next element that would be returned by previous, if any. (If the list contains no elements, the new element becomes the sole element on the list.) The new element is inserted before the implicit cursor: a subsequent call to next would be unaffected, and a subsequent call to previous would return the new element. (This call increases by one the value that would be returned by a call to nextIndex or previousIndex.) 向列表插入指定元素(可选操作)。元素被插入在调用next返回的元素之前或者 调用previous返回的元素之后。(如果列表不包含元素,那么新元素成了列表中唯一的元素。) 新元素插入隐式光标之前:随后调用next没有效用,调用previous将返回新元素。 (该调用将使调用nextIndex或previousIndex的返回值加1。)

Parameters: o - the element to insert. 要插入的元素。 Throws: UnsupportedOperationException - if the add method is not supported by this list iterator. 如果列表迭代器不支持add操作时抛出。 ClassCastException - if the class of the specified element prevents it from being added to this list. 如果指定元素的类型不允许其加入列表时抛出。 IllegalArgumentException - if some aspect of this element prevents it from being added to this list. 如果指定元素的某些方面不允许其加入列表时抛出。[/url][url=file:///F:/资料/文字资料/j2sdk-1_4_2-doc/docs/api/overview-summary.html]Overview

Package

Class

Use

Tree

Deprecated

Index

Help

JavaTM 2 Platform

Std. Ed. v1.4.2

PREV CLASS NEXT CLASS

FRAMES NO FRAMES All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature

For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有