Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

JakeHP
Copy link
Collaborator

@JakeHP JakeHP commented Jul 13, 2015

Creating a PR for this so you can check it out @mgechev before we bring it in. I started off with #68 as a base, and did quite a bit of modification.

I'm going to add documentation also before we merge it in.

The main thing to note is an added optional (not to be used by anything other than test/spec) parameter, hashCode, to get(), put(), remove(). This is used to simulate collisions. I did this since finding keys that are different, but generate the same hash, using the javascript implementation of java's 32bitint hash function (that I brought over from #68) would have been a pain.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use val !== undefined && val !== null && typeof val.valueOf() === 'number' here, otherwise I'd cast val to string using '' + val, which should work in case val is undefined or null.

@mgechev
Copy link
Owner

mgechev commented Jul 13, 2015

Looks awesome, great job!

I'll merge it the way it is. If you agree about the note above you can push the change in master, if you think it might create any issues we can discuss them here.

mgechev added a commit that referenced this pull request Jul 13, 2015
Implemented Hash table and spec.
@mgechev mgechev merged commit 721cb40 into mgechev:master Jul 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants