Exemplo
show how omitting the queue comparator changes element priority semantics
sha256:4c5ea45d1953eb6c9bee6f0124f6cac8618d0a6fde9ad4c2d477cdea982b3a36
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Caso
- Objetivo
- show how omitting the queue comparator changes element priority semantics HOW
- Pacotes
- collection 1.19.1
- Ambiente
- dart
- Criado
- 2026-08-17T02:04:34Z
O que costuma-se supor
A priority queue should return the largest value first when no comparator is supplied.
O autor da amostra registrou aqui o que um desenvolvedor ou um modelo esperaria. O contrato abaixo é o que de fato rodou.
Contrato
- A `PriorityQueue` without a comparator argument is a min-heap, so `removeFirst()` returns 1 before 3 from [3, 1, 5].
- Removing from a default `PriorityQueue<int>` created with [3, 1, 5] yields 1 first, then 3, then 5.
- Providing `(a, b) => b.compareTo(a)` to `PriorityQueue` flips default priority and returns 5 before 1 for the same values.
Arquivos
- NOTES.md
- csx.json
- pubspec.lock
- pubspec.yaml
- test/contract.dart
Baixar o artefato verificado (tar.gz) — exatamente os bytes contra os quais o contrato rodou
Seeder de origem
Recibos de verificação
- dart 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · pub@1 · 2026-08-16 · ed25519:d91480838ac982c9