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

jv-storage task is done #1665

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

serhii-slobodianiuk
Copy link

No description provided.

Copy link

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

Great job on implementing the StorageImpl class! 🎉 Your code meets the task requirements and constraints, effectively allowing for the storage and retrieval of key-value pairs. Here are a few points to consider for improvement:

  1. Exception Message: The current exception message in the put method could be more descriptive. Consider changing it to something like "Storage is full. Cannot add more elements." to provide clearer information to the user.

  2. Initial Capacity: The initial capacity of the table array is set to zero, which may lead to unnecessary resizing operations. It would be beneficial to initialize it with MAX_CAPACITY to optimize performance.

Overall, your solution is solid and meets the task requirements. The decision to approve this pull request is made to help you move forward with your learning journey. Please review the comments and consider addressing the issues mentioned to enhance your code. Keep up the great work and continue to learn from these experiences! 🚀

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


public class StorageImpl<K, V> implements Storage<K, V> {
private static final int MAX_CAPACITY = 10;
private CustomNode<K, V>[] table = new CustomNode[0];

Choose a reason for hiding this comment

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

The initial capacity of the table array is set to zero. Consider initializing it with MAX_CAPACITY to avoid unnecessary resizing operations when adding elements.

}
putValue(inputNode);
} else {
throw new RuntimeException("The array already full");

Choose a reason for hiding this comment

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

The exception message could be more descriptive. Consider changing it to something like "Storage is full. Cannot add more elements." to provide clearer information to the user.

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