/** * Lazily constructs a Collection from specified Stream. Collections iterator may be safely used * concurrently by multiple threads. * @param stream * @return */ public static final <A> Collection<A> toConcurrentLazyCollection(Stream<A> stream) { return toConcurrentLazyCollection(stream.iterator()); } public static final <A> Collection<A> toConcurrentLazyCollection(Iterator<A> iterator){