Lucene.Net.Core.Support.ListExtensions + Lucene.Net.Core.Util.CollectionUtil: Changed implementation of Swap() to return void, since the swap is in place anyway (which makes it confusing)
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/6213bd04 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/6213bd04 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/6213bd04 Branch: refs/heads/api-work Commit: 6213bd042cec4a5e26cc6985711b6570feefa0ce Parents: d98c1a7 Author: Shad Storhaug <[email protected]> Authored: Thu Mar 2 00:54:34 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Thu Mar 2 08:09:00 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net.Core/Support/ListExtensions.cs | 3 +-- src/Lucene.Net.Core/Util/CollectionUtil.cs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6213bd04/src/Lucene.Net.Core/Support/ListExtensions.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Support/ListExtensions.cs b/src/Lucene.Net.Core/Support/ListExtensions.cs index d103ed0..7f0eddc 100644 --- a/src/Lucene.Net.Core/Support/ListExtensions.cs +++ b/src/Lucene.Net.Core/Support/ListExtensions.cs @@ -33,12 +33,11 @@ namespace Lucene.Net.Support return new SubList<T>(list, fromIndex, toIndex); } - public static IList<T> Swap<T>(this IList<T> list, int indexA, int indexB) // LUCENENET TODO: The swap is in-place. Returning the list makes this confusing. + public static void Swap<T>(this IList<T> list, int indexA, int indexB) { T tmp = list[indexA]; list[indexA] = list[indexB]; list[indexB] = tmp; - return list; } /// <summary> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6213bd04/src/Lucene.Net.Core/Util/CollectionUtil.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/CollectionUtil.cs b/src/Lucene.Net.Core/Util/CollectionUtil.cs index 7f8cf95..d952d54 100644 --- a/src/Lucene.Net.Core/Util/CollectionUtil.cs +++ b/src/Lucene.Net.Core/Util/CollectionUtil.cs @@ -61,7 +61,7 @@ namespace Lucene.Net.Util protected override void Swap(int i, int j) { - list = list.Swap(i, j); // LUCENENET TODO: Could be more efficient + list.Swap(i, j); } protected override int Compare(int i, int j) @@ -103,7 +103,7 @@ namespace Lucene.Net.Util protected override void Swap(int i, int j) { - list = list.Swap(i, j); // LUCENENET TODO: Could be more efficient + list.Swap(i, j); } protected override void Copy(int src, int dest)
