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.
Loading data from text files - Java Tutorial
From the course: Data Science for Java Developers
Loading data from text files
- [Instructor] Now that we've seen how to shrink this data down to a more manageable size, The next order of business is, we're going to take a look at how to actually load this data into our Java program as well as represent it in code. So the first thing we're going to do here is we're going to create a new class in our project here. And we're going to call that class something like TextLoader. Basically this TextLoader class is going to contain some methods for helping us load data from text files. And what we're going to do inside this class is we're going to define a static method. We'll call it something like get lines. It's basically going to load all of the lines and so it will be returning a list of strings. It'll return all of the lines from whatever file path we give it. To show you what I mean, we're just going to say public static List<String> and we'll call this method, getLines and it'll take a string…
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)
-
-
-
-