Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Stream Data Processing | Advanced Lambda Usage
Quizzes & Challenges
Quizzes
Challenges
/
Lambda Expressions in Java

bookChallenge: 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.

Oppgave

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

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 2. Kapittel 6
single

single

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

Suggested prompts:

Can you show me an example of how to do this using Java's Stream API?

What would the code look like for processing the salaries with these requirements?

Can you explain how the Stream API helps in this scenario?

close

bookChallenge: Stream Data Processing

Sveip for å vise menyen

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.

Oppgave

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

Switch to desktopBytt til skrivebordet for virkelighetspraksisFortsett der du er med et av alternativene nedenfor
Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 2. Kapittel 6
single

single

some-alt