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

Comparing jsr166/src/test/loops/PriorityQueueSort.java (file contents):
Revision 1.1 by dl, Mon May 2 19:19:38 2005 UTC vs.
Revision 1.5 by jsr166, Mon Nov 2 23:51:32 2009 UTC

# Line 1 | Line 1
1   /*
2 + * Written by Josh Bloch and Doug Lea with assistance from members of
3 + * JCP JSR-166 Expert Group and released to the public domain, as
4 + * explained at http://creativecommons.org/licenses/publicdomain
5 + */
6 + /*
7   * @test
8   * @synopsis Checks that a priority queue returns elements in sorted order across various operations
9   */
# Line 7 | Line 12 | import java.util.*;
12  
13   public class PriorityQueueSort {
14  
15 <    static class MyComparator implements Comparator<Integer> {
15 >    static class MyComparator implements Comparator<Integer> {
16          public int compare(Integer x, Integer y) {
17 <            int i = ((Integer)x).intValue();
18 <            int j = ((Integer)y).intValue();
17 >            int i = x;
18 >            int j = y;
19              if (i < j) return -1;
20              if (i > j) return 1;
21              return 0;
# Line 18 | Line 23 | public class PriorityQueueSort {
23      }
24  
25      public static void main(String[] args) {
26 <        int n = 10000;
26 >        int n = 100000;
27          if (args.length > 0)
28              n = Integer.parseInt(args[0]);
29 <        
29 >
30          List<Integer> sorted = new ArrayList<Integer>(n);
31          for (int i = 0; i < n; i++)
32              sorted.add(new Integer(i));
# Line 62 | Line 67 | public class PriorityQueueSort {
67              throw new RuntimeException("Iterator remove test failed.");
68      }
69   }
65

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines