import java.util.*;public class Test19{

public static void main(String[] args){
Queue<Integer> queue = new PriorityQueue<Integer>(10,new Comparator<Integer>(){
public int compare(Integer i, Integer j){
int result = i % 2 - j % 2;
if(result == 0){
result = i - j;
}
return result;
}
});

for(int i = 0; i < 10; i++){
queue.offer(i);
}

for(int i = 0; i < 10; i++){
System.out.println(queue.poll());
}
}
}//输出为 0 2 4 6 8 1 3 5 7 9
解释下过程!! 多谢