Implement LinkedMap class
PR Feedback (click)
- [ ] 👍 Sweep Did Well
- [ ] 👎 Sweep Needs Improvement
Description
This PR implements a new class called LinkedMap that provides a map-like data structure with a set of keys and a list of values that are linked. The class adheres to the limitations of an Apex defined type.
Summary of Changes
- Created a new class
LinkedMap.clsin theforce-app/main/default/classes/directory. - Added a private variable
linkedMapof typeMap<Set<String>, List<Object>>to store the key-value pairs. - Implemented methods
put,get,remove,containsKey,keySet, andvaluesin theLinkedMap.clsclass to provide functionality for adding, retrieving, removing, checking, and retrieving all keys and values in the map. - Created a new test class
LinkedMapTests.clsin theforce-app/main/default/classes/directory to cover all methods in theLinkedMap.clsclass with comprehensive test cases.
Please review and merge this PR to incorporate the new LinkedMap class into the repository.
Fixes #123.
🎉 Latest improvements to Sweep:
- Sweep can now passively improve your repository! Check out Rules to learn more.
💡 To get Sweep to edit this pull request, you can:
- Comment below, and Sweep can edit the entire PR
- Comment on a file, Sweep will only modify the commented file
- Edit the original issue to get Sweep to recreate the PR from scratch
Summary by CodeRabbit
- New Feature: Introduced a
LinkedMapclass that provides a map-like data structure with linked keys and values. This feature enhances data handling by allowing users to add, retrieve, remove, and check elements in the map more efficiently. - Test: Added
LinkedMapTestsclass to ensure the robustness of the newLinkedMapclass. The tests cover all key functionalities including adding, retrieving, removing, and checking elements in the map.
Rollback Files For Sweep
- [ ] Rollback changes to force-app/main/default/classes/LinkedMapTests.cls
- [ ] Rollback changes to force-app/main/default/classes/LinkedMap.cls
Apply Sweep Rules to your PR?
- [ ] Apply: Leftover TODOs in the code should be handled.
- [ ] Apply: All new business logic should have corresponding unit tests in the tests/ directory.
- [ ] Apply: Any clearly inefficient or repeated code should be optimized or refactored.
CodeRabbit
Walkthrough
This changeset introduces a new class LinkedMap that mimics the behavior of a map with linked keys and values. It provides methods for adding, retrieving, removing, and checking elements in the map. To ensure the functionality of these methods, a test class LinkedMapTests is also introduced with comprehensive test cases.
Changes
| File | Summary |
|---|---|
| force-app/main/default/classes/LinkedMap.cls | Introduces a new class LinkedMap implementing a map-like data structure with linked keys and values. Includes methods for adding, retrieving, removing, checking, and retrieving all keys and values in the map. |
| force-app/main/default/classes/LinkedMapTests.cls | Adds a test class LinkedMapTests to cover the methods in LinkedMap with comprehensive test cases. The test cases verify the functionality of the put, get, remove, containsKey, keySet, and values methods. |
🐇💻
In the land of code, where logic intertwines,
A LinkedMap was born, linking keys and lines.
With tests by its side, it stands tall and bright,
Ensuring each function performs just right.
So let's celebrate this change, for it's no small feat,
In the world of software, it's quite an elite! 🎉🥳
Uplevel your code reviews with CodeRabbit Pro
CodeRabbit Pro
If you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.