T
--元素类型
public interface Iterable<T>
Modifier and Type | Method and Description |
---|---|
default void |
forEach(Consumer<? super T> action)
执行特定动作的每一个元素的
Iterable 直到所有元素都被处理或操作抛出异常。
|
Iterator<T> |
iterator()
返回类型
T 元素的迭代器。
|
default Spliterator<T> |
spliterator()
在这
Iterable 创建描述元素的
Spliterator 。
|
default void forEach(Consumer<? super T> action)
Iterable
直到所有元素都被处理或操作抛出异常。除非实现类的其他指定,否则操作在迭代的顺序中(如果指定了一个迭代顺序)。由操作引发的异常被传递给调用方。
默认实现的行为像:
for (T t : this)
action.accept(t);
action
-是的每个元素执行的动作
NullPointerException
-如果指定动作是无效的
default Spliterator<T> spliterator()
Iterable
创建描述元素的
Spliterator
。
Iterator
早期绑定spliterator。的spliterator继承快速失败迭代器迭代器的性能研究。
Iterable
元素的
Spliterator
。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.