1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| PriorityQueue<String> p = new PriorityQueue<String>();
p.offer("aaa");
p.offer("abcd");
p.offer("aaaa");
p.offer("aa");
p.offer("x");
p.offer("bc");
// Résultat : [aa, aaa, aaaa, abcd, x, bc]
PriorityQueue<String> p1 = new PriorityQueue<String>();
p1.offer("abcd");
p1.offer("aaaa");
p1.offer("aa");
p1.offer("x");
p1.offer("bc");
p1.offer("aaa");
// Résultat : [aa, abcd, aaa, x, bc, aaaa]
PriorityQueue<String> p2 = new PriorityQueue<String>();
p2.offer("abcd");
p2.offer("bc");
p2.offer("aaaa");
p2.offer("aa");
p2.offer("x");
p2.offer("aaa");
// Résultat : [aa, aaaa, aaa, bc, x, abcd] |
Partager