TheAlgorithms / Java Public
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
add a check of the existance of a next node #2976
Labels
Comments
Good point, could you make a PR to fix that? |
Is this issue open? |
Seems like it is |
Is this issue still open? |
@chinmaybadhe yes, it's open |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think here we should first check if there is a next node before lost the reference on first object
https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/datastructures/hashmap/hashing/HashMap.java
/**
Linked list class - delete method with the following signature
*/
public void delete(int key) {
if (!isEmpty()) {
if (first.getKey() == key) {
first = null;
} else {
delete(first, key);
}
} else {
System.out.println("List is empty");
}
}
The text was updated successfully, but these errors were encountered: