aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs
diff options
context:
space:
mode:
authorAndrew Rabert <6550543+nvllsvm@users.noreply.github.com>2019-01-22 18:13:47 -0500
committerGitHub <noreply@github.com>2019-01-22 18:13:47 -0500
commit28483bdb54be96ae83e0fded097f534d7e26ba1e (patch)
treee7f4b92326417ebf55eecdf68a01d2c3b9e660d7 /MediaBrowser.Providers/Manager/SimplePriorityQueue.cs
parent920c39454c05e979eabe81877269cd4517a03ccf (diff)
parent8106c8393b711a7e1d40487e3caf2b014decbe28 (diff)
Merge pull request #651 from jellyfin/release-10.1.0
Release 10.1.0
Diffstat (limited to 'MediaBrowser.Providers/Manager/SimplePriorityQueue.cs')
-rw-r--r--MediaBrowser.Providers/Manager/SimplePriorityQueue.cs17
1 files changed, 7 insertions, 10 deletions
diff --git a/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs b/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs
index 879ae1dca..d064312cf 100644
--- a/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs
+++ b/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs
@@ -1,8 +1,6 @@
-using System;
+using System;
using System.Collections;
using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
namespace Priority_Queue
{
@@ -135,8 +133,7 @@ namespace Priority_Queue
return false;
}
- SimpleNode node;
- if (_queue.TryDequeue(out node))
+ if (_queue.TryDequeue(out SimpleNode node))
{
item = node.Data;
return true;
@@ -157,7 +154,7 @@ namespace Priority_Queue
{
lock (_queue)
{
- SimpleNode node = new SimpleNode(item);
+ var node = new SimpleNode(item);
if (_queue.Count == _queue.MaxSize)
{
_queue.Resize(_queue.MaxSize * 2 + 1);
@@ -167,9 +164,9 @@ namespace Priority_Queue
}
/// <summary>
- /// Removes an item from the queue. The item does not need to be the head of the queue.
+ /// Removes an item from the queue. The item does not need to be the head of the queue.
/// If the item is not in the queue, an exception is thrown. If unsure, check Contains() first.
- /// If multiple copies of the item are enqueued, only the first one is removed.
+ /// If multiple copies of the item are enqueued, only the first one is removed.
/// O(n)
/// </summary>
public void Remove(TItem item)
@@ -213,7 +210,7 @@ namespace Priority_Queue
public IEnumerator<TItem> GetEnumerator()
{
- List<TItem> queueData = new List<TItem>();
+ var queueData = new List<TItem>();
lock (_queue)
{
//Copy to a separate list because we don't want to 'yield return' inside a lock
@@ -247,4 +244,4 @@ namespace Priority_Queue
/// </summary>
/// <typeparam name="TItem">The type to enqueue</typeparam>
public class SimplePriorityQueue<TItem> : SimplePriorityQueue<TItem, float> { }
-} \ No newline at end of file
+}