All right, my friends, we've got our CSV file reader all put together in a very reusable state.
So now the last thing we have to do is implement our load method on match reader.
The load method is going to load up our information through the CSV file reader and then do the actual
conversion process.
So let's get to it.
Back inside of my code editor, I'm going to find my match readers file right underneath the constructor.
I'm going to define a new function called load.
This is not going to take any arguments and it's not going to return any values either.
So inside of here, we're going to take a look at the reader that we were provided.
Remember, the entire idea here is that reader can be maybe the CSV file reader or an API reader or
some other source of information.
So whatever reader we were given, we're going to call this dot reader, dot read.
So that's essentially the entire loading process that's going to tell the CSV file reader to go get
the CSV file, parse all the information inside of it, and produce that two dimensional array of strings.
So after we call read, we can then take a look at this dot reader data, which again is the two dimensional
array of strings.
And we'll do the actual transformation process where we take those two D strings and we turn them into
all the appropriate values, like the date and the numbers and the match result and so on.
So to do that step, we can uncomment the dot map statement we saved, cut it and paste it onto this
dot reader data.
Okay.
So just like before, we're looking at the two dimensional array of strings, we're going to map over
it and produce a new array for every element inside.
The new array is going to be a match data tuple.
Now, one last thing here.
Remember, a mapping function doesn't mutate the underlying array.
Instead, it gives us a new array back.
So this entire statement is going to give us a new array that we have to save somewhere.
So let's save it as a property of the class.
To do so, we need to first define a new property on the class itself.
So I'm going to say that this is going to have some property like matches.
It's going to be an array of match data tuples, and I'm going to initialize it to be an empty array.
So then after we do that mapping operation, I'll assign all that transform data to this dot matches
like so.
And that's pretty much it.
Okay.
So that's all we have to do here.
So now the last thing we have to do is update our indexed file to make use of match reader and CSV file
reader.
So let's take a quick pause and then update the indexed file in the next video.