-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
base: master
Are you sure you want to change the base?
jv-storage task is done #1665
Conversation
There was a problem hiding this 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:
-
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. -
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 withMAX_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]; |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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.
No description provided.