将迭代器转换为流
使用 Spliterators.spliterator()
或 Spliterators.spliteratorUnknownSize()
将迭代器转换为流:
Iterator<String> iterator = Arrays.asList("A", "B", "C").iterator();
Spliterator<String> spliterator = Spliterators.spliteratorUnknownSize(iterator, 0);
Stream<String> stream = StreamSupport.stream(spliterator, false);