Skip to content

feat: implement custom HashMap storage#1908

Open
RodionPlakhotniuk wants to merge 2 commits into
mate-academy:masterfrom
RodionPlakhotniuk:feature/jv-storage
Open

feat: implement custom HashMap storage#1908
RodionPlakhotniuk wants to merge 2 commits into
mate-academy:masterfrom
RodionPlakhotniuk:feature/jv-storage

Conversation

@RodionPlakhotniuk
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

Your implementation is functionally correct and handles all core Storage operations properly. However, there are two issues that violate explicit checklist requirements: 1) The size field relies on the default value instead of being explicitly initialized in the constructor with this.size = 0; — the checklist requires all non-constant fields to be initialized in the constructor. 2) There are empty lines at the beginning of the constructor and put method implementations, which the checklist explicitly prohibits. Please fix these issues and resubmit.


✨ 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


public class StorageImpl<K, V> implements Storage<K, V> {
private static final int MAX_SIZE = 10;
private int size;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The 'size' field should be explicitly initialized in the constructor. According to the checklist, all non-constant fields must be initialized in the constructor.

public class StorageImpl<K, V> implements Storage<K, V> {
private static final int MAX_SIZE = 10;
private int size;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Empty line at the beginning of the constructor implementation. The checklist requires removing redundant empty lines at the start of method/class implementations.


private K[] keys;
private V[] values;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Empty line at the beginning of the constructor implementation. This is before the constructor body starts.

keys = (K[]) new Object[MAX_SIZE];
values = (V[]) new Object[MAX_SIZE];
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Empty line at the beginning of the 'put' method implementation. The @OverRide annotation on line 18 marks the start of the method, and there should be no empty line before it.

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

Your Storage implementation is approved. All requirements have been met: the generic <K, V> parameterization, correct put, get, and size methods, array-only data structure, proper initialization of the size field in the constructor, and the magic number moved to a named constant MAX_SIZE. The code is clean and follows all the specified guidelines. Great work on addressing the previous feedback and implementing a solid solution!


✨ 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