|
|
|
PriorityQueue не пойму как работает
|
|||
|---|---|---|---|
|
#18+
Код: java 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. выводит: r=-27.0 r=259.0 r=10.0 r=407.5 r=377.0 r=294.0 А в моем понимании, должно выводить эти числа в порядке возрастания. ЧЯДНТ? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 09.10.2014, 19:38 |
|
||
|
PriorityQueue не пойму как работает
|
|||
|---|---|---|---|
|
#18+
chabapok, RTFMThis class and its iterator implement all of the optional methods of the Collection and Iterator interfaces. The Iterator provided in method iterator() is not guaranteed to traverse the elements of the priority queue in any particular order. If you need ordered traversal, consider using Arrays.sort(pq.toArray()). ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 09.10.2014, 19:46 |
|
||
|
PriorityQueue не пойму как работает
|
|||
|---|---|---|---|
|
#18+
Документацию не читаете: "The Iterator provided in method iterator() is not guaranteed to traverse the elements of the priority queue in any particular order. If you need ordered traversal, consider using Arrays.sort(pq.toArray())" ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 09.10.2014, 19:47 |
|
||
|
|

start [/forum/topic.php?fid=59&msg=38772315&tid=2126476]: |
0ms |
get settings: |
9ms |
get forum list: |
21ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
171ms |
get topic data: |
10ms |
get forum data: |
2ms |
get page messages: |
44ms |
get tp. blocked users: |
1ms |
| others: | 215ms |
| total: | 481ms |

| 0 / 0 |
