Skip to content

hw for src/main/java/core/basesyntax/MyHashMap.java#1653

Open
egorkharaim wants to merge 2 commits intomate-academy:masterfrom
egorkharaim:HW-for-JV-HASH-MAP
Open

hw for src/main/java/core/basesyntax/MyHashMap.java#1653
egorkharaim wants to merge 2 commits intomate-academy:masterfrom
egorkharaim:HW-for-JV-HASH-MAP

Conversation

@egorkharaim
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Good job on implementing the core functionality of the HashMap. The logic for handling collisions and resizing is correct. However, this submission requires changes because it violates two explicit checklist items.

  1. Remove Getters and Setters in Node: The Node class should not contain getters and setters. The outer MyHashMap class can access the private fields of its inner class directly, so you should use direct field access (e.g., currentNode.key) instead. [CHECKLIST ITEM #3]
  2. Inner Class Placement: The private inner Node class must be moved to the end of the MyHashMap class, after all public and private methods, to comply with the style guide. [CHECKLIST ITEM #5]

Please address these points to meet the task requirements.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

threshold = (int) (DEFAULT_CAPACITY * LOAD_FACTOR);
}

private static class Node<K, V> {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This violates checklist item #5: 'Private methods and classes should be after public ones in your class.' The inner Node class should be moved to the end of the MyHashMap class, after all public and private methods.

Comment on lines +29 to +47
public K getKey() {
return key;
}

public V getValue() {
return value;
}

public void setValue(V value) {
this.value = value;
}

public Node<K, V> getNext() {
return next;
}

public void setNext(Node<K, V> next) {
this.next = next;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This violates checklist item #3: 'Don't use getters and setters in class Node'. The outer MyHashMap class can access the private fields of its inner Node class directly. You should remove all these getter and setter methods and use direct field access (e.g., currentNode.key, currentNode.value = newValue) in your put, getValue, and resize methods.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Excellent work on this iteration! You've successfully addressed all the feedback from the previous review, and the result is a clean and compliant solution. Your MyHashMap implementation is solid, correctly handling collisions and resizing. It's great to see that the inner Node class is now implemented without getters and setters and is correctly placed at the end of the class. Your solution now meets all the requirements, so I am approving it. Keep up the great work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

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