Challenge: Stream Data Processing
Imagine you are managing payroll for a company and need to process a list of employee salaries. Your goal is to identify all employees earning above a certain threshold, give those employees a 10% raise, and then calculate the total cost of these increased salaries. Using Java's Stream API and lambda expressions can make this task concise and expressive, allowing you to filter, transform, and aggregate data efficiently in a single pipeline.
Swipe to start coding
Process a list of employee salaries to identify those above a specific threshold, increase them by 10%, and return the total sum of the increased salaries.
- Filter the input list to include only salaries greater than 3000.
- Increase each filtered salary by 10%.
- Sum all the increased salaries.
- Return the total as an integer.
Løsning
Tak for dine kommentarer!
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Fantastisk!
Completion rate forbedret til 5.56
Challenge: Stream Data Processing
Stryg for at vise menuen
Imagine you are managing payroll for a company and need to process a list of employee salaries. Your goal is to identify all employees earning above a certain threshold, give those employees a 10% raise, and then calculate the total cost of these increased salaries. Using Java's Stream API and lambda expressions can make this task concise and expressive, allowing you to filter, transform, and aggregate data efficiently in a single pipeline.
Swipe to start coding
Process a list of employee salaries to identify those above a specific threshold, increase them by 10%, and return the total sum of the increased salaries.
- Filter the input list to include only salaries greater than 3000.
- Increase each filtered salary by 10%.
- Sum all the increased salaries.
- Return the total as an integer.
Løsning
Tak for dine kommentarer!
single