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

[Java] Book update #66

Open
ruiixu23 opened this issue Dec 19, 2017 · 0 comments
Open

[Java] Book update #66

ruiixu23 opened this issue Dec 19, 2017 · 0 comments

Comments

@ruiixu23
Copy link
Contributor

In Section 1.2.3 of the book. The dictionary/map was compared to the USet interface. One subtle issue here that we won't be able to update the dictionary/map using the add(x) method of USet, since 1) according to the text, two pairs are treated as equal if their keys are equal and 2) the USet add(x) interface states that the element x will be added to the set if not already present.

To create a dictionary/map, one forms compound objects called Pairs, each of which contains a key and a value. Two Pairs are treated as equal if their keys are equal. If we store some pair (k,v) in a USet and then later call the find(x) method using the pair x = (k, null) the result will be y = (k, v). In other words, it is possible to recover the value, v, given only the key, k.

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

No branches or pull requests

1 participant