Welcome back.
And this week, we are going to look at aerialists and we're going to use the radius quite a bit in
our future project, so it's important to see how they are used and understand them.
So they are used to create dynamic arrays and arrays are types of collections.
So we are going to use collections here.
So why should you use an array lists?
Well, realists are used to create a dynamic array, which means the size of an array list can be increased
or decreased according to your requirements.
So it's not limited to a specific size, which is pretty cool.
Their latest class provides both read and bright functionality.
Then the list follows the sequence of insertion order.
So it matters when you put something in there and an rest is not synchronized and it may contain duplicate
elements.
So it's not going to be limited to one entry of the same thing, so to speak.
The constructor of an array list looks like this.
So either this used to create an empty apparatus.
So that's the basic constructor.
Then you have another constructor where you can actually pass in the capacity.
So you can say what the maximum amount of elements that can fit into this are rightest should be.
And then you can create and the rate is based on a collection.
So you can fill it with the elements of a collection and use it then as you need it.
Examples of functions.
Authorities are, for example, the ADD function used to add the specific element into the collection.
Then the clear function is used to remove all elements from a collection to get function allows you
to get an element as the specified index.
So, for example, if you want to have the fifth entry, you could enter index four in there and you
would get that.
And then the remove function is used to remove a single instance of the specific element from the current
collection if it's available and hereby say a single instance.
So let's say you have the value five multiple times in there.
Only the first five would be removed if you call this remove function with a value of five.
Then there are, of course, many more functions in their Raila's class and we're going to use multiple
of them, but these are the most important ones.
All right, let's have a look at an actual O'Reilley so you can see we create an array list and we created
via the virtual keyword.
So we're not using var here because even though the array list might be a also an immutable array list,
it's still adjustable.
So we cannot replace the array list object, but we can replace the content of this relist object.
In this case it's an object of type string, so we only can add strings in there.
For example, the array list, add one and then add two.
So I'm adding one and two to this list, meaning the written words, and then we can print this array
list by using the four in loop here.
So for Mineralised we print I and that will output one and two the register using collections.
Let's have a look at that.
We can see we have again the function main and then we create an array list.
This time we said there's a list as being limited to five entries.
So this is the one example where you can limit and the rate is to add a certain amount of values.
So here this one.
And then we have a list which is a mutable list of strings and we put values in there and then we add
all of those values to our greatest.
Then we use an array list iterator called ETR in our case, and we say as long as this iterator has
something, so as long as our array list has another entry in there, we want to run this while loop.
So we're just printing it out next.
So the next entry in our ETR, which in this case means in the array list iterator, which pretty much
means in the list itself.
And then we can also see that we can get the size of an array list by using its size property.
So that will give us the following output.
One, two.
And then of course, the size of a list is two because there are only two entries in there.
Now, let's look at the jet function so you can see we have this main function here again with so then
let's look at the jet function.
You can see again, we have a main function here using an array list of strings and then we add one
and two and then we loop through it with this loop.
But we also used to get function here in order to see what we will get.
So if I use get one, I will get two.
So this is a little confusing, but that has to do with the counting starting at zero.
So the first entry here is going to be at index zero.
The second entry will be at index one.
What we're doing here is we are accessing index one, which means we get the two and that's why the
output is to in this case.
All right, this was just a little introduction to aerialists, we are going to use them quite a bit
and then they will become natural as usual.
So no worries there.
It's like learning a new word in a foreign language.
The more contacts you see this word and the more it makes sense and the better of an understanding you
get for this word.
So see you in the next video.