File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
api/src/main/java/net/jqwik/api Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 44import java .util .stream .*;
55
66import org .apiguardian .api .*;
7+ import org .jetbrains .annotations .*;
78
89import static org .apiguardian .api .API .Status .*;
910
@@ -41,9 +42,7 @@ public static <T> ShrinkingDistance combine(List<Shrinkable<T>> shrinkables) {
4142 throw new IllegalArgumentException ("At least one shrinkable is required" );
4243 }
4344 // This is an optimization to avoid creating many temporary arrays, which the old streams-based implementation did.
44- List <long []> shrinkableDistances = shrinkables .stream ()
45- .map (tShrinkable -> tShrinkable .distance ().distances )
46- .collect (Collectors .toList ());
45+ List <long []> shrinkableDistances = toDistances (shrinkables );
4746 long [] combinedDistances = concatenate (shrinkableDistances );
4847 return new ShrinkingDistance (combinedDistances );
4948 }
@@ -120,4 +119,14 @@ public ShrinkingDistance append(ShrinkingDistance other) {
120119 return new ShrinkingDistance (appendedDistances );
121120 }
122121
122+ @ NotNull
123+ private static <T > List <long []> toDistances (List <Shrinkable <T >> shrinkables ) {
124+ List <long []> listOfDistances = new ArrayList <>(shrinkables .size ());
125+ for (Shrinkable <?> tShrinkable : shrinkables ) {
126+ long [] longs = tShrinkable .distance ().distances ;
127+ listOfDistances .add (longs );
128+ }
129+ return listOfDistances ;
130+ }
131+
123132}
You can’t perform that action at this time.
0 commit comments