Revert "Lucene.Net.Core.Util.Fst.PairOutputs: If the generic type is a reference type, we use Collections.Equals() and Collections.GetHashCode() so its values are compared if it happens to be a collection"
This reverts commit d48493df8ffd9afded38a4ee4660289270cc2679. Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/6c9a3c6b Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/6c9a3c6b Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/6c9a3c6b Branch: refs/heads/api-work Commit: 6c9a3c6b0ecc045bb2881e0b3c68492200d028bd Parents: d0c2c10 Author: Shad Storhaug <[email protected]> Authored: Thu Mar 30 13:04:58 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Thu Mar 30 13:04:58 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net.Core/Util/Fst/PairOutputs.cs | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6c9a3c6b/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs b/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs index c308940..7ba14ac 100644 --- a/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs +++ b/src/Lucene.Net.Core/Util/Fst/PairOutputs.cs @@ -40,21 +40,11 @@ namespace Lucene.Net.Util.Fst public A Output1 { get; private set; } public B Output2 { get; private set; } - // LUCENENET specific - track whether we have value or reference types - // for optimization of Equals and GetHashCode() - private readonly bool output1IsValueType; - private readonly bool output2IsValueType; - // use newPair internal Pair(A output1, B output2) { this.Output1 = output1; this.Output2 = output2; - - // LUCENENET specific - track whether we have value or reference types - // for optimization of Equals and GetHashCode() - this.output1IsValueType = typeof(A).IsValueType; - this.output2IsValueType = typeof(B).IsValueType; } public override bool Equals(object other) @@ -66,11 +56,7 @@ namespace Lucene.Net.Util.Fst else if (other is Pair) { var pair = (Pair)other; - - // LUCENENET specific - if we have reference types, they might be collections that need to be compared - // as sets of values. - return output1IsValueType ? Output1.Equals(pair.Output1) : Collections.Equals(Output1, pair.Output1) - && output2IsValueType ? Output2.Equals(pair.Output2) : Collections.Equals(Output2, pair.Output2); + return Output1.Equals(pair.Output1) && Output2.Equals(pair.Output2); } else { @@ -80,10 +66,7 @@ namespace Lucene.Net.Util.Fst public override int GetHashCode() { - // LUCENENET specific - if we have reference types, they might be collections that need to be compared - // as sets of values. - return (output1IsValueType ? Output1.GetHashCode() : Collections.GetHashCode(Output1)) - + (output2IsValueType ? Output2.GetHashCode() : Collections.GetHashCode(Output2)); + return Output1.GetHashCode() + Output2.GetHashCode(); } }
