diff --git a/src/DotRecast.Core/Collections/RcSortedQueue.cs b/src/DotRecast.Core/Collections/RcSortedQueue.cs index f5c817e..0fe502d 100644 --- a/src/DotRecast.Core/Collections/RcSortedQueue.cs +++ b/src/DotRecast.Core/Collections/RcSortedQueue.cs @@ -25,29 +25,14 @@ namespace DotRecast.Core.Collections { public class RcSortedQueue { - private sealed class ReverseComparer : IComparer - { - private readonly Comparison _comparison; - - public ReverseComparer(Comparison comparison) - { - _comparison = comparison; - } - - public int Compare(T x, T y) - { - return _comparison(x, y) * -1; - } - } - private bool _dirty; private readonly List _items; - private readonly IComparer _comparer; + private readonly Comparison _comparison; public RcSortedQueue(Comparison comp) { _items = new List(); - _comparer = new ReverseComparer(comp); + _comparison = (x, y) => comp(x, y) * -1; } public int Count() @@ -70,7 +55,7 @@ namespace DotRecast.Core.Collections { if (_dirty) { - _items.Sort(_comparer); // reverse + _items.Sort(_comparison); // reverse _dirty = false; } }