Skip to content

Commit

Permalink
Inline and simplify Contains implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
dougmill committed Jun 11, 2017
1 parent 99a695b commit 91bc7c1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Priority Queue/SimplePriorityQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ public bool Contains(TItem item)
{
lock(_queue)
{
return GetExistingNode(item) != null;
if (item == null)
{
return _nullNodesCache.Count > 0;
}
return _itemToNodesCache.ContainsKey(item);
}
}

Expand Down

0 comments on commit 91bc7c1

Please sign in to comment.