diff --git a/src/client/spark/core/Utility/ReverseComparer.cs b/src/client/spark/core/Utility/ReverseComparer.cs deleted file mode 100644 index 2618ae1ed..000000000 --- a/src/client/spark/core/Utility/ReverseComparer.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace mbts.utils { - public class ReverseComparer : IComparer { - private readonly IComparer _wrapped; - - public ReverseComparer(IComparer wrapped) { - _wrapped = wrapped; - } - - public int Compare(T x, T y) { - // reverse operands - return _wrapped.Compare(y, x); - } - } -} diff --git a/src/client/spark_core/utils/CompareUtils.cs b/src/client/spark_core/utils/CompareUtils.cs index a3b48c755..78df67360 100644 --- a/src/client/spark_core/utils/CompareUtils.cs +++ b/src/client/spark_core/utils/CompareUtils.cs @@ -42,7 +42,7 @@ namespace bts.utils { Comparer.Create(nullable_comparison(comparer.Compare)); public static IComparer reverse(this IComparer comparer) => - Comparer.Create((a, b) => comparer.Compare(b, a)); + new ReverseComparer(comparer); class NonGenericComparerWrapper : IComparer { readonly IComparer _comparer; diff --git a/src/client/spark_core/utils/ReverseComparer.cs b/src/client/spark_core/utils/ReverseComparer.cs new file mode 100644 index 000000000..a4fcae1f5 --- /dev/null +++ b/src/client/spark_core/utils/ReverseComparer.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace bts.utils { + public class ReverseComparer : IComparer { + public static readonly IComparer Default = + new ReverseComparer(Comparer.Default); + + readonly IComparer _wrapped; + + public ReverseComparer(IComparer wrapped) => + _wrapped = wrapped; + + public int Compare(T x, T y) => + // reverse operands + _wrapped.Compare(y, x); + } +} \ No newline at end of file