From the course: Data Science for Java Developers
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
Solution: Manipulating data - Java Tutorial
From the course: Data Science for Java Developers
Solution: Manipulating data
(soft music) - [Instructor] Okay, so I'm going to walk you through how I went about solving this problem. As I mentioned in the challenge video. the first thing that I did was get a list of all of the unique memberNumbers and the way that I did that, looks something like this. I started off by saying List<String> allMemberNumbers equals and then I said, groceries.stream and then I used map to map each grocery record to its memberNumber. So I said, grocery.memberNumber. And finally I said .collect and then collectors.toSet because sets in JavaScript ignore duplicates. So that's very useful for helping us remove the duplicate memberNumbers in our data set. Now, since this is a set, what we had to do then since we want it to be a list format as you'll see later on is we had to say new array list and convert this set into an array list. So now that we have a list of all of our memberNumbers the next thing I did is…
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.
Contents
-
-
-
-
-
-
(Locked)
Reducing file size5m 20s
-
(Locked)
Loading data from text files3m 29s
-
(Locked)
Creating a person data class3m 56s
-
(Locked)
Converting strings to data objects5m 39s
-
(Locked)
Loading tab-separated files9m 20s
-
(Locked)
Loading CSVs5m 21s
-
(Locked)
Converting CSVs to data objects7m 4s
-
(Locked)
Challenge: Manipulating data2m 1s
-
(Locked)
Solution: Manipulating data3m 37s
-
(Locked)
-
-
-
-