首页 文章

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

提问于
浏览
5

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

1 回答

  • 15

    Arrays.asList(array).iterator()

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

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

相关问题