linksplatform / Collections

LinksPlatform's Platform.Collections Class Library
https://linksplatform.github.io/Collections
The Unlicense
2 stars 7 forks source link

Fix CharSegment Equals #136

Open uselessgoddess opened 3 years ago

uselessgoddess commented 3 years ago

CharSegment has bug in Equals method https://github.com/linksplatform/Collections/blob/3643cf14cbf82df06b22df1ec7f9dd0bc5c68f8d/csharp/Platform.Collections/Segments/CharSegment.cs#L31-L46

Fix it Small example [use this sandbox and add property PublicDictionary to Walker4]:

/*
public IDictionary<CharSegment, long> PublicDictionary
{
    get => Dictionary;
}
*/

var text = "aaaaaaaaaa";
var walker = new Walker4();
walker.WalkAll(text);
foreach (var l in walker.PublicDictionary)
{
    foreach (var r in walker.PublicDictionary)
    {
        Console.WriteLine($"{l} == {r} ==> {l.Key.Equals(r.Key)}");
    }
}
uselessgoddess commented 3 years ago

Fast setup example

uselessgoddess commented 2 years ago

Lol @Konard