14 |
|
static final AtomicInteger checksum = new AtomicInteger(); |
15 |
|
static boolean print; |
16 |
|
static boolean allClasses = false; // true if also test dumb/default classes |
17 |
< |
static final BinaryOperator<Integer> MAX = |
17 |
> |
static final BinaryOperator<Integer> MAX = |
18 |
|
(Integer x, Integer y) -> x >= y ? x : y; |
19 |
|
|
20 |
|
public static void main(String[] args) throws Exception { |
36 |
|
} |
37 |
|
} |
38 |
|
|
39 |
< |
static String sep() { return print? "\n" : " "; } |
39 |
> |
static String sep() { return print ? "\n" : " "; } |
40 |
|
|
41 |
|
static void allTests(int size, int trials) throws Exception { |
42 |
|
System.out.println("---------------------------------------------"); |
111 |
|
throw new Error("bad computation"); |
112 |
|
} |
113 |
|
|
114 |
< |
static void ctest(Collection<Integer> c, List<Integer> klist, int kmax, int size, int trials) |
114 |
> |
static void ctest(Collection<Integer> c, List<Integer> klist, int kmax, int size, int trials) |
115 |
|
throws Exception { |
116 |
|
String cn = c.getClass().getName(); |
117 |
|
if (cn.startsWith("java.util.concurrent.")) |
159 |
|
long tlast = System.nanoTime(); |
160 |
|
for (int i = 0; i < trials; ++i) { |
161 |
|
Integer pmax = Integer.valueOf(Integer.MIN_VALUE - checksum.get()); |
162 |
< |
for (Integer x : c) |
162 |
> |
for (Integer x : c) |
163 |
|
pmax = MAX.apply(pmax, x); |
164 |
|
checksum.getAndAdd(max - pmax); |
165 |
|
} |