This is an automated email from the ASF dual-hosted git repository. nightowl888 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit 2e8fb68a1e903dadd3b9c11d39cc9a00b46f2f1a Author: Shad Storhaug <[email protected]> AuthorDate: Mon Oct 18 03:16:44 2021 +0700 Lucene.Net.Util.ListExtensions: Added optimized path for J2N.Collections.Generic.List<T> in AddRange and Sort methods --- src/Lucene.Net/Support/Util/ListExtensions.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Lucene.Net/Support/Util/ListExtensions.cs b/src/Lucene.Net/Support/Util/ListExtensions.cs index 14b275f..786b864 100644 --- a/src/Lucene.Net/Support/Util/ListExtensions.cs +++ b/src/Lucene.Net/Support/Util/ListExtensions.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using JCG = J2N.Collections.Generic; namespace Lucene.Net.Util { @@ -42,7 +43,13 @@ namespace Lucene.Net.Util throw new ArgumentNullException(nameof(collection)); if (list is List<T> thisList) + { thisList.AddRange(collection); + } + else if (list is JCG.List<T> jcgList) + { + jcgList.AddRange(collection); + } else { foreach (var item in collection) @@ -65,6 +72,10 @@ namespace Lucene.Net.Util { listToSort.Sort(); } + else if (list is JCG.List<T> jcgListToSort) + { + jcgListToSort.Sort(); + } else { CollectionUtil.TimSort(list); @@ -85,6 +96,10 @@ namespace Lucene.Net.Util { listToSort.Sort(comparer); } + else if (list is JCG.List<T> jcgListToSort) + { + jcgListToSort.Sort(comparer); + } else { CollectionUtil.TimSort(list, comparer);
