RSS
热门关键字:  数据挖掘  人工智能  数据仓库  搜索引擎  数据挖掘导论

java.util.Iterator翻译

来源: 作者:unkonwn 时间:2005-11-20 点击:

 
JavaTM 2 Platform

数据挖掘研究院


Std. Ed. v1.4.2

java.util

数据挖掘实验室


Interface Iterator

All Known Subinterfaces:
ListIterator
All Known Implementing Classes:
BeanContextSupport.BCSIterator

public interface Iterator

An iterator over a collection. Iterator takes the place of Enumeration in the Java collections framework. Iterators differ from enumerations in two ways: iterator重载了collection。在Java集合框架中Iterator用来替代Enumeration。Iterator和Enumeration 在以下两方面不同: 数据挖掘研究院

  • Iterators allow the caller to remove elements from the underlying collection during the iteration with well-defined semantics. Iterator允许调用者使用好的语义在迭代中从底层集合中删除元素。
  • Method names have been improved. 方法名称有改进。

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

数据挖掘研究院

Since:
1.2
See Also:
Collection, ListIterator, Enumeration

Method Summary
 booleanhasNext()

数据挖掘研究院


          Returns true if the iteration has more elements. 如果迭代中还有元素返回true。
 Objectnext()
          Returns the next element in the iteration. 返回迭代中的下一个元素。
 voidremove()
          Removes from the underlying collection the last element returned by the iterator (optional operation). 迭代器从底层集合中删除刚返回的元素(可选操作)。
  数据挖掘研究院

Method Detail
数据挖掘实验室

hasNext

public boolean hasNext()  
Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.) 如果迭代中还有元素返回true。(换言之,如果next返回一个元素而不是抛出异常的话,返回true。)

Returns:
true if the iterator has more elements. 如果迭代中还有元素返回true。

next

public Object next() 数据挖掘研究院 
Returns the next element in the iteration. 返回迭代中的下一个元素。

数据挖掘研究院

Returns:
the next element in the iteration. 迭代中下一个元素。
Throws:
NoSuchElementException - iteration has no more elements. 如果迭代中没有元素时抛出。

remove

public void remove() 

数据挖掘研究院

Removes from the underlying collection the last element returned by the iterator (optional operation). This method can be called only once per call to next. The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method. 迭代器从底层集合中删除刚返回的元素(可选操作)。该方法只能在每次调用next后调用一次。 如果底层集合已被修改而迭代器正在进程中(除了调用本方法),则迭代器的行为不能确定。

数据挖掘研究院

Throws:
UnsupportedOperationException - if the remove operation is not supported by this Iterator. 如果Iterator不支持remove操作时抛出。
IllegalStateException - if the next method has not yet been called, or the remove method has already been called after the last call to the next method. next方法还未调用,或在上一次调用next后已调用过remove方法时抛出。

JavaTM 2 Platform 数据挖掘研究院
Std. Ed. v1.4.2

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.

最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
匿名?