TKey can not be null.
This commit is contained in:
parent
dc98fb51b1
commit
e53d1086cc
@ -16,9 +16,9 @@ public class RPriorityQueue<TKey, TPriority> where TKey : notnull
|
|||||||
queue[key] = priority;
|
queue[key] = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TKey? Dequeue()
|
public TKey Dequeue()
|
||||||
{
|
{
|
||||||
TKey? retKey = queue.MinBy(item => item.Value).Key;
|
TKey retKey = queue.MinBy(item => item.Value).Key;
|
||||||
queue.Remove(retKey);
|
queue.Remove(retKey);
|
||||||
return retKey;
|
return retKey;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user