Add thread-safe ConcurrentHashMap implementation with coverage tests#7287
Draft
PritiAryal wants to merge 1 commit intoTheAlgorithms:masterfrom
Draft
Add thread-safe ConcurrentHashMap implementation with coverage tests#7287PritiAryal wants to merge 1 commit intoTheAlgorithms:masterfrom
PritiAryal wants to merge 1 commit intoTheAlgorithms:masterfrom
Conversation
- Implemented `ConcurrentHashMap` using separate chaining with linked lists for collision handling. - Ensured thread safety with bucket-level locking using `ReentrantLock`. - Added methods: `put`, `get`, `remove`, and `containsKey`. - Supported `null` keys and values. - Added unit tests in `ConcurrentHashMapTest`: - Verified basic operations, null key handling, and edge cases. - Simulated concurrent access with multiple threads.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7287 +/- ##
============================================
- Coverage 79.38% 79.37% -0.01%
- Complexity 7020 7026 +6
============================================
Files 785 786 +1
Lines 23019 23081 +62
Branches 4523 4534 +11
============================================
+ Hits 18273 18320 +47
- Misses 4019 4027 +8
- Partials 727 734 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ConcurrentHashMapusing separate chaining with linked lists for collision handling.ReentrantLock.put,get,remove, andcontainsKey.nullkeys and values.ConcurrentHashMapTest: