net.jqwik.vavr.arbitraries.collection.map.VavrTreeMultimapArbitrary Maven / Gradle / Ivy
package net.jqwik.vavr.arbitraries.collection.map;
import net.jqwik.vavr.NaturalComparator;
import net.jqwik.vavr.arbitraries.base.MapBasedArbitrary;
import io.vavr.collection.TreeMultimap;
import net.jqwik.api.Arbitrary;
import java.util.Comparator;
import java.util.Map;
/**
* @author Benno Müller
*/
public class VavrTreeMultimapArbitrary extends MapBasedArbitrary> {
private final Comparator keyComparator;
public VavrTreeMultimapArbitrary(
final Arbitrary keysArbitrary,
final Arbitrary valuesArbitrary,
final Comparator keyComparator) {
super(keysArbitrary, valuesArbitrary);
this.keyComparator = keyComparator;
}
public VavrTreeMultimapArbitrary(final Arbitrary keysArbitrary, final Arbitrary valuesArbitrary) {
this(keysArbitrary, valuesArbitrary, NaturalComparator.instance());
}
@Override
protected TreeMultimap convertJavaMapToVavrMap(Map javaMap) {
return TreeMultimap.withSeq().ofAll(this.keyComparator, javaMap);
}
}