4
4
import org .utbot .engine .overrides .collections .UtArrayList ;
5
5
6
6
import java .util .List ;
7
+ import java .util .stream .DoubleStream ;
8
+ import java .util .stream .IntStream ;
9
+ import java .util .stream .LongStream ;
7
10
import java .util .stream .Stream ;
8
11
9
12
@ UtClassMock (target = java .util .Arrays .class , internalUsage = true )
@@ -18,6 +21,54 @@ public static <T> Stream<T> stream(T[] array, int startInclusive, int endExclusi
18
21
return new UtStream <>(array , startInclusive , endExclusive );
19
22
}
20
23
24
+ // from docs - array is assumed to be umnodified during use
25
+ public static IntStream stream (int [] array , int startInclusive , int endExclusive ) {
26
+ int size = array .length ;
27
+
28
+ if (startInclusive < 0 || endExclusive < startInclusive || endExclusive > size ) {
29
+ throw new ArrayIndexOutOfBoundsException ();
30
+ }
31
+
32
+ Integer [] data = new Integer [size ];
33
+ for (int i = 0 ; i < size ; i ++) {
34
+ data [i ] = array [i ];
35
+ }
36
+
37
+ return new UtIntStream (data , startInclusive , endExclusive );
38
+ }
39
+
40
+ // from docs - array is assumed to be umnodified during use
41
+ public static LongStream stream (long [] array , int startInclusive , int endExclusive ) {
42
+ int size = array .length ;
43
+
44
+ if (startInclusive < 0 || endExclusive < startInclusive || endExclusive > size ) {
45
+ throw new ArrayIndexOutOfBoundsException ();
46
+ }
47
+
48
+ Long [] data = new Long [size ];
49
+ for (int i = 0 ; i < size ; i ++) {
50
+ data [i ] = array [i ];
51
+ }
52
+
53
+ return new UtLongStream (data , startInclusive , endExclusive );
54
+ }
55
+
56
+ // from docs - array is assumed to be umnodified during use
57
+ public static DoubleStream stream (double [] array , int startInclusive , int endExclusive ) {
58
+ int size = array .length ;
59
+
60
+ if (startInclusive < 0 || endExclusive < startInclusive || endExclusive > size ) {
61
+ throw new ArrayIndexOutOfBoundsException ();
62
+ }
63
+
64
+ Double [] data = new Double [size ];
65
+ for (int i = 0 ; i < size ; i ++) {
66
+ data [i ] = array [i ];
67
+ }
68
+
69
+ return new UtDoubleStream (data , startInclusive , endExclusive );
70
+ }
71
+
21
72
@ SuppressWarnings ({"unused" , "varargs" })
22
73
@ SafeVarargs
23
74
public static <T > List <T > asList (T ... a ) {
0 commit comments