ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/IntegerMax.java
(Generate patch)

Comparing jsr166/src/test/loops/IntegerMax.java (file contents):
Revision 1.1 by dl, Thu Feb 28 11:41:56 2013 UTC vs.
Revision 1.2 by jsr166, Thu Feb 28 16:33:53 2013 UTC

# Line 14 | Line 14 | public class IntegerMax {
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 {
# Line 36 | Line 36 | public class IntegerMax {
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("---------------------------------------------");
# Line 111 | Line 111 | public class IntegerMax {
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."))
# Line 159 | Line 159 | public class IntegerMax {
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          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines