Lucene.Net.Queries.Function.ValueSources.MultiFunction: Use Equatable.Wrap() to wrap the provided list in EquatableList for Equals() and GetHashCode() comparisons
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/1c751a25 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/1c751a25 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/1c751a25 Branch: refs/heads/api-work Commit: 1c751a2506dc50fc35df05366a47e22bcef42748 Parents: ebfca98 Author: Shad Storhaug <[email protected]> Authored: Thu Mar 30 08:40:24 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Thu Mar 30 09:12:51 2017 +0700 ---------------------------------------------------------------------- .../Function/ValueSources/MultiFunction.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1c751a25/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs b/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs index 23d909a..55cd79c 100644 --- a/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs +++ b/src/Lucene.Net.Queries/Function/ValueSources/MultiFunction.cs @@ -1,5 +1,6 @@ using Lucene.Net.Index; using Lucene.Net.Search; +using Lucene.Net.Support; using System.Collections; using System.Collections.Generic; using System.Text; @@ -125,7 +126,9 @@ namespace Lucene.Net.Queries.Function.ValueSources public override int GetHashCode() { - return m_sources.GetHashCode() + Name.GetHashCode(); + // LUCENENET specific: ensure our passed in list is equatable by + // wrapping it in an EquatableList if it is not one already + return Equatable.Wrap(m_sources).GetHashCode() + Name.GetHashCode(); } public override bool Equals(object o) @@ -135,7 +138,10 @@ namespace Lucene.Net.Queries.Function.ValueSources return false; } var other = (MultiFunction)o; - return this.m_sources.Equals(other.m_sources); + + // LUCENENET specific: ensure our passed in list is equatable by + // wrapping it in an EquatableList if it is not one already + return Equatable.Wrap(this.m_sources).Equals(other.m_sources); } } } \ No newline at end of file
