1
00:00:01,440 --> 00:00:02,070
Welcome back.

2
00:00:02,220 --> 00:00:06,689
And this week, we are going to look at aerialists and we're going to use the radius quite a bit in

3
00:00:06,689 --> 00:00:11,790
our future project, so it's important to see how they are used and understand them.

4
00:00:12,030 --> 00:00:17,330
So they are used to create dynamic arrays and arrays are types of collections.

5
00:00:17,340 --> 00:00:19,370
So we are going to use collections here.

6
00:00:19,920 --> 00:00:21,370
So why should you use an array lists?

7
00:00:21,720 --> 00:00:28,020
Well, realists are used to create a dynamic array, which means the size of an array list can be increased

8
00:00:28,020 --> 00:00:30,200
or decreased according to your requirements.

9
00:00:30,480 --> 00:00:33,540
So it's not limited to a specific size, which is pretty cool.

10
00:00:33,990 --> 00:00:37,580
Their latest class provides both read and bright functionality.

11
00:00:38,550 --> 00:00:42,800
Then the list follows the sequence of insertion order.

12
00:00:42,810 --> 00:00:49,860
So it matters when you put something in there and an rest is not synchronized and it may contain duplicate

13
00:00:49,860 --> 00:00:50,490
elements.

14
00:00:50,740 --> 00:00:56,850
So it's not going to be limited to one entry of the same thing, so to speak.

15
00:00:58,170 --> 00:01:00,340
The constructor of an array list looks like this.

16
00:01:00,360 --> 00:01:03,680
So either this used to create an empty apparatus.

17
00:01:03,690 --> 00:01:06,090
So that's the basic constructor.

18
00:01:06,090 --> 00:01:09,660
Then you have another constructor where you can actually pass in the capacity.

19
00:01:09,660 --> 00:01:17,670
So you can say what the maximum amount of elements that can fit into this are rightest should be.

20
00:01:18,090 --> 00:01:21,360
And then you can create and the rate is based on a collection.

21
00:01:21,360 --> 00:01:27,450
So you can fill it with the elements of a collection and use it then as you need it.

22
00:01:28,200 --> 00:01:29,430
Examples of functions.

23
00:01:29,430 --> 00:01:35,000
Authorities are, for example, the ADD function used to add the specific element into the collection.

24
00:01:35,760 --> 00:01:42,060
Then the clear function is used to remove all elements from a collection to get function allows you

25
00:01:42,060 --> 00:01:45,440
to get an element as the specified index.

26
00:01:45,450 --> 00:01:51,060
So, for example, if you want to have the fifth entry, you could enter index four in there and you

27
00:01:51,060 --> 00:01:51,630
would get that.

28
00:01:52,230 --> 00:01:59,670
And then the remove function is used to remove a single instance of the specific element from the current

29
00:01:59,670 --> 00:02:04,200
collection if it's available and hereby say a single instance.

30
00:02:04,230 --> 00:02:08,220
So let's say you have the value five multiple times in there.

31
00:02:08,460 --> 00:02:14,040
Only the first five would be removed if you call this remove function with a value of five.

32
00:02:15,190 --> 00:02:20,110
Then there are, of course, many more functions in their Raila's class and we're going to use multiple

33
00:02:20,110 --> 00:02:23,200
of them, but these are the most important ones.

34
00:02:23,770 --> 00:02:28,990
All right, let's have a look at an actual O'Reilley so you can see we create an array list and we created

35
00:02:28,990 --> 00:02:30,870
via the virtual keyword.

36
00:02:30,880 --> 00:02:37,660
So we're not using var here because even though the array list might be a also an immutable array list,

37
00:02:37,930 --> 00:02:39,340
it's still adjustable.

38
00:02:39,520 --> 00:02:46,540
So we cannot replace the array list object, but we can replace the content of this relist object.

39
00:02:46,780 --> 00:02:51,280
In this case it's an object of type string, so we only can add strings in there.

40
00:02:51,520 --> 00:02:55,060
For example, the array list, add one and then add two.

41
00:02:55,370 --> 00:03:04,660
So I'm adding one and two to this list, meaning the written words, and then we can print this array

42
00:03:04,660 --> 00:03:07,640
list by using the four in loop here.

43
00:03:07,660 --> 00:03:16,750
So for Mineralised we print I and that will output one and two the register using collections.

44
00:03:16,780 --> 00:03:17,710
Let's have a look at that.

45
00:03:17,790 --> 00:03:21,730
We can see we have again the function main and then we create an array list.

46
00:03:21,730 --> 00:03:27,070
This time we said there's a list as being limited to five entries.

47
00:03:27,070 --> 00:03:34,310
So this is the one example where you can limit and the rate is to add a certain amount of values.

48
00:03:34,330 --> 00:03:35,470
So here this one.

49
00:03:36,040 --> 00:03:44,320
And then we have a list which is a mutable list of strings and we put values in there and then we add

50
00:03:44,320 --> 00:03:46,870
all of those values to our greatest.

51
00:03:48,630 --> 00:03:57,810
Then we use an array list iterator called ETR in our case, and we say as long as this iterator has

52
00:03:57,810 --> 00:04:03,680
something, so as long as our array list has another entry in there, we want to run this while loop.

53
00:04:04,020 --> 00:04:06,960
So we're just printing it out next.

54
00:04:07,140 --> 00:04:14,970
So the next entry in our ETR, which in this case means in the array list iterator, which pretty much

55
00:04:14,970 --> 00:04:16,399
means in the list itself.

56
00:04:16,860 --> 00:04:22,840
And then we can also see that we can get the size of an array list by using its size property.

57
00:04:23,160 --> 00:04:25,620
So that will give us the following output.

58
00:04:26,010 --> 00:04:27,330
One, two.

59
00:04:27,540 --> 00:04:33,470
And then of course, the size of a list is two because there are only two entries in there.

60
00:04:37,950 --> 00:04:44,700
Now, let's look at the jet function so you can see we have this main function here again with so then

61
00:04:44,700 --> 00:04:45,830
let's look at the jet function.

62
00:04:45,840 --> 00:04:51,300
You can see again, we have a main function here using an array list of strings and then we add one

63
00:04:51,300 --> 00:04:54,330
and two and then we loop through it with this loop.

64
00:04:54,600 --> 00:05:00,060
But we also used to get function here in order to see what we will get.

65
00:05:00,090 --> 00:05:04,050
So if I use get one, I will get two.

66
00:05:04,290 --> 00:05:08,880
So this is a little confusing, but that has to do with the counting starting at zero.

67
00:05:08,910 --> 00:05:12,330
So the first entry here is going to be at index zero.

68
00:05:12,330 --> 00:05:14,400
The second entry will be at index one.

69
00:05:14,730 --> 00:05:22,680
What we're doing here is we are accessing index one, which means we get the two and that's why the

70
00:05:22,680 --> 00:05:24,300
output is to in this case.

71
00:05:26,250 --> 00:05:31,710
All right, this was just a little introduction to aerialists, we are going to use them quite a bit

72
00:05:31,710 --> 00:05:33,900
and then they will become natural as usual.

73
00:05:34,140 --> 00:05:35,370
So no worries there.

74
00:05:35,580 --> 00:05:39,080
It's like learning a new word in a foreign language.

75
00:05:39,450 --> 00:05:45,150
The more contacts you see this word and the more it makes sense and the better of an understanding you

76
00:05:45,150 --> 00:05:45,920
get for this word.

77
00:05:46,500 --> 00:05:47,820
So see you in the next video.

