Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In java 8 please. Thank You. Task 4 The system you work with on a daily basis runs multiple microservices. You have been asked to
In java 8 please. Thank You.
Task 4 The system you work with on a daily basis runs multiple microservices. You have been asked to prepare an aggregation that represents the number of user visits to all microservices, for use by data analysts. The architect you're working with has already designed the API, which consists of a single class: Visitcounter. Visitcounter has a single method, count. It returns Map - this map should contain the number of visits by the user with a given ID. This method accepts an array of Map. Every map represents the total number of visits per user to a given microservice. There are some problems, however: - The map key, which is a string, should be parseable to Long - but it may not be. You must skip any such faulty entries. (O) ) - For some keys, UserStats may be nu11. You must skip any such faulty entries. (O) - Userstats has a single field, visitCount, of type optional. A getter for this field is also implemented. This field will never be nu1l; however, it might be empty. You must skip any such faulty entries. (0) Remember that you may receive some invalid input: nu11, empty maps, and so on. Handle it all appropriately and return an empty map. You may use Java 8 Streams API to implement your solutionStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started