-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring of TestReportHandler and TreePrinter for Improved Code Qu…
…ality and performance optimization (#57) * Refactoring TestReportHandler.java This commit refactors the TestReportHandler class to enhance its concurrency handling and simplify its code structure. These changes do not introduce any new functionality but focus on improving the overall performance, readability, and maintainability of the code. Key Changes: Concurrent Collection Usage: Replaced synchronizedMap(new HashMap<>()) with ConcurrentHashMap for classNames, classEntries, and testEntries. Why: ConcurrentHashMap is more efficient for concurrent operations, reducing the potential for thread contention and improving performance in multi-threaded environments. Streamlined Collection Initialization: Simplified the initialization and population of the classEntries map using computeIfAbsent and direct add() method instead of the previous computeIfPresent. Why: This reduces the complexity of the code, making it more straightforward and easier to maintain. Optimized String Handling: Refactored the hasNestedTests(ReportEntry reportEntry) method to use anyMatch instead of filter followed by count. Why: anyMatch is more efficient for this use case as it short-circuits when a match is found, improving the method’s performance and readability. General Code Cleanup: Adjusted import statements and fixed minor formatting issues, such as spacing and line breaks, to adhere to coding standards. * Small refactoring in the TreePrinter class
- Loading branch information
1 parent
6839304
commit dbab2d4
Showing
2 changed files
with
41 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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