Repository navigation
Add answer to the question about role of Comparable in HashMap - #156
Merged
Merged
Conversation
Owner
|
Лучше разделить на два PR - один, с исправлением ошибки в именовании, второй на добавление нового вопроса-ответа. |
Contributor
Author
|
Во втором моем коммите я исправил свою же ошибку, которую допустил в предыдущем коммите. (Comparator -> Comparable). Поэтому скорее всего нет смысла выносить это в отдельный PR. Если нужно, я могу склеить коммиты. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Мне этот вопрос попался на одном из собеседований. На мой взгляд, он довольно интересный и редко встречается в подборках ответов на вопросы.
Вот пост на StackOverflow с более подробным описанием: https://stackoverflow.com/questions/47921663/when-and-how-does-hashmap-convert-the-bucket-from-linked-list-to-red-black-trees.
Также в статье на JavaRush есть описание метода tieBreakOrder: https://javarush.com/groups/posts/2496-podrobnihy-razbor-klassa-hashmap.