Skip to content

Commit

Permalink
Fix analyzer warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
lrhn committed Dec 18, 2024
1 parent 29a6c88 commit 5893380
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkgs/collection/lib/src/priority_queue.dart
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ abstract class PriorityQueue<E> {
/// an expected O(n*log(n)) time.
class HeapPriorityQueue<E> implements PriorityQueue<E> {
/// The comparison being used to compare the priority of elements.
final Comparator<E> comparison;
final int Function(E, E) comparison;

/// List implementation of a heap.
List<E> _queue;
Expand Down Expand Up @@ -212,7 +212,7 @@ class HeapPriorityQueue<E> implements PriorityQueue<E> {
/// The [comparison] is a [Comparator] used to compare the priority of
/// elements. An element that compares as less than another element has
/// a higher priority.
HeapPriorityQueue.of(Iterable<E> elements, int Function(E, E) this.comparison)
HeapPriorityQueue.of(Iterable<E> elements, this.comparison)
: _queue = elements.toList() {
_heapify();
}
Expand Down Expand Up @@ -334,7 +334,7 @@ class HeapPriorityQueue<E> implements PriorityQueue<E> {
_modificationCount++;
var result = _queue.first;
var last = _queue.removeLast();
if (_queue.length > 0) {
if (_queue.isNotEmpty) {
_bubbleDown(last, 0);
}
return result;
Expand Down Expand Up @@ -404,8 +404,6 @@ class HeapPriorityQueue<E> implements PriorityQueue<E> {
return -1;
}

E _removeLast() => _queue.removeLast();

/// Place [element] in heap at [index] or above.
///
/// Put element into the empty cell at `index`.
Expand Down

0 comments on commit 5893380

Please sign in to comment.