标签:dom import ring imp ble test public class 结果
1 package test_20_2; 2 3 import java.util.PriorityQueue; 4 5 public class PriorityQueueTest { 6 7 public static void main(String[] args) { 8 9 PriorityQueue<Double> priorityQueue = new PriorityQueue<Double>(); 10 11 for (int i = 0; i < 10; i++) { 12 double num = Math.random(); 13 priorityQueue.offer(num); 14 } 15 int len = priorityQueue.size(); 16 17 for (int i = 0; i < len; i++) { 18 System.out.println(priorityQueue.poll()); 19 } 20 } 21 }
结果如下:
0.2770926360588323
0.33959641990390255
0.34947907718022275
0.37961640094552984
0.47218730365522155
0.6396464814107589
0.7152140108374734
0.7284752474925242
0.8653329482114109
0.86765955199973
[20-05-23][Thinking in Java 39]Java Container 11 - PriorityQueue
标签:dom import ring imp ble test public class 结果
原文地址:https://www.cnblogs.com/mirai3usi9/p/12945220.html