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

Comparing jsr166/src/test/jtreg/util/PriorityQueue/PriorityQueueSort.java (file contents):
Revision 1.2 by jsr166, Mon Sep 1 04:28:03 2003 UTC vs.
Revision 1.11 by jsr166, Sat Sep 17 20:38:49 2016 UTC

# Line 1 | Line 1
1   /*
2 < * @test %I% %E%
2 > * Written by Doug Lea with assistance from members of JCP JSR-166
3 > * Expert Group and released to the public domain, as explained at
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5 > */
6 >
7 > /*
8 > * @test
9   * @bug 4486658
10   * @summary Checks that a priority queue returns elements in sorted order across various operations
5 *
6 * @compile -source 1.5 PriorityQueueSort.java
7 * @run main PriorityQueueSort
11   */
12  
13 < import java.util.*;
13 > import java.util.ArrayList;
14 > import java.util.Collections;
15 > import java.util.Comparator;
16 > import java.util.Iterator;
17 > import java.util.List;
18 > import java.util.Queue;
19 > import java.util.PriorityQueue;
20  
21   public class PriorityQueueSort {
22  
23 <    static class MyComparator implements Comparator<Integer> {
23 >    static class MyComparator implements Comparator<Integer> {
24          public int compare(Integer x, Integer y) {
25 <            int i = ((Integer)x).intValue();
26 <            int j = ((Integer)y).intValue();
25 >            int i = x.intValue();
26 >            int j = y.intValue();
27              if (i < j) return -1;
28              if (i > j) return 1;
29              return 0;
# Line 25 | Line 34 | public class PriorityQueueSort {
34          int n = 10000;
35          if (args.length > 0)
36              n = Integer.parseInt(args[0]);
37 <        
37 >
38          List<Integer> sorted = new ArrayList<Integer>(n);
39          for (int i = 0; i < n; i++)
40              sorted.add(new Integer(i));
# Line 66 | Line 75 | public class PriorityQueueSort {
75              throw new RuntimeException("Iterator remove test failed.");
76      }
77   }
69

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines