HIGUCHI Yuta

Utility method to treat Iterable as a Stream.

Change-Id: I70564ee9fa675c4293aa733b1a28e63c12dea0b7
......@@ -46,6 +46,8 @@ import java.util.concurrent.Future;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import org.slf4j.Logger;
......@@ -460,6 +462,16 @@ public abstract class Tools {
return bytes;
}
/**
* Converts an Iterable to a Stream.
*
* @param it Iterable to convert
* @return Iterable as a Stream
*/
public static <T> Stream<T> stream(Iterable<T> it) {
return StreamSupport.stream(it.spliterator(), false);
}
// Auxiliary path visitor for recursive directory structure copying.
private static class DirectoryCopier extends SimpleFileVisitor<Path> {
private Path src;
......