Skip to content

Commit 5893380

Browse files
committed
Fix analyzer warnings.
1 parent 29a6c88 commit 5893380

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

pkgs/collection/lib/src/priority_queue.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ abstract class PriorityQueue<E> {
183183
/// an expected O(n*log(n)) time.
184184
class HeapPriorityQueue<E> implements PriorityQueue<E> {
185185
/// The comparison being used to compare the priority of elements.
186-
final Comparator<E> comparison;
186+
final int Function(E, E) comparison;
187187

188188
/// List implementation of a heap.
189189
List<E> _queue;
@@ -212,7 +212,7 @@ class HeapPriorityQueue<E> implements PriorityQueue<E> {
212212
/// The [comparison] is a [Comparator] used to compare the priority of
213213
/// elements. An element that compares as less than another element has
214214
/// a higher priority.
215-
HeapPriorityQueue.of(Iterable<E> elements, int Function(E, E) this.comparison)
215+
HeapPriorityQueue.of(Iterable<E> elements, this.comparison)
216216
: _queue = elements.toList() {
217217
_heapify();
218218
}
@@ -334,7 +334,7 @@ class HeapPriorityQueue<E> implements PriorityQueue<E> {
334334
_modificationCount++;
335335
var result = _queue.first;
336336
var last = _queue.removeLast();
337-
if (_queue.length > 0) {
337+
if (_queue.isNotEmpty) {
338338
_bubbleDown(last, 0);
339339
}
340340
return result;
@@ -404,8 +404,6 @@ class HeapPriorityQueue<E> implements PriorityQueue<E> {
404404
return -1;
405405
}
406406

407-
E _removeLast() => _queue.removeLast();
408-
409407
/// Place [element] in heap at [index] or above.
410408
///
411409
/// Put element into the empty cell at `index`.

0 commit comments

Comments
 (0)