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 4
4
import java .util .stream .*;
5
5
6
6
import org .apiguardian .api .*;
7
+ import org .jetbrains .annotations .*;
7
8
8
9
import static org .apiguardian .api .API .Status .*;
9
10
@@ -41,9 +42,7 @@ public static <T> ShrinkingDistance combine(List<Shrinkable<T>> shrinkables) {
41
42
throw new IllegalArgumentException ("At least one shrinkable is required" );
42
43
}
43
44
// 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 );
47
46
long [] combinedDistances = concatenate (shrinkableDistances );
48
47
return new ShrinkingDistance (combinedDistances );
49
48
}
@@ -120,4 +119,14 @@ public ShrinkingDistance append(ShrinkingDistance other) {
120
119
return new ShrinkingDistance (appendedDistances );
121
120
}
122
121
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
+
123
132
}
You can’t perform that action at this time.
0 commit comments