16 |
|
*/ |
17 |
|
static <T> void seqApply(T[] array, Ops.Procedure<T> f) { |
18 |
|
int n = array.length; |
19 |
< |
for (int i = 0; i < n; ++i) |
19 |
> |
for (int i = 0; i < n; ++i) |
20 |
|
f.op(array[i]); |
21 |
|
} |
22 |
|
|
24 |
|
* A sample procedure to apply |
25 |
|
*/ |
26 |
|
static final class Proc implements Ops.Procedure<Rand> { |
27 |
< |
public void op(Rand x) { |
27 |
> |
public void op(Rand x) { |
28 |
|
for (int k = 0; k < (1 << 10); ++k) |
29 |
|
x.next(); |
30 |
|
} |
41 |
|
public static void test() throws Exception { |
42 |
|
int n = 1 << 18; |
43 |
|
Rand[] array = new Rand[n]; |
44 |
< |
for (int i = 0; i < n; ++i) |
44 |
> |
for (int i = 0; i < n; ++i) |
45 |
|
array[i] = new Rand(i); |
46 |
|
final Proc proc = new Proc(); |
47 |
|
long last, now; |