我正在使用IBM JVM 8和Eclipse。 我想要一个整数范围的迭代器。
所以我尝试使用IntStream.range()并得到一个奇怪的错误。 我现在已经删除了迭代器部分以获得问题的最小示例。 此行导致错误:
IntStream range = IntStream.range(0,max);错误是:接口IntStream的这个静态方法只能作为IntStream.range访问
但这不是我的访问方式吗? 如何在不产生错误的情况下使其工作?
(当然我可以使用循环而不是迭代器,但迭代器会更整洁)。
I am using IBM JVM 8 and Eclipse. I want an iterator over a range of integers.
So I try to use IntStream.range() and get a weird error. I have now removed the iterator part to get a minimal example of the problem. This line causes an error:
IntStream range = IntStream.range(0,max);The error is: This static method of interface IntStream can only be accessed as IntStream.range
But isn't this how I am accessing it already? How can I get it to work without producing errors?
(Of course I can use a loop instead of an iterator, but the iterator would be neater).
最满意答案
参考IntStream java doc和JDK 8兼容性指南 Interface IntStream仅在Java 1.8之后才出现。 在Java Build Path上使用执行环境'JavaSE-1.8'的合规性并重建项目。
Referring to the IntStream java doc and Compatibility Guide for JDK 8 Interface IntStream is only brought up since Java 1.8. Use compliance from execution environment 'JavaSE-1.8' on the Java Build Path and rebuild the project.
更多推荐
发布评论