Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hash and Equality #31

Open
xaviergonz opened this issue Apr 7, 2018 · 1 comment
Open

Hash and Equality #31

xaviergonz opened this issue Apr 7, 2018 · 1 comment

Comments

@xaviergonz
Copy link

To properly create a dictionary/set etc two things are needed in .net

getHashcode method to get the hash of the object to know in which bucket it must be placed
an equals method to know which object to pick up on the bucket if the hash collides

I don't see any implementation of those in the collections, how are they handled by this library?

@isc30
Copy link
Owner

isc30 commented Apr 7, 2018

Hi, the library uses comparers for this. You can let the library use the ones provided by me (tested with all native JS types) or provide your own.

There are multiple overloads using them: https://github.com/isc30/linq-collections/blob/master/src/Enumerables.ts#L106

In case you need to use comparers on a method that doesn't accept them, I will gladly accept a PR (this should be 4-5 lines change at most) or you can request it and I'll add it on my spare time.

Thanks for the feedback 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants