E - the type of element iterated over
public class SubsetIterator<E> extends Objectimplements Iterator <Set <E>>
| Constructor and Description |
|---|
SubsetIterator(Set
Create an iterator to iterate over all subsets of the argument provided.
|
SubsetIterator(Set
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNext()
|
Set |
next()
|
void |
remove()
Throws an UnsupportedOperationException.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic SubsetIterator(Set<E> elements, boolean includeEmptySet)
SortedSet, then the
Comparator used for that set is used to sort results of this class.
includeEmptySet - if true then the first value this returns will be an empty set. If false then then first value this returns will have 1 element. (If false and
elements is empty: an exception will be thrown.)
elements - the elements to create subsets of. Note this class continues to reference this argument, so you should not modify this set once this iterator is constructed.
public SubsetIterator(Set<E> elements, Comparator <E> comparator, int minSetSize, int maxSetSize)
elements - the elements to create subsets of. Note this class continues to reference this argument, so you should not modify this set once this iterator is constructed.
comparator - an optional comparator to sort the returned results.
minSetSize - the smallest subset size to return. This may be [zero, max].
maxSetSize - the largest subset size to return. This must be larger than the minimum, and not larger than
elements.size().