Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
1
00:00:00,212 --> 00:00:02,716
(bright music)
2
2
00:00:02,716 --> 00:00:05,310
(light typing)
3
3
00:00:05,310 --> 00:00:06,143
In this section,
4
4
00:00:06,143 --> 00:00:08,080
we're going to look at lists.
5
5
00:00:08,080 --> 00:00:12,530
The list is an abstract data type and in the next video,
6
6
00:00:12,530 --> 00:00:16,510
we're going to go over what an abstract data type is.
7
7
00:00:16,510 --> 00:00:19,270
So a list isn't a concrete data structure,
8
8
00:00:19,270 --> 00:00:21,150
it's an abstract data type.
9
9
00:00:21,150 --> 00:00:23,140
And when it comes to abstract data types,
10
10
00:00:23,140 --> 00:00:25,130
normally there's an interface involved
11
11
00:00:25,130 --> 00:00:27,360
and list is no exception.
12
12
00:00:27,360 --> 00:00:30,820
In Java, the lists that we're gonna look at in this section
13
13
00:00:30,820 --> 00:00:34,410
all implement the java.util.list interface,
14
14
00:00:34,410 --> 00:00:36,500
so that's what I have on this screen.
15
15
00:00:36,500 --> 00:00:39,550
Classes that implement the list interface represent
16
16
00:00:39,550 --> 00:00:42,950
an ordered collection also known as a sequence.
17
17
00:00:42,950 --> 00:00:45,630
There are quite a few classes that implement list.
18
18
00:00:45,630 --> 00:00:47,100
We're not gonna look at all of them.
19
19
00:00:47,100 --> 00:00:48,880
We are gonna look at a few.
20
20
00:00:48,880 --> 00:00:50,870
We're gonna look at array list.
21
21
00:00:50,870 --> 00:00:53,870
We're going to look linked list.
22
22
00:00:53,870 --> 00:00:55,670
We'll look at those two in this section.
23
23
00:00:55,670 --> 00:00:57,240
We're also gonna look at vector.
24
24
00:00:57,240 --> 00:00:59,620
There's also an abstract list class
25
25
00:00:59,620 --> 00:01:01,880
and an abstract sequential list.
26
26
00:01:01,880 --> 00:01:05,440
If you want to implement the list interface,
27
27
00:01:05,440 --> 00:01:08,000
you want to create a custom implementation
28
28
00:01:08,000 --> 00:01:12,420
rather than starting with list itself and implementing that,
29
29
00:01:12,420 --> 00:01:15,450
it's a good idea to instead extend abstract list
30
30
00:01:15,450 --> 00:01:16,970
and abstract sequential list
31
31
00:01:16,970 --> 00:01:19,450
because there are scoledo implementations
32
32
00:01:19,450 --> 00:01:21,520
of the list interface and so they kind of give you
33
33
00:01:21,520 --> 00:01:25,320
a head start and all you have to do is override the methods
34
34
00:01:25,320 --> 00:01:27,570
that you specifically want to implement
35
35
00:01:27,570 --> 00:01:29,270
if you want custom behaviour.
36
36
00:01:29,270 --> 00:01:32,760
So if you are going to implement a custom list,
37
37
00:01:32,760 --> 00:01:35,500
its a good idea to extend one of these two classes.
38
38
00:01:35,500 --> 00:01:39,000
So lets just look at a few of the methods in here.
39
39
00:01:39,000 --> 00:01:43,160
You'll see we have add, so we can add items to the list.
40
40
00:01:43,160 --> 00:01:47,260
We can check to see whether a list contains an object.
41
41
00:01:47,260 --> 00:01:51,690
We can get an object from the list if we have its index.
42
42
00:01:51,690 --> 00:01:54,190
We can find the index of an object in the list.
43
43
00:01:54,190 --> 00:01:56,273
We can check whether a list is empty.
44
44
00:01:57,350 --> 00:01:59,580
We can remove objects from the list.
45
45
00:01:59,580 --> 00:02:01,870
We can find out using the size method
46
46
00:02:01,870 --> 00:02:03,500
how many items are in the list
47
47
00:02:03,500 --> 00:02:07,750
and we can get the array that's backing a list
48
48
00:02:07,750 --> 00:02:09,640
and we're gonna see what that means
49
49
00:02:09,640 --> 00:02:11,470
in the next couple of videos.
50
50
00:02:11,470 --> 00:02:15,500
Now some of the classes we're gonna look at in this section,
51
51
00:02:15,500 --> 00:02:17,990
like array list, you've probably worked with before.
52
52
00:02:17,990 --> 00:02:20,470
Array list is a really popular class
53
53
00:02:20,470 --> 00:02:21,830
but we're gonna dig a little deeper.
54
54
00:02:21,830 --> 00:02:24,100
We're gonna actually look at some of the array list code
55
55
00:02:24,100 --> 00:02:26,280
to see what's going on under the covers.
56
56
00:02:26,280 --> 00:02:29,120
Okay, so when we're dealing with lists,
57
57
00:02:29,120 --> 00:02:32,020
we're dealing with an ordered sequence,
58
58
00:02:32,020 --> 00:02:33,970
so the data is organised sequentially
59
59
00:02:33,970 --> 00:02:36,610
just as it is in an array and we're gonna see
60
60
00:02:36,610 --> 00:02:40,430
in a couple of videos that a popular way to implement
61
61
00:02:40,430 --> 00:02:42,730
the list interface is to use an array.
62
62
00:02:42,730 --> 00:02:44,820
So let's move on now and take a quick look
63
63
00:02:44,820 --> 00:02:46,860
at what an abstract data type is.
64
64
00:02:46,860 --> 00:02:48,410
I'll see you in the next video.
5601
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.