All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.paukov.combinatorics3.PermutationWithRepetitionGenerator Maven / Gradle / Ivy

There is a newer version: 3.4.0
Show newest version
package org.paukov.combinatorics3;


import java.util.*;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

class PermutationWithRepetitionGenerator implements IGenerator> {


    final List originalVector;
    final int permutationLength;


    PermutationWithRepetitionGenerator(
            Collection originalVector, int permutationLength) {
        this.originalVector = new ArrayList<>(originalVector);
        this.permutationLength = permutationLength;
    }


    @Override
    public Iterator> iterator() {
        return new PermutationWithRepetitionIterator<>(this);
    }


    @Override
    public Stream> stream() {
        return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator(), 0), false);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy