org.paukov.combinatorics3.SimpleSubSetGenerator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of combinatoricslib3 Show documentation
Show all versions of combinatoricslib3 Show documentation
Combinatorial objects stream generators for Java.
/**
* Combinatorics Library 3
* Copyright 2009-2016 Dmytro Paukov [email protected]
*/
package org.paukov.combinatorics3;
import java.util.*;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
class SimpleSubSetGenerator implements IGenerator> {
final List originalVector;
SimpleSubSetGenerator(Collection originalVector) {
this.originalVector = new ArrayList<>(originalVector);
}
@Override
public Iterator> iterator() {
return new SimpleSubSetIterator<>(this);
}
@Override
public Stream> stream() {
return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator(), 0), false);
}
}