T --元素类型返回此primitiveiterator。类型必须是一个原始类型包装类型,如原始
int型
Integer。
T_CONS -原始型消费。类型必须是原始的专业化
Consumer为
T,如
IntConsumer为
Integer。
public interface PrimitiveIterator<T,T_CONS> extends Iterator<T>
Iterator原始专业基地型。专业分型提供了
int,
long,和
double值。
专业型的默认实现的Iterator.next()和Iterator.forEachRemaining(java.util.function.Consumer)箱原始值及其对应的包装类的实例。这样的拳击可能会抵消任何优势获得了当使用原始类型。为了避免拳击,应使用相应的基于原始的方法。例如,PrimitiveIterator.OfInt.nextInt()和PrimitiveIterator.OfInt.forEachRemaining(java.util.function.IntConsumer)应优先用于PrimitiveIterator.OfInt.next()和PrimitiveIterator.OfInt.forEachRemaining(java.util.function.Consumer)。
用拳击方法next()和forEachRemaining()原始值迭代,不影响该值的顺序,将装箱值,遇到。
org.openjdk.java.util.stream.tripwire设置
true然后诊断警告报告如果原始值时发生的操作对原始型拳击专业。
| Modifier and Type | Interface and Description |
|---|---|
static interface |
PrimitiveIterator.OfDouble
一个专门
double值迭代器。
|
static interface |
PrimitiveIterator.OfInt
一个专门
int值迭代器。
|
static interface |
PrimitiveIterator.OfLong
一个专门
long值迭代器。
|
| Modifier and Type | Method and Description |
|---|---|
void |
forEachRemaining(T_CONS action)
其余的每个元素执行特定动作的顺序时,元素的迭代,直到所有的元素都被处理或操作抛出异常。
|
forEachRemaining, hasNext, next, removevoid forEachRemaining(T_CONS action)
action -是的每个元素执行的动作
NullPointerException -如果指定动作是无效的
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.