From the course: Data Science for Java Developers
Unlock this course with a free trial
Join today to access over 22,500 courses taught by industry experts.
Solution: Combining data operations - Java Tutorial
From the course: Data Science for Java Developers
Solution: Combining data operations
(upbeat music) - [Instructor] Okay, so what I'm going to do here is walk you through how I went about solving this challenge. The first thing I did is I said list strings, since we're going to get a list of the names, and we'll say employee names as the name of the list there. And then we're going to say employees dot stream. And the first thing we're going to do is filter out everybody who's over 30 using the filter function. All right, so we're going to say dot filter. And for that, we're going to say employee. And we'll say employee dot age is greater than 30. And now that we have all of the employees whose age is over 30, the next thing we're going to do is sort them by their salary. So we're going to say dot sorted, and we're going to say employee one, employee two. And then employee one dot salary dot compare to employee two dot salary. And now that we have a list of our employees over 30 sorted by their salary…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.