net.jqwik.engine.properties.shrinking.CollectShrinkable Maven / Gradle / Ivy
package net.jqwik.engine.properties.shrinking;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
import net.jqwik.api.*;
public class CollectShrinkable implements Shrinkable> {
private final List value;
private final List> elements;
private final Predicate> until;
public CollectShrinkable(List> elements, Predicate> until) {
this.value = createValue(elements);
this.elements = elements;
this.until = until;
}
@Override
public List value() {
return value;
}
private List createValue(List> elements) {
return elements
.stream()
.map(Shrinkable::value)
.collect(Collectors.toList());
}
@Override
public ShrinkingSequence> shrink(Falsifier> falsifier) {
return new CollectShrinkingSequence<>(elements, until, falsifier);
}
@Override
public ShrinkingDistance distance() {
return ShrinkingDistance.forCollection(elements);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy