Apache Commons Collections中是否存在与ArrayIterator的通用等价物?

时间:2022-01-10 20:45:01

ArrayIterator is handy (although I don't need the reset functionality), but like the rest of the Commons Collections stuff, it doesn't use generics. I checked Google Collections, but I didn't see a close equivalent. Did I miss it? Is there another library of similar reputation and quality as the first two that provides such a thing? Thanks.

ArrayIterator很方便(虽然我不需要重置功能),但是像其他的Commons Collections一样,它不使用泛型。我检查了Google Collections,但我没有看到相同的等价物。我错过了吗?是否有另外一个具有类似声誉和质量的图书馆,前两个图书馆提供这样的东西?谢谢。

1 个解决方案

#1


15  

Arrays.asList(array).iterator()

Arrays.asList(array).subList(start, end).iterator()

These method calls are cheap -- they don't actually copy any data. The Arrays class is in java.util, of course.

这些方法调用很便宜 - 它们实际上并不复制任何数据。当然,Arrays类在java.util中。

#1


15  

Arrays.asList(array).iterator()

Arrays.asList(array).subList(start, end).iterator()

These method calls are cheap -- they don't actually copy any data. The Arrays class is in java.util, of course.

这些方法调用很便宜 - 它们实际上并不复制任何数据。当然,Arrays类在java.util中。