Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +8 -0
- 06 - Strings in Java/004 String Formatting.mp4 +3 -0
- 06 - Strings in Java/005 Regular expressions in Java.mp4 +3 -0
- 06 - Strings in Java/008 Homework review String.mp4 +3 -0
- 07 - Control Statements/001 'if - else' construction.mp4 +3 -0
- 07 - Control Statements/004 Homework review 'if' statement.mp4 +3 -0
- 07 - Control Statements/005 'switch' construction.mp4 +3 -0
- 07 - Control Statements/007 Homework review 'switch' statement.mp4 +3 -0
- 08 - Miscellaneous/001 Random numbers generation.mp4 +3 -0
- 17 - GIT/009 -ls-command-details.url +2 -0
- 17 - GIT/009 Git Branching_en.srt +952 -0
- 17 - GIT/010 Pull Requests & Merge Requests_en.srt +632 -0
- 17 - GIT/011 Updating local repository (fetch, merge, pull) & Team development demo_en.srt +712 -0
- 17 - GIT/012 Merge Conflicts_en.srt +796 -0
- 17 - GIT/013 Git Rebasing & Force Update of remote repository_en.srt +968 -0
- 17 - GIT/014 Git Interactive Rebase_en.srt +540 -0
- 17 - GIT/015 Git reset_en.srt +656 -0
- 17 - GIT/016 Git stash_en.srt +728 -0
- 17 - GIT/017 Restoring lost snapshots in Git git reflog_en.srt +412 -0
- 17 - GIT/018 Git cherry-pick moving commits between branches_en.srt +592 -0
- 17 - GIT/019 Cloning remote repository git clone.html +69 -0
- 17 - GIT/020 Git and Eclipse integration_en.srt +832 -0
- 17 - GIT/external-links.txt +9 -0
- 18 - Excpetion Handling/001 Exception Handling in Java_en.srt +1500 -0
- 18 - Excpetion Handling/001 Source-code-of-all-examples-from-the-lesson.url +2 -0
- 18 - Excpetion Handling/external-links.txt +3 -0
- 19 - Java Collections Framework/001 Java Collections Framework Overview_en.srt +508 -0
- 19 - Java Collections Framework/002 Collection Interface_en.srt +596 -0
- 19 - Java Collections Framework/003 Interfaces List, Set and Queue Overview_en.srt +472 -0
- 19 - Java Collections Framework/004 List implementations - ArrayList, Vector, CopyOnWriteArrayList & Stack_en.srt +1152 -0
- 19 - Java Collections Framework/005 Homework.url +2 -0
- 19 - Java Collections Framework/005 LinkedList VS ArrayList, Big O Notation & Homework_en.srt +1388 -0
- 19 - Java Collections Framework/005 Solution-for-DefaultMyList-coding-exercise.url +2 -0
- 19 - Java Collections Framework/005 Solution-of-the-homework-Backend-system-for-online-store-with-list.url +2 -0
- 19 - Java Collections Framework/005 Solution-of-the-homework-DefaultList-and-Performance-of-ArrayList-vs-LinkedList.url +2 -0
- 19 - Java Collections Framework/005 Source-code-of-the-example-used-in-the-lesso.url +2 -0
- 19 - Java Collections Framework/005 Template-project-for-your-homework.url +2 -0
- 19 - Java Collections Framework/008 Comparator and Comparable_en.srt +912 -0
- 19 - Java Collections Framework/008 Homework-Solution-Custom-Comparator.url +2 -0
- 19 - Java Collections Framework/008 Homework.url +2 -0
- 19 - Java Collections Framework/008 Source-code-of-the-example-used-in-the-lesson.url +2 -0
- 19 - Java Collections Framework/010 Homework-Solution-Custom-Iterator-and-ListIterator.url +2 -0
- 19 - Java Collections Framework/010 Homework.url +2 -0
- 19 - Java Collections Framework/010 Iterable, Iterator & ListIterator_en.srt +1080 -0
- 19 - Java Collections Framework/010 Source-code-of-the-examples-used-in-the-lesson.url +2 -0
- 19 - Java Collections Framework/012 Homework.url +2 -0
- 19 - Java Collections Framework/012 Queue and Deque_en.srt +1072 -0
- 19 - Java Collections Framework/012 Solution-for-Homework-Back-end-system-for-help-desk.url +2 -0
- 19 - Java Collections Framework/012 Source-code-of-the-example-used-in-the-lesson.url +2 -0
- 19 - Java Collections Framework/014 Map Hierarchy_en.srt +876 -0
.gitattributes
CHANGED
|
@@ -57,3 +57,11 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 57 |
06[[:space:]]-[[:space:]]Strings[[:space:]]in[[:space:]]Java/001[[:space:]]String[[:space:]]object[[:space:]]creation[[:space:]]and[[:space:]]main[[:space:]]methods[[:space:]]overview.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 58 |
06[[:space:]]-[[:space:]]Strings[[:space:]]in[[:space:]]Java/002[[:space:]]String[[:space:]]comparison[[:space:]][[:space:]]How[[:space:]]to[[:space:]]compare[[:space:]]Strings[[:space:]]and[[:space:]]what[[:space:]]is[[:space:]]String[[:space:]]Pool.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
06[[:space:]]-[[:space:]]Strings[[:space:]]in[[:space:]]Java/003[[:space:]]Escape[[:space:]]Sequences[[:space:]]in[[:space:]]Java.mp4 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
06[[:space:]]-[[:space:]]Strings[[:space:]]in[[:space:]]Java/001[[:space:]]String[[:space:]]object[[:space:]]creation[[:space:]]and[[:space:]]main[[:space:]]methods[[:space:]]overview.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 58 |
06[[:space:]]-[[:space:]]Strings[[:space:]]in[[:space:]]Java/002[[:space:]]String[[:space:]]comparison[[:space:]][[:space:]]How[[:space:]]to[[:space:]]compare[[:space:]]Strings[[:space:]]and[[:space:]]what[[:space:]]is[[:space:]]String[[:space:]]Pool.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
06[[:space:]]-[[:space:]]Strings[[:space:]]in[[:space:]]Java/003[[:space:]]Escape[[:space:]]Sequences[[:space:]]in[[:space:]]Java.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
06[[:space:]]-[[:space:]]Strings[[:space:]]in[[:space:]]Java/004[[:space:]]String[[:space:]]Formatting.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
06[[:space:]]-[[:space:]]Strings[[:space:]]in[[:space:]]Java/008[[:space:]]Homework[[:space:]]review[[:space:]]String.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
06[[:space:]]-[[:space:]]Strings[[:space:]]in[[:space:]]Java/005[[:space:]]Regular[[:space:]]expressions[[:space:]]in[[:space:]]Java.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
07[[:space:]]-[[:space:]]Control[[:space:]]Statements/004[[:space:]]Homework[[:space:]]review[[:space:]]'if'[[:space:]]statement.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
07[[:space:]]-[[:space:]]Control[[:space:]]Statements/001[[:space:]]'if[[:space:]]-[[:space:]]else'[[:space:]]construction.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
07[[:space:]]-[[:space:]]Control[[:space:]]Statements/007[[:space:]]Homework[[:space:]]review[[:space:]]'switch'[[:space:]]statement.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
08[[:space:]]-[[:space:]]Miscellaneous/001[[:space:]]Random[[:space:]]numbers[[:space:]]generation.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 67 |
+
07[[:space:]]-[[:space:]]Control[[:space:]]Statements/005[[:space:]]'switch'[[:space:]]construction.mp4 filter=lfs diff=lfs merge=lfs -text
|
06 - Strings in Java/004 String Formatting.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5c2d31160c281e33733b87c952e6a320f0cce90cdcb3caf793594984bf79347b
|
| 3 |
+
size 15954833
|
06 - Strings in Java/005 Regular expressions in Java.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0a8b90ac551f9bbc2fa8de4e72ee7dd65c9c1b7946f17c4d9ce666949f38fda0
|
| 3 |
+
size 77492569
|
06 - Strings in Java/008 Homework review String.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:33c72788fb9cd018fcfe1d56db4e090d538e51e66768b482d22e8707cbced792
|
| 3 |
+
size 15544727
|
07 - Control Statements/001 'if - else' construction.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7260b71643450813185ee9c726e797aa8ada20a39ea6a7096bb9e2c60af1a887
|
| 3 |
+
size 77499457
|
07 - Control Statements/004 Homework review 'if' statement.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e29e47d7c03d6c94736ec7cde9e62f805ac4639d25a18f50fed344d00487bda0
|
| 3 |
+
size 15041741
|
07 - Control Statements/005 'switch' construction.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a5eb695be02672273fe7d6660a83766ba695d9300d668483de7286aea84444c4
|
| 3 |
+
size 33168730
|
07 - Control Statements/007 Homework review 'switch' statement.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a8361e365f6f586147ef3eef716f7c0e41a3e3020cea76f454de319c844f6002
|
| 3 |
+
size 18468530
|
08 - Miscellaneous/001 Random numbers generation.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:faf4890cd69c6802b58db0708eac0966242d9c92336983d2b00df3028dd4a4e5
|
| 3 |
+
size 9976491
|
17 - GIT/009 -ls-command-details.url
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[InternetShortcut]
|
| 2 |
+
URL=https://www.rapidtables.com/code/linux/ls.html
|
17 - GIT/009 Git Branching_en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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1
|
| 2 |
+
00:00:06,000 --> 00:00:11,000
|
| 3 |
+
Hello, dissidents, today we are going to a very important lesson today will learn what branches and
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:11,000 --> 00:00:13,000
|
| 7 |
+
how to ensure smooth navigation between them.
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:14,000 --> 00:00:19,000
|
| 11 |
+
I will explain you how comets, asteroids and get in a nutshell will answer the question, what actually
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:19,000 --> 00:00:20,000
|
| 15 |
+
branches?
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:20,000 --> 00:00:21,000
|
| 19 |
+
I will explain today.
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:21,000 --> 00:00:27,000
|
| 23 |
+
What is it that after you will understand, the theory will proceed with practice exercises to learn
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:27,000 --> 00:00:33,000
|
| 27 |
+
commands that will allow us to create new branches and navigate between already existing ones.
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:33,000 --> 00:00:39,000
|
| 31 |
+
You learn such commands as Check-Out and Gifts, which will Ranjith branch command.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:39,000 --> 00:00:43,000
|
| 35 |
+
And I'll tell you how you can list all your local branches and remote.
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:43,000 --> 00:00:49,000
|
| 39 |
+
Once you're in the practice exercises, I'll show you how you can remove branch locally and in remote
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:49,000 --> 00:00:52,000
|
| 43 |
+
repository while navigating between the snapshots.
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:52,000 --> 00:00:55,000
|
| 47 |
+
I will show you what the touch that state is.
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:55,000 --> 00:01:00,000
|
| 51 |
+
Besides that, today I will show you basically next terminal commands for navigation in the file system,
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:01:00,000 --> 00:01:02,000
|
| 55 |
+
creating files and listin files.
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:01:03,000 --> 00:01:08,000
|
| 59 |
+
Lets start and to start with, let's imagine the case that you receive task on your work and you need
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:01:08,000 --> 00:01:11,000
|
| 63 |
+
to implement it to start work on the new task.
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:11,000 --> 00:01:16,000
|
| 67 |
+
You have to isolate your changes from the stable version of your code to make sure you will not mess
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:16,000 --> 00:01:18,000
|
| 71 |
+
it up through the late hour code.
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:18,000 --> 00:01:22,000
|
| 75 |
+
During the development of the new feature that allows us to create a separate branch.
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:23,000 --> 00:01:25,000
|
| 79 |
+
What is the branch we briefly discussed?
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:25,000 --> 00:01:26,000
|
| 83 |
+
What is the branch one?
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:26,000 --> 00:01:28,000
|
| 87 |
+
We talked about our master branch.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:29,000 --> 00:01:35,000
|
| 91 |
+
But let's recap one more time and simple words unit branch to diverge from the main branch to continue
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:35,000 --> 00:01:38,000
|
| 95 |
+
development without messing with the main development branch.
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:38,000 --> 00:01:44,000
|
| 99 |
+
For example, here's the main development branch where the latest version of the code is stored and
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:44,000 --> 00:01:46,000
|
| 103 |
+
you want to start work on the new task.
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:47,000 --> 00:01:53,000
|
| 107 |
+
You create a separate branch, you create comments on that branch, and after that you merge a branch
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:53,000 --> 00:01:55,000
|
| 111 |
+
with the development branch easy.
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:01:55,000 --> 00:02:01,000
|
| 115 |
+
Meanwhile, another developer can create a new branch and work in parallel with you for some period
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:02:01,000 --> 00:02:04,000
|
| 119 |
+
of time and merge his changes with years later.
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:05,000 --> 00:02:08,000
|
| 123 |
+
That's why we need branches during the software development in a team.
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:09,000 --> 00:02:15,000
|
| 127 |
+
To understand how branches work, we need to understand a bit deeper how get stores information you
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:15,000 --> 00:02:18,000
|
| 131 |
+
remember that gets its files as a series of the snapshots.
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:18,000 --> 00:02:24,000
|
| 135 |
+
When we create a command, get to commit objects that contains a pointer to the snapshot of the content
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:24,000 --> 00:02:26,000
|
| 139 |
+
that we added to the staging area.
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:26,000 --> 00:02:32,000
|
| 143 |
+
Also, this object stauss pointers to the comments that directly came before the current commit.
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:32,000 --> 00:02:38,000
|
| 147 |
+
Before we start learning specific commands how to create branches, I want you to understand the theory,
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:38,000 --> 00:02:44,000
|
| 151 |
+
at least on the high level, how it works, what actually happens when we create a new branch on this
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:44,000 --> 00:02:49,000
|
| 155 |
+
slide, you can see that I created a new branch with the name testing what actually happened in the
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:49,000 --> 00:02:50,000
|
| 159 |
+
language of it.
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:50,000 --> 00:02:56,000
|
| 163 |
+
I just created a new pointer on the current commit on the moment when I create a new branch from the
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:02:56,000 --> 00:03:03,000
|
| 167 |
+
master to pointers are pointing out to the same command, but how it knows that at this specific moment
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:03:03,000 --> 00:03:07,000
|
| 171 |
+
of time I'm on the Master Branch, but not on the testing branch.
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:03:07,000 --> 00:03:08,000
|
| 175 |
+
There is one more point.
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:08,000 --> 00:03:09,000
|
| 179 |
+
I called that.
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:09,000 --> 00:03:11,000
|
| 183 |
+
Now let's imagine we switched branches.
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:12,000 --> 00:03:16,000
|
| 187 |
+
I will show you comments a bit later in this lesson when we will have practice exercise.
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:16,000 --> 00:03:23,000
|
| 191 |
+
Right now, I want you to focus on the series and this visualization switch branches in the language
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:23,000 --> 00:03:25,000
|
| 195 |
+
object is to change head pointer.
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:25,000 --> 00:03:31,000
|
| 199 |
+
Now, Head is pointing out to the testing pointer being on this branch, we can create a new command.
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:31,000 --> 00:03:32,000
|
| 203 |
+
What happens next?
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:33,000 --> 00:03:38,000
|
| 207 |
+
Our testing branch moved forward while Master Branch still points to the previous command.
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:38,000 --> 00:03:44,000
|
| 211 |
+
So in this particular case, if you would switch back to the master branch, you would see the state
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:44,000 --> 00:03:46,000
|
| 215 |
+
of the file system, which was before your last commit.
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:47,000 --> 00:03:53,000
|
| 219 |
+
OK, now you can imagine how pointers and it works, but let's move further now.
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:53,000 --> 00:03:58,000
|
| 223 |
+
Imagine that somebody, some as a developer, managed to put changes into the master branch and then
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:03:58,000 --> 00:04:00,000
|
| 227 |
+
you can meet and Master Branch appeared.
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:04:01,000 --> 00:04:03,000
|
| 231 |
+
Your project history has diverged.
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:04:03,000 --> 00:04:07,000
|
| 235 |
+
Both changes in these two countries are isolated from each other.
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:04:07,000 --> 00:04:08,000
|
| 239 |
+
But we can merge.
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:08,000 --> 00:04:13,000
|
| 243 |
+
This changes if we want that this exact scenario which we need to learn together.
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:13,000 --> 00:04:18,000
|
| 247 |
+
And this course, we are going to learn how to merge changes together from different branches.
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:18,000 --> 00:04:22,000
|
| 251 |
+
So right now, you already understand the theory of branches.
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:22,000 --> 00:04:28,000
|
| 255 |
+
You can visualize in your mind how navigation between branches works and why do we need this now it
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:28,000 --> 00:04:32,000
|
| 259 |
+
is time to run specific it commands that will allow you to navigate between branches.
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:32,000 --> 00:04:35,000
|
| 263 |
+
Let's practice usually on the job.
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:35,000 --> 00:04:39,000
|
| 267 |
+
You are going to use some task management system or issue trackers that will give you a unique idea
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:39,000 --> 00:04:40,000
|
| 271 |
+
of your task.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:41,000 --> 00:04:46,000
|
| 275 |
+
Imagine that we have a task to implement logic of discount calculation for our customers based on the
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:04:46,000 --> 00:04:52,000
|
| 279 |
+
history of purchases where we need to start, we need to start from creation of the branch.
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:04:52,000 --> 00:04:54,000
|
| 283 |
+
There are different ways to create branches.
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:04:55,000 --> 00:05:02,000
|
| 287 |
+
One of the options is to use the next command, get Branch G a three zero one.
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:05:03,000 --> 00:05:10,000
|
| 291 |
+
Let's press enter new branch is created, but you see here in parentheses, I'm still in the master
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:05:10,000 --> 00:05:13,000
|
| 295 |
+
branch to check which branches I have locally.
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:05:13,000 --> 00:05:19,000
|
| 299 |
+
I have to just use the next command get branch to see all remoted branches.
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:19,000 --> 00:05:23,000
|
| 303 |
+
I have to use the next command branch was option are.
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:24,000 --> 00:05:29,000
|
| 307 |
+
And you see that right now I have only one branch and remote that is my original Austin branch.
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:29,000 --> 00:05:33,000
|
| 311 |
+
To see all local and remote branches you have to use the EH option.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:34,000 --> 00:05:36,000
|
| 315 |
+
Get Branch Desh a.
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:37,000 --> 00:05:43,000
|
| 319 |
+
And here we can find all local and remote branches, but to be honest, the branch command is rarely
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:43,000 --> 00:05:49,000
|
| 323 |
+
used among developers to create a new branch because this command only creates branch but not get you
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:49,000 --> 00:05:50,000
|
| 327 |
+
to the new branch.
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:50,000 --> 00:05:55,000
|
| 331 |
+
Usually software engineers use the commands it creates and changed branches simultaneously.
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:05:56,000 --> 00:05:58,000
|
| 335 |
+
So let's type the following year.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:05:58,000 --> 00:05:59,000
|
| 339 |
+
Check out, check out.
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:05:59,000 --> 00:06:01,000
|
| 343 |
+
Command is for changing branches.
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:06:02,000 --> 00:06:07,000
|
| 347 |
+
Option B, this option is to indicate that I want to change and create a new branch.
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:06:07,000 --> 00:06:17,000
|
| 351 |
+
B stands for Branch and now let's specify the name of the branch task three zero one underscore discount.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:06:17,000 --> 00:06:19,000
|
| 355 |
+
Underscore calculation.
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:06:19,000 --> 00:06:25,000
|
| 359 |
+
Usually with the task, we would like to specify a brief description of what changes will be in this
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:25,000 --> 00:06:26,000
|
| 363 |
+
branch press.
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:26,000 --> 00:06:33,000
|
| 367 |
+
Enter and we switch to the new branch and in parentheses you can easily identify on which branch you
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:33,000 --> 00:06:36,000
|
| 371 |
+
are right now and where is your head pointer.
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:36,000 --> 00:06:38,000
|
| 375 |
+
OK, we created changes.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:38,000 --> 00:06:40,000
|
| 379 |
+
Now let's implement our task.
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:41,000 --> 00:06:42,000
|
| 383 |
+
For the sake of example.
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:06:42,000 --> 00:06:49,000
|
| 387 |
+
I won't write any code and I will not implement any logic related to the discount calculation because
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:06:49,000 --> 00:06:51,000
|
| 391 |
+
I want you now to focus only on it.
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:06:52,000 --> 00:06:53,000
|
| 395 |
+
But let's imitate that.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:06:53,000 --> 00:06:57,000
|
| 399 |
+
We need some changes and all of them stored in the new file.
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:06:57,000 --> 00:07:00,000
|
| 403 |
+
Let me use Linux commands to create a new file.
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:07:00,000 --> 00:07:07,000
|
| 407 |
+
First of all, I want to navigate to the folder with the source code Siggie, SIRC and Presenta.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:07:08,000 --> 00:07:15,000
|
| 411 |
+
Sydney stands for Change Directory and you see here in the path that I navigated to the SC directory.
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:07:16,000 --> 00:07:22,000
|
| 415 |
+
Dutch discount calculation service, Dutch Java Dutch Command allows us to create file.
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:23,000 --> 00:07:28,000
|
| 419 |
+
This is one of the possible ways to create files with Linux terminals to check what files you have in
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:28,000 --> 00:07:29,000
|
| 423 |
+
the directory.
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:29,000 --> 00:07:31,000
|
| 427 |
+
Let me show you one more Linux command.
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:32,000 --> 00:07:35,000
|
| 431 |
+
Alas, Resorption El Al.
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:35,000 --> 00:07:39,000
|
| 435 |
+
S is a command that list files in the specific directories.
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:39,000 --> 00:07:45,000
|
| 439 |
+
I don't see a lot of sense in reviewing all possible options for comment because most likely you want
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:07:45,000 --> 00:07:46,000
|
| 443 |
+
to use them all.
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:07:47,000 --> 00:07:49,000
|
| 447 |
+
I use Option L to have such formatting.
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:07:50,000 --> 00:07:55,000
|
| 451 |
+
I will leave the link and attachments to this lesson about Allah's command and if you wish, you can
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:07:55,000 --> 00:07:56,000
|
| 455 |
+
try different other options.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:07:57,000 --> 00:07:59,000
|
| 459 |
+
And we see that new file is created.
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:08:00,000 --> 00:08:00,000
|
| 463 |
+
Here it is.
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:08:01,000 --> 00:08:07,000
|
| 467 |
+
Let's also check that file was created in the File Explorer and we can also find it here.
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:08:07,000 --> 00:08:08,000
|
| 471 |
+
Awesome.
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:08:08,000 --> 00:08:12,000
|
| 475 |
+
We have just created a file and here it is in the SLC directory.
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:08:13,000 --> 00:08:18,000
|
| 479 |
+
Before we proceed, I want to show you one more interesting command for navigation and file system.
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:18,000 --> 00:08:22,000
|
| 483 |
+
We are terminal Siggie, dot, dot, dot, dot, dot.
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:22,000 --> 00:08:25,000
|
| 487 |
+
Always references to the parent directory.
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:25,000 --> 00:08:31,000
|
| 491 |
+
So in case you want to navigate one level up, you have to use this command and you see well, already
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:31,000 --> 00:08:35,000
|
| 495 |
+
in our project directory and not in saac folder anymore.
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:08:36,000 --> 00:08:40,000
|
| 499 |
+
Now let's pretend that our work on this task is completed and we need everything.
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:08:40,000 --> 00:08:42,000
|
| 503 |
+
What is needed in scope of this task?
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:08:42,000 --> 00:08:45,000
|
| 507 |
+
We have to create a command with our changes.
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:08:45,000 --> 00:08:50,000
|
| 511 |
+
We add file to the staging area as usual, get at DOT.
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:08:50,000 --> 00:08:52,000
|
| 515 |
+
Now we create command.
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:08:53,000 --> 00:08:58,000
|
| 519 |
+
Gate comit dash cam, personal discount for user can be calculated.
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:09:01,000 --> 00:09:04,000
|
| 523 |
+
Great, we have our committee now, a branch.
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:09:04,000 --> 00:09:11,000
|
| 527 |
+
Let's check it, lock gate, lock dash to to see only last two comments.
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:09:11,000 --> 00:09:14,000
|
| 531 |
+
We can see here that this comment is from Master Branch.
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:09:15,000 --> 00:09:18,000
|
| 535 |
+
And here's our new comment on our new branch.
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:09:18,000 --> 00:09:25,000
|
| 539 |
+
By the way, just to remind you that it shows you the history of the current branch only to watch all
|
| 540 |
+
|
| 541 |
+
136
|
| 542 |
+
00:09:25,000 --> 00:09:26,000
|
| 543 |
+
committees across the repository.
|
| 544 |
+
|
| 545 |
+
137
|
| 546 |
+
00:09:26,000 --> 00:09:27,000
|
| 547 |
+
You have to type it.
|
| 548 |
+
|
| 549 |
+
138
|
| 550 |
+
00:09:27,000 --> 00:09:35,000
|
| 551 |
+
Look with options all like this log double dash, all towards the history of committees for the one
|
| 552 |
+
|
| 553 |
+
139
|
| 554 |
+
00:09:35,000 --> 00:09:43,000
|
| 555 |
+
single branch type Gitlow command with the branch name like this gridlock g a double zero.
|
| 556 |
+
|
| 557 |
+
140
|
| 558 |
+
00:09:43,000 --> 00:09:47,000
|
| 559 |
+
And do not forget, do you stop key for after completion.
|
| 560 |
+
|
| 561 |
+
141
|
| 562 |
+
00:09:48,000 --> 00:09:52,000
|
| 563 |
+
OK, this information might help you in the future, and just for the reference.
|
| 564 |
+
|
| 565 |
+
142
|
| 566 |
+
00:09:53,000 --> 00:09:53,000
|
| 567 |
+
Let's move on.
|
| 568 |
+
|
| 569 |
+
143
|
| 570 |
+
00:09:54,000 --> 00:09:58,000
|
| 571 |
+
I can easily navigate between branches in my local repository.
|
| 572 |
+
|
| 573 |
+
144
|
| 574 |
+
00:09:58,000 --> 00:10:01,000
|
| 575 |
+
We already learned the command that allows us to switch branches.
|
| 576 |
+
|
| 577 |
+
145
|
| 578 |
+
00:10:02,000 --> 00:10:04,000
|
| 579 |
+
Now, let's switch back to the master branch.
|
| 580 |
+
|
| 581 |
+
146
|
| 582 |
+
00:10:05,000 --> 00:10:06,000
|
| 583 |
+
You check out master.
|
| 584 |
+
|
| 585 |
+
147
|
| 586 |
+
00:10:07,000 --> 00:10:12,000
|
| 587 |
+
I don't have to use the option because Master Branch already exists and I don't need to create a new
|
| 588 |
+
|
| 589 |
+
148
|
| 590 |
+
00:10:12,000 --> 00:10:12,000
|
| 591 |
+
one.
|
| 592 |
+
|
| 593 |
+
149
|
| 594 |
+
00:10:13,000 --> 00:10:17,000
|
| 595 |
+
And we can see that name of the branches changed here in the parentheses.
|
| 596 |
+
|
| 597 |
+
150
|
| 598 |
+
00:10:17,000 --> 00:10:20,000
|
| 599 |
+
Let's check now the file lists in the SAAC folder.
|
| 600 |
+
|
| 601 |
+
151
|
| 602 |
+
00:10:21,000 --> 00:10:28,000
|
| 603 |
+
Let's navigate to SASE folder, first CD SAAC and now let's use another command to list files.
|
| 604 |
+
|
| 605 |
+
152
|
| 606 |
+
00:10:29,000 --> 00:10:31,000
|
| 607 |
+
Alas, that shall.
|
| 608 |
+
|
| 609 |
+
153
|
| 610 |
+
00:10:31,000 --> 00:10:32,000
|
| 611 |
+
Wow.
|
| 612 |
+
|
| 613 |
+
154
|
| 614 |
+
00:10:32,000 --> 00:10:40,000
|
| 615 |
+
Magic happened where discount calculation Java file, it is in another snapshot, if you don't believe
|
| 616 |
+
|
| 617 |
+
155
|
| 618 |
+
00:10:40,000 --> 00:10:41,000
|
| 619 |
+
that file is disappeared.
|
| 620 |
+
|
| 621 |
+
156
|
| 622 |
+
00:10:41,000 --> 00:10:44,000
|
| 623 |
+
Let me show you in the file Explorer, can you see this?
|
| 624 |
+
|
| 625 |
+
157
|
| 626 |
+
00:10:45,000 --> 00:10:46,000
|
| 627 |
+
The file is disappeared.
|
| 628 |
+
|
| 629 |
+
158
|
| 630 |
+
00:10:47,000 --> 00:10:50,000
|
| 631 |
+
Now you learned how to navigate between branches.
|
| 632 |
+
|
| 633 |
+
159
|
| 634 |
+
00:10:50,000 --> 00:10:52,000
|
| 635 |
+
Can you navigate only between branches?
|
| 636 |
+
|
| 637 |
+
160
|
| 638 |
+
00:10:52,000 --> 00:10:53,000
|
| 639 |
+
Oh, no.
|
| 640 |
+
|
| 641 |
+
161
|
| 642 |
+
00:10:53,000 --> 00:10:57,000
|
| 643 |
+
You can also navigate to the specific limit how to do that.
|
| 644 |
+
|
| 645 |
+
162
|
| 646 |
+
00:10:57,000 --> 00:11:00,000
|
| 647 |
+
Let me show you at the beginning.
|
| 648 |
+
|
| 649 |
+
163
|
| 650 |
+
00:11:00,000 --> 00:11:04,000
|
| 651 |
+
Let's find the comet where I want to switch, get log dash three.
|
| 652 |
+
|
| 653 |
+
164
|
| 654 |
+
00:11:05,000 --> 00:11:09,000
|
| 655 |
+
OK, let me switch to this cannot get out.
|
| 656 |
+
|
| 657 |
+
165
|
| 658 |
+
00:11:10,000 --> 00:11:14,000
|
| 659 |
+
Zero six G, one B and Presenta.
|
| 660 |
+
|
| 661 |
+
166
|
| 662 |
+
00:11:14,000 --> 00:11:20,000
|
| 663 |
+
So you need to enter a unique combination of characters so that you would understand where you are reference
|
| 664 |
+
|
| 665 |
+
167
|
| 666 |
+
00:11:20,000 --> 00:11:21,000
|
| 667 |
+
into.
|
| 668 |
+
|
| 669 |
+
168
|
| 670 |
+
00:11:21,000 --> 00:11:24,000
|
| 671 |
+
And now we switch to the state of this particular comet.
|
| 672 |
+
|
| 673 |
+
169
|
| 674 |
+
00:11:25,000 --> 00:11:31,000
|
| 675 |
+
Right after you switch to the specific comet, you see one message that you are in the dust head state.
|
| 676 |
+
|
| 677 |
+
170
|
| 678 |
+
00:11:31,000 --> 00:11:32,000
|
| 679 |
+
What does that mean?
|
| 680 |
+
|
| 681 |
+
171
|
| 682 |
+
00:11:33,000 --> 00:11:39,000
|
| 683 |
+
That means we are not on the specific branch because most likely this comet is present in different
|
| 684 |
+
|
| 685 |
+
172
|
| 686 |
+
00:11:39,000 --> 00:11:39,000
|
| 687 |
+
branches.
|
| 688 |
+
|
| 689 |
+
173
|
| 690 |
+
00:11:40,000 --> 00:11:45,000
|
| 691 |
+
Even if you would create Comet being here, nobody would be able to find this comet other than we are
|
| 692 |
+
|
| 693 |
+
174
|
| 694 |
+
00:11:45,000 --> 00:11:51,000
|
| 695 |
+
directly examining the fire because new comets won't be connected with any specific branch.
|
| 696 |
+
|
| 697 |
+
175
|
| 698 |
+
00:11:52,000 --> 00:11:58,000
|
| 699 |
+
That means these changes can easily get lost once you check out a different revision on Branch.
|
| 700 |
+
|
| 701 |
+
176
|
| 702 |
+
00:11:58,000 --> 00:12:02,000
|
| 703 |
+
So why then we need to check out the specific comet.
|
| 704 |
+
|
| 705 |
+
177
|
| 706 |
+
00:12:02,000 --> 00:12:08,000
|
| 707 |
+
During your life as a software engineer, you might want to navigate to the specific committee to investigate
|
| 708 |
+
|
| 709 |
+
178
|
| 710 |
+
00:12:08,000 --> 00:12:11,000
|
| 711 |
+
how some specific chunk of code worked in the past.
|
| 712 |
+
|
| 713 |
+
179
|
| 714 |
+
00:12:12,000 --> 00:12:15,000
|
| 715 |
+
For example, in case to troubleshoot some defect.
|
| 716 |
+
|
| 717 |
+
180
|
| 718 |
+
00:12:15,000 --> 00:12:21,000
|
| 719 |
+
You want to investigate how the code worked before and you want to execute this court and the market.
|
| 720 |
+
|
| 721 |
+
181
|
| 722 |
+
00:12:21,000 --> 00:12:24,000
|
| 723 |
+
That's why you might want to navigate to the specific comet.
|
| 724 |
+
|
| 725 |
+
182
|
| 726 |
+
00:12:25,000 --> 00:12:32,000
|
| 727 |
+
What I want you to remember is that you shouldn't do any comets in the state just investigating an experiment
|
| 728 |
+
|
| 729 |
+
183
|
| 730 |
+
00:12:32,000 --> 00:12:33,000
|
| 731 |
+
in this fine.
|
| 732 |
+
|
| 733 |
+
184
|
| 734 |
+
00:12:33,000 --> 00:12:38,000
|
| 735 |
+
Well, being in the state, doing the commands and the state is not the best idea.
|
| 736 |
+
|
| 737 |
+
185
|
| 738 |
+
00:12:39,000 --> 00:12:42,000
|
| 739 |
+
Let's get back to our task branch yet.
|
| 740 |
+
|
| 741 |
+
186
|
| 742 |
+
00:12:42,000 --> 00:12:49,000
|
| 743 |
+
Check out Geet zero zero zero one and press up two times for auto completion.
|
| 744 |
+
|
| 745 |
+
187
|
| 746 |
+
00:12:49,000 --> 00:12:56,000
|
| 747 |
+
You have to press stop two times because we have a three zero one branch and a three zero one discount
|
| 748 |
+
|
| 749 |
+
188
|
| 750 |
+
00:12:56,000 --> 00:12:57,000
|
| 751 |
+
calculation branch.
|
| 752 |
+
|
| 753 |
+
189
|
| 754 |
+
00:12:58,000 --> 00:13:02,000
|
| 755 |
+
And Antep allows you to select the exact branch you need for auto completion.
|
| 756 |
+
|
| 757 |
+
190
|
| 758 |
+
00:13:03,000 --> 00:13:07,000
|
| 759 |
+
Now, let's push it to a region, yet push our region with option.
|
| 760 |
+
|
| 761 |
+
191
|
| 762 |
+
00:13:07,000 --> 00:13:13,000
|
| 763 |
+
You g a three zero one underscore and top key to autocomplete.
|
| 764 |
+
|
| 765 |
+
192
|
| 766 |
+
00:13:14,000 --> 00:13:21,000
|
| 767 |
+
Nice branch was pushed to remote, new branch in remote has been created and the branch remote tracking
|
| 768 |
+
|
| 769 |
+
193
|
| 770 |
+
00:13:21,000 --> 00:13:22,000
|
| 771 |
+
has been configured.
|
| 772 |
+
|
| 773 |
+
194
|
| 774 |
+
00:13:22,000 --> 00:13:24,000
|
| 775 |
+
Let's check the branch in the remote repository.
|
| 776 |
+
|
| 777 |
+
195
|
| 778 |
+
00:13:25,000 --> 00:13:27,000
|
| 779 |
+
Let's open a search directory.
|
| 780 |
+
|
| 781 |
+
196
|
| 782 |
+
00:13:27,000 --> 00:13:33,000
|
| 783 |
+
And here you can switch branches and we can see that on our new branch, we have new file.
|
| 784 |
+
|
| 785 |
+
197
|
| 786 |
+
00:13:36,000 --> 00:13:44,000
|
| 787 |
+
Click on Inside Sidestep Select Network here, you can see its history and see that our new branch is
|
| 788 |
+
|
| 789 |
+
198
|
| 790 |
+
00:13:44,000 --> 00:13:49,000
|
| 791 |
+
one committee ahead of Master Branch, OK, well on how to create branches.
|
| 792 |
+
|
| 793 |
+
199
|
| 794 |
+
00:13:49,000 --> 00:13:53,000
|
| 795 |
+
But at the beginning of the lesson, we also created one branch.
|
| 796 |
+
|
| 797 |
+
200
|
| 798 |
+
00:13:53,000 --> 00:13:56,000
|
| 799 |
+
Let me list all branches and get back one more time.
|
| 800 |
+
|
| 801 |
+
201
|
| 802 |
+
00:13:57,000 --> 00:14:01,000
|
| 803 |
+
Get Branch was option A this task branch.
|
| 804 |
+
|
| 805 |
+
202
|
| 806 |
+
00:14:01,000 --> 00:14:06,000
|
| 807 |
+
I want to remove how to remove branch get branch was option.
|
| 808 |
+
|
| 809 |
+
203
|
| 810 |
+
00:14:06,000 --> 00:14:09,000
|
| 811 |
+
The D stands for delete and the branch name.
|
| 812 |
+
|
| 813 |
+
204
|
| 814 |
+
00:14:10,000 --> 00:14:16,000
|
| 815 |
+
We can find message that branch has been deleted, and for the sake of example, let's pretend that
|
| 816 |
+
|
| 817 |
+
205
|
| 818 |
+
00:14:16,000 --> 00:14:20,000
|
| 819 |
+
I want to remove the calculation branch from the remote to how to do that.
|
| 820 |
+
|
| 821 |
+
206
|
| 822 |
+
00:14:21,000 --> 00:14:26,000
|
| 823 |
+
Yet push a region was option delete and specifies a branch name here.
|
| 824 |
+
|
| 825 |
+
207
|
| 826 |
+
00:14:27,000 --> 00:14:28,000
|
| 827 |
+
Press enter.
|
| 828 |
+
|
| 829 |
+
208
|
| 830 |
+
00:14:30,000 --> 00:14:32,000
|
| 831 |
+
Let me open my remote repository one more time.
|
| 832 |
+
|
| 833 |
+
209
|
| 834 |
+
00:14:34,000 --> 00:14:39,000
|
| 835 |
+
And when I try to switch branch, you see that I can't find my new branch here anymore.
|
| 836 |
+
|
| 837 |
+
210
|
| 838 |
+
00:14:39,000 --> 00:14:43,000
|
| 839 |
+
Now you know how to remove branch locally and in remote.
|
| 840 |
+
|
| 841 |
+
211
|
| 842 |
+
00:14:43,000 --> 00:14:49,000
|
| 843 |
+
But for our next lesson, let me push our branch to region one more time, because already in the next
|
| 844 |
+
|
| 845 |
+
212
|
| 846 |
+
00:14:49,000 --> 00:14:54,000
|
| 847 |
+
lesson, we are going to learn how to grade pull requests and how to merge branches together.
|
| 848 |
+
|
| 849 |
+
213
|
| 850 |
+
00:14:55,000 --> 00:14:58,000
|
| 851 |
+
Yet push a region was option you for this contemplation branch.
|
| 852 |
+
|
| 853 |
+
214
|
| 854 |
+
00:14:59,000 --> 00:15:05,000
|
| 855 |
+
The last but nonetheless, thing that I would like to mention today is that starting from the get version
|
| 856 |
+
|
| 857 |
+
215
|
| 858 |
+
00:15:05,000 --> 00:15:10,000
|
| 859 |
+
two point twenty three onwards, instead of checkout command, new command is also available to use
|
| 860 |
+
|
| 861 |
+
216
|
| 862 |
+
00:15:11,000 --> 00:15:13,000
|
| 863 |
+
get switch master.
|
| 864 |
+
|
| 865 |
+
217
|
| 866 |
+
00:15:13,000 --> 00:15:20,000
|
| 867 |
+
In case you want to switch to the new branch, you have to use C option like this and get switch options.
|
| 868 |
+
|
| 869 |
+
218
|
| 870 |
+
00:15:20,000 --> 00:15:23,000
|
| 871 |
+
See New Branch here.
|
| 872 |
+
|
| 873 |
+
219
|
| 874 |
+
00:15:23,000 --> 00:15:30,000
|
| 875 |
+
C option stands for create to navigate back to the previous branch type, the following gate switch
|
| 876 |
+
|
| 877 |
+
220
|
| 878 |
+
00:15:30,000 --> 00:15:33,000
|
| 879 |
+
and hyphen and then navigated back to the Master Branch.
|
| 880 |
+
|
| 881 |
+
221
|
| 882 |
+
00:15:34,000 --> 00:15:35,000
|
| 883 |
+
To be honest, I didn't.
|
| 884 |
+
|
| 885 |
+
222
|
| 886 |
+
00:15:35,000 --> 00:15:41,000
|
| 887 |
+
So engineers who are already actively used to each command because it is a big habit to use Check-Out
|
| 888 |
+
|
| 889 |
+
223
|
| 890 |
+
00:15:41,000 --> 00:15:46,000
|
| 891 |
+
Command for branch navigation in the community of engineers introducing Gates, which command wasn't
|
| 892 |
+
|
| 893 |
+
224
|
| 894 |
+
00:15:46,000 --> 00:15:48,000
|
| 895 |
+
done to confuse developers even more.
|
| 896 |
+
|
| 897 |
+
225
|
| 898 |
+
00:15:49,000 --> 00:15:55,000
|
| 899 |
+
The thing is that Check-Out commands sometimes might be used to reverse modifications, so to clearly
|
| 900 |
+
|
| 901 |
+
226
|
| 902 |
+
00:15:55,000 --> 00:16:02,000
|
| 903 |
+
separate commands, Newcomen to a single goal to switch branches gets which was introduced that it.
|
| 904 |
+
|
| 905 |
+
227
|
| 906 |
+
00:16:03,000 --> 00:16:09,000
|
| 907 |
+
I believe right now, you know about branch navigation even more than some senior engineers, and right
|
| 908 |
+
|
| 909 |
+
228
|
| 910 |
+
00:16:09,000 --> 00:16:13,000
|
| 911 |
+
now let's recap what we have learned today in this lesson.
|
| 912 |
+
|
| 913 |
+
229
|
| 914 |
+
00:16:13,000 --> 00:16:17,000
|
| 915 |
+
You learned what the branches you understand how mechanism of branch works.
|
| 916 |
+
|
| 917 |
+
230
|
| 918 |
+
00:16:18,000 --> 00:16:20,000
|
| 919 |
+
Well, what is Healthpoint in it?
|
| 920 |
+
|
| 921 |
+
231
|
| 922 |
+
00:16:21,000 --> 00:16:22,000
|
| 923 |
+
After we learn theory?
|
| 924 |
+
|
| 925 |
+
232
|
| 926 |
+
00:16:22,000 --> 00:16:28,000
|
| 927 |
+
I showed you a few ways how to create a new branch and get ready to commit with our changes on the new
|
| 928 |
+
|
| 929 |
+
233
|
| 930 |
+
00:16:28,000 --> 00:16:33,000
|
| 931 |
+
branch, we understood how we can navigate between the branches and what the Dutch had state is.
|
| 932 |
+
|
| 933 |
+
234
|
| 934 |
+
00:16:33,000 --> 00:16:40,000
|
| 935 |
+
Also in this lesson we learn how to remove branches and how to use gifts which command to navigate between
|
| 936 |
+
|
| 937 |
+
235
|
| 938 |
+
00:16:40,000 --> 00:16:40,000
|
| 939 |
+
them.
|
| 940 |
+
|
| 941 |
+
236
|
| 942 |
+
00:16:40,000 --> 00:16:46,000
|
| 943 |
+
During the lesson you learned basically Linux commands that allows us to navigate and filesystem, create
|
| 944 |
+
|
| 945 |
+
237
|
| 946 |
+
00:16:46,000 --> 00:16:48,000
|
| 947 |
+
files and leased files in that directory.
|
| 948 |
+
|
| 949 |
+
238
|
| 950 |
+
00:16:49,000 --> 00:16:53,000
|
| 951 |
+
Thanks a lot for your attention and see you in the next lesson.
|
| 952 |
+
|
17 - GIT/010 Pull Requests & Merge Requests_en.srt
ADDED
|
@@ -0,0 +1,632 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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|
+
we'll understand the definition of PR.
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:13,000 --> 00:00:16,000
|
| 11 |
+
I will show you how you can create your first pool request.
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:16,000 --> 00:00:20,000
|
| 15 |
+
We'll learn what is the difference between pool request and Richard Quest.
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:20,000 --> 00:00:23,000
|
| 19 |
+
In this lesson, we are going to learn how we can match.
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:23,000 --> 00:00:28,000
|
| 23 |
+
Coming from different branches will learn the difference between different methods and strategies.
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:28,000 --> 00:00:31,000
|
| 27 |
+
I will show you how to add collaborator's to your repository.
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:32,000 --> 00:00:36,000
|
| 31 |
+
You'll add me as a collaborator so that I will be able to evaluate your code.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:36,000 --> 00:00:42,000
|
| 35 |
+
First of all, let's understand what is a pull request pull request as a method of submitting contributions
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:42,000 --> 00:00:43,000
|
| 39 |
+
to a project.
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:43,000 --> 00:00:48,000
|
| 43 |
+
Imagine that you wrote a few days and implementing logic of discount calculation for your users.
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:48,000 --> 00:00:50,000
|
| 47 |
+
And finally, you completed your work.
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:51,000 --> 00:00:54,000
|
| 51 |
+
Now you need to match your card with the latest version of the source code.
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:00:55,000 --> 00:00:59,000
|
| 55 |
+
Literally, you have to much of yours with comments that were done by other developers.
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:01:00,000 --> 00:01:02,000
|
| 59 |
+
Why is this method is called a pull request.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:01:02,000 --> 00:01:06,000
|
| 63 |
+
You can pull changes from one branch to update another branch.
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:06,000 --> 00:01:11,000
|
| 67 |
+
And by submitting a budget request, you ask other people to review your changes and pull them into
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:11,000 --> 00:01:13,000
|
| 71 |
+
another branch.
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:13,000 --> 00:01:14,000
|
| 75 |
+
Does it make sense now?
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:14,000 --> 00:01:17,000
|
| 79 |
+
Now words to request make more sense.
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:17,000 --> 00:01:22,000
|
| 83 |
+
And by the way, we'll request the terminology of the GitHub and mid-market repositories.
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:22,000 --> 00:01:26,000
|
| 87 |
+
Yet Lab uses another term to describe the same process merge request.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:27,000 --> 00:01:28,000
|
| 91 |
+
The idea is pretty similar.
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:29,000 --> 00:01:32,000
|
| 95 |
+
We may want to merge two branches and merge.
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:32,000 --> 00:01:37,000
|
| 99 |
+
Request means that you want to ask somebody to merge the changes with the other branch.
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:37,000 --> 00:01:42,000
|
| 103 |
+
Both requests and merge requests use get pull and get merge commands.
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:42,000 --> 00:01:48,000
|
| 107 |
+
We are going to learn these commands in the next lessons, but don't confuse this terminology.
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:48,000 --> 00:01:55,000
|
| 111 |
+
PR and Anmar refers to a much broader topic, and I believe you understand that both of these terms
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:01:55,000 --> 00:01:57,000
|
| 115 |
+
describe the same process.
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:01:57,000 --> 00:02:03,000
|
| 119 |
+
Now, when you understood that, let's proceed with our demo on the previous lesson remerged.
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:03,000 --> 00:02:04,000
|
| 123 |
+
Our branch does a remote repository.
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:05,000 --> 00:02:08,000
|
| 127 |
+
We add new file added discount calculation service.
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:08,000 --> 00:02:11,000
|
| 131 |
+
Let's also change existing file for the sake of the demo.
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:12,000 --> 00:02:15,000
|
| 135 |
+
Let me add spaces here in the Hello World File.
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:17,000 --> 00:02:23,000
|
| 139 |
+
And I save this file now, I will add changes to the staging area and we'll make a commit the spaces
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:23,000 --> 00:02:25,000
|
| 143 |
+
were added to the hello world file.
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:33,000 --> 00:02:37,000
|
| 147 |
+
After I created the command, I pushed it to the remote ranch.
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:40,000 --> 00:02:45,000
|
| 151 |
+
To create a pull request, you have to have two branches, and right now we have massive branch and
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:45,000 --> 00:02:47,000
|
| 155 |
+
our task branch nice.
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:48,000 --> 00:02:50,000
|
| 159 |
+
There are a lot of different ways to create a pull request.
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:51,000 --> 00:02:52,000
|
| 163 |
+
Let me show you one of them.
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:02:52,000 --> 00:02:54,000
|
| 167 |
+
Click on Pull Request tab here.
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:02:54,000 --> 00:02:57,000
|
| 171 |
+
Now click on the new pull request button.
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:02:57,000 --> 00:03:01,000
|
| 175 |
+
And here you have to specify which branch you want to pull into which branch.
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:01,000 --> 00:03:07,000
|
| 179 |
+
In our case, Master is a main development branch dependent on the branch and strategy that you are
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:07,000 --> 00:03:08,000
|
| 183 |
+
going to have at your work.
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:09,000 --> 00:03:14,000
|
| 187 |
+
You might have development branches and development branch and Master Branch will be used only for releases.
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:15,000 --> 00:03:19,000
|
| 191 |
+
In our particular case, we want to merge Task One branch into master.
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:19,000 --> 00:03:24,000
|
| 195 |
+
That's why here I select a task one and here I have Master Branch.
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:24,000 --> 00:03:28,000
|
| 199 |
+
Here you will see the difference between the state of these two branches.
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:28,000 --> 00:03:30,000
|
| 203 |
+
Let's create a pull request.
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:30,000 --> 00:03:35,000
|
| 207 |
+
Additionally, you may specify pull request description here on the right.
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:35,000 --> 00:03:38,000
|
| 211 |
+
You can specify, pull, request, review and request.
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:38,000 --> 00:03:40,000
|
| 215 |
+
Ehsani What is a defense review?
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:41,000 --> 00:03:43,000
|
| 219 |
+
What is someone you want to review the code?
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:43,000 --> 00:03:49,000
|
| 223 |
+
And this can be the person who is not necessarily responsible for merging branches, probably colleagues
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:03:49,000 --> 00:03:52,000
|
| 227 |
+
of yours or software engineers from another development team.
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:03:53,000 --> 00:03:55,000
|
| 231 |
+
But who needs to be aware of changes in your project?
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:03:56,000 --> 00:04:01,000
|
| 235 |
+
On the other hand, think is someone who is responsible for emergencies, quote, this can be a tech
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:04:01,000 --> 00:04:07,000
|
| 239 |
+
lead on your project or owner of the repository who is in charge of margin call to the master branch
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:07,000 --> 00:04:08,000
|
| 243 |
+
later today.
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:08,000 --> 00:04:16,000
|
| 247 |
+
I will show you how you can add me as an EHSANI right now, just click, reply, request button and
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:16,000 --> 00:04:19,000
|
| 251 |
+
pull request is created on this tab.
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:19,000 --> 00:04:21,000
|
| 255 |
+
You can see what commands you have on your branch.
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:22,000 --> 00:04:27,000
|
| 259 |
+
On this type, you can see what files were changed in comparison with the branch where you want to major
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:27,000 --> 00:04:28,000
|
| 263 |
+
changes.
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:29,000 --> 00:04:31,000
|
| 267 |
+
We can see that there are two changes.
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:31,000 --> 00:04:35,000
|
| 271 |
+
New file is created and the spaces are added to the hello world file.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:36,000 --> 00:04:43,000
|
| 275 |
+
Azanian reviewers will go over all your changes to investigate what exactly is changed in your pull
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:04:43,000 --> 00:04:43,000
|
| 279 |
+
request.
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:04:44,000 --> 00:04:47,000
|
| 283 |
+
Review process can leave commands here and the specific lines of code.
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:04:48,000 --> 00:04:51,000
|
| 287 |
+
For example, why so many spaces here?
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:04:52,000 --> 00:04:58,000
|
| 291 |
+
And the discussions have to be resolved, all my students who works with me offline assigned me to the
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:04:58,000 --> 00:05:05,000
|
| 295 |
+
airport requests and during the offline lessons we reuseable request together and discuss with the group
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:05:05,000 --> 00:05:06,000
|
| 299 |
+
what can be improved.
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:06,000 --> 00:05:10,000
|
| 303 |
+
Let me also teach you how to admit to your request as an EHSANI.
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:11,000 --> 00:05:16,000
|
| 307 |
+
I don't guarantee that I will be able to check each year request because for homework verification,
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:16,000 --> 00:05:21,000
|
| 311 |
+
I use special type of tasks, coding exercises that verifies your homework automatically.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:22,000 --> 00:05:24,000
|
| 315 |
+
But you can learn at least how to read me here.
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:24,000 --> 00:05:30,000
|
| 319 |
+
As I say, click the settings button next click manage access.
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:30,000 --> 00:05:36,000
|
| 323 |
+
You might be asked to enter your password and I believe you understood that this is project specific
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:36,000 --> 00:05:37,000
|
| 327 |
+
settings.
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:37,000 --> 00:05:43,000
|
| 331 |
+
So in case you want to add collaborator's to your another project, you should open settings of that
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:05:43,000 --> 00:05:44,000
|
| 335 |
+
exact repository.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:05:44,000 --> 00:05:47,000
|
| 339 |
+
Let's add me as a collaborator to your repository.
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:05:47,000 --> 00:05:50,000
|
| 343 |
+
Press this green button, invite a collaborator.
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:05:50,000 --> 00:05:54,000
|
| 347 |
+
You can find me using my nickname and repetoire.
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:05:54,000 --> 00:05:59,000
|
| 351 |
+
I can't find myself because this is against the rules and this doesn't make sense.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:05:59,000 --> 00:06:01,000
|
| 355 |
+
But I can find one of my friends.
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:06:02,000 --> 00:06:06,000
|
| 359 |
+
For example, let me find a friend of mine with the nickname Sweater Matko.
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:07,000 --> 00:06:12,000
|
| 363 |
+
Similarly, you have to find my picture, click on it and press green button.
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:12,000 --> 00:06:14,000
|
| 367 |
+
That is the rule of the GitHub.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:14,000 --> 00:06:16,000
|
| 371 |
+
Always press the green button.
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:16,000 --> 00:06:17,000
|
| 375 |
+
Just joking.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:18,000 --> 00:06:24,000
|
| 379 |
+
I will not add Anri because I don't want to spam him because after I press green button and we should
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:24,000 --> 00:06:31,000
|
| 383 |
+
receive request to become a collaborator in my repository and he also has to approve this request and
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:06:31,000 --> 00:06:36,000
|
| 387 |
+
only after he approved the request, only after that you will be able to find him in.
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:06:37,000 --> 00:06:42,000
|
| 391 |
+
You drop down for your pull request to navigate back to your open request.
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:06:42,000 --> 00:06:44,000
|
| 395 |
+
You can open pull requests tab.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:06:44,000 --> 00:06:46,000
|
| 399 |
+
And here is our fresh PR.
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:06:46,000 --> 00:06:50,000
|
| 403 |
+
I can procedure, I can and assign this request to myself.
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:06:50,000 --> 00:06:52,000
|
| 407 |
+
OK, let's proceed.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:06:52,000 --> 00:06:58,000
|
| 411 |
+
As I mentioned, reviewers and Ehsani check your piara and once all discussions are resolved as an emergency
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:06:59,000 --> 00:07:03,000
|
| 415 |
+
request by pressing this button, this March button has three methods.
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:03,000 --> 00:07:05,000
|
| 419 |
+
They are great American.
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:05,000 --> 00:07:09,000
|
| 423 |
+
Commit squash and merge rebase and merge.
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:09,000 --> 00:07:14,000
|
| 427 |
+
Keeping the clean data repository is one of the top priority tasks for all contributors.
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:14,000 --> 00:07:20,000
|
| 431 |
+
That clean the tree can save you a lot of time when trying to track down comments related to embark
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:20,000 --> 00:07:24,000
|
| 435 |
+
or issue the default option, which is create a much.
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:24,000 --> 00:07:29,000
|
| 439 |
+
It will take all comments from the PR and add them to the master brunch with a new it.
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:07:30,000 --> 00:07:31,000
|
| 443 |
+
Let's take a look at this slide.
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:07:32,000 --> 00:07:35,000
|
| 447 |
+
Imagine that there is a main branch we have in it.
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:07:35,000 --> 00:07:37,000
|
| 451 |
+
Commit and commit one and two.
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:07:38,000 --> 00:07:43,000
|
| 455 |
+
You created your feature branch and that branch we created commits three and four.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:07:44,000 --> 00:07:50,000
|
| 459 |
+
You prepared to request and now we select default option from merging comments and you see that you
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:07:50,000 --> 00:07:57,000
|
| 463 |
+
can it will be created on the master branch, the commit that you will look like this merge some specific
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:07:57,000 --> 00:07:57,000
|
| 467 |
+
branch.
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:07:57,000 --> 00:07:58,000
|
| 471 |
+
That's it.
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:07:59,000 --> 00:08:04,000
|
| 475 |
+
The result message is not very helpful when you will try to understand what this comment is about.
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:08:04,000 --> 00:08:07,000
|
| 479 |
+
That's why this is not a recommended option by many developers.
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:08,000 --> 00:08:13,000
|
| 483 |
+
We want to keep our gate historically and imagine the same case, but this time we would select the
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:13,000 --> 00:08:15,000
|
| 487 |
+
second possible option, which is squash and match.
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:16,000 --> 00:08:22,000
|
| 491 |
+
What is going to happen in this case, commence three and four will be added to the master branch.
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:22,000 --> 00:08:29,000
|
| 495 |
+
What will happen is that Cummins will become blind and any other commit message can be added comit four
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:08:29,000 --> 00:08:36,000
|
| 499 |
+
will be squashed into three and we will give any message we like with the help of GitHub interface and
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:08:36,000 --> 00:08:39,000
|
| 503 |
+
what will happen in case I will opt for the search option.
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:08:39,000 --> 00:08:46,000
|
| 507 |
+
Ribis and merge neurons are based in our commands are put on top of the master branch like you see on
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:08:46,000 --> 00:08:47,000
|
| 511 |
+
this slide.
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:08:47,000 --> 00:08:48,000
|
| 515 |
+
Come in three and four.
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:08:48,000 --> 00:08:51,000
|
| 519 |
+
I just put on the top of the Master Branch.
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:08:51,000 --> 00:08:53,000
|
| 523 |
+
Definitely attack.
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:08:53,000 --> 00:08:55,000
|
| 527 |
+
It will choose strategies that you have to follow.
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:08:55,000 --> 00:09:00,000
|
| 531 |
+
But my personal preference is rebase and match is not squash and much.
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:09:01,000 --> 00:09:07,000
|
| 535 |
+
I believe if a developer wants to squash Kummetz, he or she has to do that locally in the local repository
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:09:07,000 --> 00:09:11,000
|
| 539 |
+
before even pushing branch to the remote repository, but not ask us.
|
| 540 |
+
|
| 541 |
+
136
|
| 542 |
+
00:09:11,000 --> 00:09:16,000
|
| 543 |
+
I need to squash your comments, but I also met tech leads that would prefer squash and match.
|
| 544 |
+
|
| 545 |
+
137
|
| 546 |
+
00:09:16,000 --> 00:09:22,000
|
| 547 |
+
Rather than teach engineers how to write Canete messages and how to do squash later in this course,
|
| 548 |
+
|
| 549 |
+
138
|
| 550 |
+
00:09:22,000 --> 00:09:24,000
|
| 551 |
+
I will show you how you can squash Kummetz.
|
| 552 |
+
|
| 553 |
+
139
|
| 554 |
+
00:09:25,000 --> 00:09:31,000
|
| 555 |
+
Being a project owner, you can disable much methods that you don't like to do that, click on the settings
|
| 556 |
+
|
| 557 |
+
140
|
| 558 |
+
00:09:31,000 --> 00:09:38,000
|
| 559 |
+
button and scroll page to the bottom, find merge button and uncheck methods that you don't need.
|
| 560 |
+
|
| 561 |
+
141
|
| 562 |
+
00:09:43,000 --> 00:09:49,000
|
| 563 |
+
And if I would open my paper one more time, I can see that I have only one option available.
|
| 564 |
+
|
| 565 |
+
142
|
| 566 |
+
00:09:49,000 --> 00:09:52,000
|
| 567 |
+
Let me select the third method and close my pull request.
|
| 568 |
+
|
| 569 |
+
143
|
| 570 |
+
00:09:58,000 --> 00:09:58,000
|
| 571 |
+
Awesome.
|
| 572 |
+
|
| 573 |
+
144
|
| 574 |
+
00:09:59,000 --> 00:10:05,000
|
| 575 |
+
Now, you can delete the task branch because it is not needed anymore in remote repository, since you
|
| 576 |
+
|
| 577 |
+
145
|
| 578 |
+
00:10:05,000 --> 00:10:11,000
|
| 579 |
+
have already merged into the master branch and to not confuse anyone, let's remove it.
|
| 580 |
+
|
| 581 |
+
146
|
| 582 |
+
00:10:16,000 --> 00:10:20,000
|
| 583 |
+
You can see that there is no task branch anymore in our remote repository.
|
| 584 |
+
|
| 585 |
+
147
|
| 586 |
+
00:10:21,000 --> 00:10:26,000
|
| 587 |
+
Now our request is closed and we can check our current history of the master branch.
|
| 588 |
+
|
| 589 |
+
148
|
| 590 |
+
00:10:27,000 --> 00:10:30,000
|
| 591 |
+
Make sure you are on the master branch and click here on Kummetz.
|
| 592 |
+
|
| 593 |
+
149
|
| 594 |
+
00:10:31,000 --> 00:10:37,000
|
| 595 |
+
And we see that no other comments from Ergin were created on the committees that were created by us.
|
| 596 |
+
|
| 597 |
+
150
|
| 598 |
+
00:10:38,000 --> 00:10:38,000
|
| 599 |
+
Great.
|
| 600 |
+
|
| 601 |
+
151
|
| 602 |
+
00:10:39,000 --> 00:10:44,000
|
| 603 |
+
I believe now we can recap everything, what we have learned today in this lesson, we learned what
|
| 604 |
+
|
| 605 |
+
152
|
| 606 |
+
00:10:44,000 --> 00:10:49,000
|
| 607 |
+
a pull request is and what is the difference between a pull request and a magic quest.
|
| 608 |
+
|
| 609 |
+
153
|
| 610 |
+
00:10:49,000 --> 00:10:52,000
|
| 611 |
+
Together, we created a pull request.
|
| 612 |
+
|
| 613 |
+
154
|
| 614 |
+
00:10:52,000 --> 00:10:57,000
|
| 615 |
+
I showed you how you can add collaborator's to the repository and we discussed what is the difference
|
| 616 |
+
|
| 617 |
+
155
|
| 618 |
+
00:10:57,000 --> 00:11:00,000
|
| 619 |
+
between us any and reviewer and two requests.
|
| 620 |
+
|
| 621 |
+
156
|
| 622 |
+
00:11:00,000 --> 00:11:05,000
|
| 623 |
+
Also today, we learned different management strategies and understood the difference between them.
|
| 624 |
+
|
| 625 |
+
157
|
| 626 |
+
00:11:06,000 --> 00:11:07,000
|
| 627 |
+
That's all for now.
|
| 628 |
+
|
| 629 |
+
158
|
| 630 |
+
00:11:07,000 --> 00:11:10,000
|
| 631 |
+
Thanks a lot for your attention and see you in the next lesson.
|
| 632 |
+
|
17 - GIT/011 Updating local repository (fetch, merge, pull) & Team development demo_en.srt
ADDED
|
@@ -0,0 +1,712 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1
|
| 2 |
+
00:00:06,000 --> 00:00:10,000
|
| 3 |
+
Hello, dear students in this class, and I'll teach you how you can update your local repository.
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:10,000 --> 00:00:16,000
|
| 7 |
+
Today, I will explain to you why we need to update our local repository, how often we have to do that
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:16,000 --> 00:00:17,000
|
| 11 |
+
and what commands we have to use.
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:18,000 --> 00:00:23,000
|
| 15 |
+
Today, I prepared a special demo with the and flow in which I will show you commands that you are going
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:23,000 --> 00:00:25,000
|
| 19 |
+
to use in most cases at your work.
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:26,000 --> 00:00:30,000
|
| 23 |
+
I will tell you today, more and more to get fetch, get Merche, get pool commands.
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:30,000 --> 00:00:33,000
|
| 27 |
+
Also, I will explain what does Fastforward mean.
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:34,000 --> 00:00:36,000
|
| 31 |
+
We are going to learn a lot today.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:36,000 --> 00:00:42,000
|
| 35 |
+
Let's start first of all, let's answer the question why we have to update our local repository.
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:42,000 --> 00:00:47,000
|
| 39 |
+
We have to update our local repository because we want to be sure that the codes that we created will
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:47,000 --> 00:00:49,000
|
| 43 |
+
work with other the court as expected.
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:49,000 --> 00:00:54,000
|
| 47 |
+
That is the most important reason of updating local repository as often as we can.
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:54,000 --> 00:00:56,000
|
| 51 |
+
To what situations?
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:00:56,000 --> 00:01:01,000
|
| 55 |
+
When you work on some task for one week or two weeks and when you need to merge your code with Master
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:01:01,000 --> 00:01:04,000
|
| 59 |
+
Branch, you discover multiple conflicts in your code.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:01:04,000 --> 00:01:09,000
|
| 63 |
+
Today, I will show you command and real examples how you can update your local repository.
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:09,000 --> 00:01:13,000
|
| 67 |
+
In previous lesson, you learned how to prepare people request and merge changes.
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:13,000 --> 00:01:19,000
|
| 71 |
+
Now let's imagine that you successfully completed your previous task and you are about to start your
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:19,000 --> 00:01:20,000
|
| 75 |
+
work on the new task.
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:20,000 --> 00:01:24,000
|
| 79 |
+
Right now, in my local repository, I I'm on the task branch.
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:24,000 --> 00:01:29,000
|
| 83 |
+
We already know that to start work on the new task and to separate code one from another, I have to
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:29,000 --> 00:01:30,000
|
| 87 |
+
create a new branch.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:31,000 --> 00:01:35,000
|
| 91 |
+
Usually I want to create a new branch from the latest version of the source code.
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:35,000 --> 00:01:37,000
|
| 95 |
+
So let me switch the master branch.
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:38,000 --> 00:01:43,000
|
| 99 |
+
OK, I'm on the master branch, but do I have the latest version of my code here?
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:44,000 --> 00:01:49,000
|
| 103 |
+
Let me navigate the SASE folder and check whether I have all the latest updates on this branch.
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:49,000 --> 00:01:53,000
|
| 107 |
+
To navigate to the SRT folder, I have to type CGY SAAC.
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:54,000 --> 00:02:03,000
|
| 111 |
+
OK, now let's list all the files else that shall and you see that we don't have this calculation service
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:02:03,000 --> 00:02:08,000
|
| 115 |
+
here, why I'm on the Master Branch and we merged our changes with the master branch.
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:02:08,000 --> 00:02:15,000
|
| 119 |
+
And the previous lesson, let's not confuse two things Master Branch and a region master branch.
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:15,000 --> 00:02:20,000
|
| 123 |
+
And previous lesson when the merged request was called to the region master branch.
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:21,000 --> 00:02:24,000
|
| 127 |
+
But we didn't merge, got into our master branch.
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:24,000 --> 00:02:25,000
|
| 131 |
+
So what to do now?
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:26,000 --> 00:02:32,000
|
| 135 |
+
Now we are going to learn a few commands, get fetch what is good for each command.
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:32,000 --> 00:02:38,000
|
| 139 |
+
This command fetches all changes from the remote repository and put it in your local repository one
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:38,000 --> 00:02:39,000
|
| 143 |
+
more time.
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:39,000 --> 00:02:44,000
|
| 147 |
+
Important thing to mention here is that changes are not matched to your local branches.
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:44,000 --> 00:02:51,000
|
| 151 |
+
So in case some comments in the region Master Branch exist, which a local repository is not aware of,
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:51,000 --> 00:02:56,000
|
| 155 |
+
PFEG Command will save information about these changes in your local repository.
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:56,000 --> 00:02:58,000
|
| 159 |
+
Let me press enter now.
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:58,000 --> 00:03:03,000
|
| 163 |
+
Based on the log messages here, we can conclude that some changes were downloaded from the remote.
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:03:04,000 --> 00:03:10,000
|
| 167 |
+
OK, probably now I have all the latest changes in my branch, including new file, discount calculation
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:03:10,000 --> 00:03:13,000
|
| 171 |
+
service and all the latest changes from the Hello World File.
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:03:13,000 --> 00:03:16,000
|
| 175 |
+
Let me check it one more time as well.
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:17,000 --> 00:03:20,000
|
| 179 |
+
And again, I don't have any latest updates.
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:20,000 --> 00:03:21,000
|
| 183 |
+
Why?
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:21,000 --> 00:03:27,000
|
| 187 |
+
Because I have just downloaded information about these changes, but I didn't actually merge these changes
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:27,000 --> 00:03:28,000
|
| 191 |
+
in the local branch.
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:29,000 --> 00:03:31,000
|
| 195 |
+
Then what is the purpose of this command at all?
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:32,000 --> 00:03:37,000
|
| 199 |
+
Imagine that you are working on the new changes and I don't want to merge latest code into your branch.
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:37,000 --> 00:03:39,000
|
| 203 |
+
Do not break anything.
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:39,000 --> 00:03:44,000
|
| 207 |
+
And you would like to know whether there are any changes in remote branch that are needed to be merged.
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:45,000 --> 00:03:47,000
|
| 211 |
+
One more use case of using it for each command.
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:48,000 --> 00:03:53,000
|
| 215 |
+
You can fetch changes while sitting in the office and the security VPN connection and you can merge
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:53,000 --> 00:03:58,000
|
| 219 |
+
carefully your code later when you want while sitting on your cozy chair at your home.
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:59,000 --> 00:04:02,000
|
| 223 |
+
But what if I am already at my home sitting on the couch?
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:04:03,000 --> 00:04:04,000
|
| 227 |
+
What do I have to do now?
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:04:05,000 --> 00:04:10,000
|
| 231 |
+
Now I have to merge these changes into my local branch, so I'm doing it.
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:04:10,000 --> 00:04:12,000
|
| 235 |
+
Merge command gate.
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:04:12,000 --> 00:04:12,000
|
| 239 |
+
Merge.
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:13,000 --> 00:04:14,000
|
| 243 |
+
Awesome.
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:14,000 --> 00:04:20,000
|
| 247 |
+
It looks like some changes have been merged with my master branch, I see Fastforward message here.
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:21,000 --> 00:04:22,000
|
| 251 |
+
What does that mean?
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:23,000 --> 00:04:29,000
|
| 255 |
+
And fast forward is what it does when you merge or a base against a branch that is simply ahead, the
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:29,000 --> 00:04:30,000
|
| 259 |
+
one you have checked out.
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:31,000 --> 00:04:38,000
|
| 263 |
+
That means there was no branches and that is the new value of the branch is a direct descendant of the
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:38,000 --> 00:04:39,000
|
| 267 |
+
prior values.
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:39,000 --> 00:04:46,000
|
| 271 |
+
So we had a region master branch that contains commands that are descendant of our previous master branch.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:46,000 --> 00:04:52,000
|
| 275 |
+
That's why we call such merging as fast forward now when we have merged the latest updates.
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:04:52,000 --> 00:04:56,000
|
| 279 |
+
Let me check list of files and dash I'll command.
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:04:57,000 --> 00:04:57,000
|
| 283 |
+
Wow.
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:04:57,000 --> 00:05:01,000
|
| 287 |
+
Finally, I have this calculation service file in my file system.
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:05:01,000 --> 00:05:05,000
|
| 291 |
+
That is the latest changes that have emerged in the remote repository.
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:05:05,000 --> 00:05:07,000
|
| 295 |
+
Let me also check that update from Hello.
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:05:07,000 --> 00:05:09,000
|
| 299 |
+
World File is also in place.
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:09,000 --> 00:05:14,000
|
| 303 |
+
And previously we updated Hillenburg file and put extra lines in it.
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:14,000 --> 00:05:17,000
|
| 307 |
+
Let me open this file in a text editor.
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:17,000 --> 00:05:18,000
|
| 311 |
+
Nana.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:18,000 --> 00:05:20,000
|
| 315 |
+
Hello, World Dodgeville.
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:20,000 --> 00:05:21,000
|
| 319 |
+
Nice.
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:21,000 --> 00:05:24,000
|
| 323 |
+
I see only one characters outplays place here.
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:24,000 --> 00:05:30,000
|
| 327 |
+
Let me exit now Ed by pressing control and simultaneously as described here.
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:31,000 --> 00:05:38,000
|
| 331 |
+
Now, I want you to learn one more command that is good, but what is it command essentially getable
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:05:38,000 --> 00:05:41,000
|
| 335 |
+
is a combination of two actions, PFEG and March.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:05:42,000 --> 00:05:47,000
|
| 339 |
+
So in case you want to fetch all changes from the remote repository and at the same time merge them
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:05:47,000 --> 00:05:50,000
|
| 343 |
+
into the branch you have to use to command.
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:05:50,000 --> 00:05:52,000
|
| 347 |
+
You're our demo today.
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:05:52,000 --> 00:05:56,000
|
| 351 |
+
I want to show you real life scenarios that will happen with you on your workplace.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:05:56,000 --> 00:06:02,000
|
| 355 |
+
I want you not to learn just commands, but understand how you will use it while working with steam.
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:06:02,000 --> 00:06:08,000
|
| 359 |
+
The name of this I prepared enter and flow that will show you the full scenario of what we learned so
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:08,000 --> 00:06:08,000
|
| 363 |
+
far.
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:09,000 --> 00:06:11,000
|
| 367 |
+
And I want you to be ready.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:11,000 --> 00:06:16,000
|
| 371 |
+
I want you to understand how team development is happening together.
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:16,000 --> 00:06:18,000
|
| 375 |
+
We're going to imitate the next generation.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:19,000 --> 00:06:23,000
|
| 379 |
+
Imagine that we work on the implementation of virtual card in our online shop.
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:24,000 --> 00:06:25,000
|
| 383 |
+
We are working on this task.
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:06:26,000 --> 00:06:32,000
|
| 387 |
+
At the same time, developer number two works on the implementation of service that will provide functionality
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:06:32,000 --> 00:06:33,000
|
| 391 |
+
of stock management.
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:06:34,000 --> 00:06:38,000
|
| 395 |
+
Both engineers created the branch from the same revision, from the same command.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:06:39,000 --> 00:06:43,000
|
| 399 |
+
After that we created bool request and our changes were successfully merged.
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:06:43,000 --> 00:06:49,000
|
| 403 |
+
And after that, developer number two created Pulu request and his request was successfully matched.
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:06:49,000 --> 00:06:56,000
|
| 407 |
+
After that, we want to proceed with implementation of the next task product preservation, let's say.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:06:56,000 --> 00:07:02,000
|
| 411 |
+
But before start work on the new task, we have to pull all the latest changes to create the branch
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:07:02,000 --> 00:07:03,000
|
| 415 |
+
with the latest updates.
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:03,000 --> 00:07:06,000
|
| 419 |
+
And we have to execute get command.
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:07,000 --> 00:07:11,000
|
| 423 |
+
Hope you you're not confused, but I want you to be prepared for the real life.
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:11,000 --> 00:07:14,000
|
| 427 |
+
And this is the easiest real life scenario with only two developers.
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:15,000 --> 00:07:18,000
|
| 431 |
+
Let them together, try to reproduce this in error.
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:18,000 --> 00:07:21,000
|
| 435 |
+
So we are going to have next steps.
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:21,000 --> 00:07:28,000
|
| 439 |
+
Developer one and two created branches and the changes after that, both engineers created peers that
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:07:28,000 --> 00:07:31,000
|
| 443 |
+
were a match to the original master branch developer.
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:07:31,000 --> 00:07:34,000
|
| 447 |
+
One post latest changes to start work on the new task.
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:07:35,000 --> 00:07:35,000
|
| 451 |
+
Let's start.
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:07:36,000 --> 00:07:38,000
|
| 455 |
+
Here is what we are going to do on our book.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:07:39,000 --> 00:07:41,000
|
| 459 |
+
Let's check the status of the master branch.
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:07:42,000 --> 00:07:45,000
|
| 463 |
+
So it is up to date with the region masterbrand.
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:07:45,000 --> 00:07:46,000
|
| 467 |
+
Cool.
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:07:46,000 --> 00:07:55,000
|
| 471 |
+
Now let me create a new branch gates, which was option C G, a three zero to virtual car with which
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:07:55,000 --> 00:07:56,000
|
| 475 |
+
to the new branch.
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:07:57,000 --> 00:07:59,000
|
| 479 |
+
Let's imitate implementation of this task.
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:07:59,000 --> 00:08:04,000
|
| 483 |
+
I will create a special directory called Card and Mkdir Card.
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:06,000 --> 00:08:08,000
|
| 487 |
+
Here is a command that creates a directory.
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:09,000 --> 00:08:13,000
|
| 491 |
+
Now let's navigate into this directory, S.A.G. cars.
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:14,000 --> 00:08:19,000
|
| 495 |
+
Now let's create card management service file and we will pretend that there is a task implemented in
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:08:19,000 --> 00:08:20,000
|
| 499 |
+
this file.
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:08:21,000 --> 00:08:23,000
|
| 503 |
+
Darch Card Management Service Dajarra.
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:08:24,000 --> 00:08:31,000
|
| 507 |
+
By the way, you can't push and commit only folder's if you want to set some basic folder structure
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:08:31,000 --> 00:08:32,000
|
| 511 |
+
for your program.
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:08:32,000 --> 00:08:34,000
|
| 515 |
+
There should be files in these folders.
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:08:35,000 --> 00:08:40,000
|
| 519 |
+
OK, now let's add this to Sustagen yet at DOT and commit this change.
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:08:41,000 --> 00:08:45,000
|
| 523 |
+
Yet commit dash and card management is implemented.
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:08:50,000 --> 00:08:58,000
|
| 527 |
+
OK, we have a comment now let's push it to our region, yet push the our region keets three zero to
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:08:58,000 --> 00:08:59,000
|
| 531 |
+
your troll car.
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:09:03,000 --> 00:09:05,000
|
| 535 |
+
We'll create a pull request now.
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:09:05,000 --> 00:09:10,000
|
| 539 |
+
Give me a few seconds here, you already know how to create a PR from the previous lesson.
|
| 540 |
+
|
| 541 |
+
136
|
| 542 |
+
00:09:17,000 --> 00:09:20,000
|
| 543 |
+
PR is created what we want merge, they scored so far.
|
| 544 |
+
|
| 545 |
+
137
|
| 546 |
+
00:09:21,000 --> 00:09:26,000
|
| 547 |
+
Meanwhile, developer number two created a separate branch to implement stock management.
|
| 548 |
+
|
| 549 |
+
138
|
| 550 |
+
00:09:30,000 --> 00:09:37,000
|
| 551 |
+
OK, the same as here developer number two and the master branch and in the SLC directory, he wants
|
| 552 |
+
|
| 553 |
+
139
|
| 554 |
+
00:09:37,000 --> 00:09:44,000
|
| 555 |
+
to start work on the new task and create a new branch Gates, which is option C, a three zero three
|
| 556 |
+
|
| 557 |
+
140
|
| 558 |
+
00:09:44,000 --> 00:09:45,000
|
| 559 |
+
stock management.
|
| 560 |
+
|
| 561 |
+
141
|
| 562 |
+
00:09:45,000 --> 00:09:50,000
|
| 563 |
+
Let's create a new folder in the SAAC directory mkdir stock.
|
| 564 |
+
|
| 565 |
+
142
|
| 566 |
+
00:09:51,000 --> 00:09:54,000
|
| 567 |
+
Right now I create a directory in the search folder.
|
| 568 |
+
|
| 569 |
+
143
|
| 570 |
+
00:09:54,000 --> 00:09:57,000
|
| 571 |
+
Let me navigate their C.G. stock.
|
| 572 |
+
|
| 573 |
+
144
|
| 574 |
+
00:09:58,000 --> 00:10:00,000
|
| 575 |
+
OK, I'm here now.
|
| 576 |
+
|
| 577 |
+
145
|
| 578 |
+
00:10:00,000 --> 00:10:08,000
|
| 579 |
+
Let me create a file Derg Stock Management Service Dot Java cuz that and this file to the staging area
|
| 580 |
+
|
| 581 |
+
146
|
| 582 |
+
00:10:09,000 --> 00:10:16,000
|
| 583 |
+
get at dot and now let's commit yet command dash and stock management is implemented.
|
| 584 |
+
|
| 585 |
+
147
|
| 586 |
+
00:10:18,000 --> 00:10:25,000
|
| 587 |
+
And let's push it to the remote, get push there for you, originally, a three zero three stock management.
|
| 588 |
+
|
| 589 |
+
148
|
| 590 |
+
00:10:27,000 --> 00:10:30,000
|
| 591 |
+
Now I have to create a request for this change.
|
| 592 |
+
|
| 593 |
+
149
|
| 594 |
+
00:10:39,000 --> 00:10:41,000
|
| 595 |
+
Let us manage to pull requests now.
|
| 596 |
+
|
| 597 |
+
150
|
| 598 |
+
00:10:58,000 --> 00:11:05,000
|
| 599 |
+
And you see that quote in Monster is updated in caves during the new task, implementation you would
|
| 600 |
+
|
| 601 |
+
151
|
| 602 |
+
00:11:05,000 --> 00:11:08,000
|
| 603 |
+
need is a correct management service or stock management service.
|
| 604 |
+
|
| 605 |
+
152
|
| 606 |
+
00:11:08,000 --> 00:11:14,000
|
| 607 |
+
It is better for you to learn it earlier, because, first of all, probably you're going to use this
|
| 608 |
+
|
| 609 |
+
153
|
| 610 |
+
00:11:14,000 --> 00:11:18,000
|
| 611 |
+
court or this court might break your court anyway.
|
| 612 |
+
|
| 613 |
+
154
|
| 614 |
+
00:11:19,000 --> 00:11:25,000
|
| 615 |
+
It is better to have all changes from all developers on place in your local repository before start
|
| 616 |
+
|
| 617 |
+
155
|
| 618 |
+
00:11:25,000 --> 00:11:26,000
|
| 619 |
+
any new work.
|
| 620 |
+
|
| 621 |
+
156
|
| 622 |
+
00:11:26,000 --> 00:11:31,000
|
| 623 |
+
And finally, we return to the main branch and want to start work on the new task.
|
| 624 |
+
|
| 625 |
+
157
|
| 626 |
+
00:11:32,000 --> 00:11:37,000
|
| 627 |
+
But right now, we have to make sure that we have the latest changes in the master branch before create
|
| 628 |
+
|
| 629 |
+
158
|
| 630 |
+
00:11:37,000 --> 00:11:38,000
|
| 631 |
+
a new branch.
|
| 632 |
+
|
| 633 |
+
159
|
| 634 |
+
00:11:39,000 --> 00:11:45,000
|
| 635 |
+
OK, what we have to do now, probably you would say get pfeg and get merge, but let's execute git
|
| 636 |
+
|
| 637 |
+
160
|
| 638 |
+
00:11:45,000 --> 00:11:46,000
|
| 639 |
+
pull command.
|
| 640 |
+
|
| 641 |
+
161
|
| 642 |
+
00:11:48,000 --> 00:11:55,000
|
| 643 |
+
Awesome, we pulled our changes and we are ready to work on the new task you see here, I pulled card
|
| 644 |
+
|
| 645 |
+
162
|
| 646 |
+
00:11:55,000 --> 00:12:00,000
|
| 647 |
+
management service and stock management service and you see that we don't necessarily have to do get
|
| 648 |
+
|
| 649 |
+
163
|
| 650 |
+
00:12:00,000 --> 00:12:01,000
|
| 651 |
+
pfeg.
|
| 652 |
+
|
| 653 |
+
164
|
| 654 |
+
00:12:01,000 --> 00:12:02,000
|
| 655 |
+
And after that it gets merged.
|
| 656 |
+
|
| 657 |
+
165
|
| 658 |
+
00:12:02,000 --> 00:12:06,000
|
| 659 |
+
Command get combines these two commands into one.
|
| 660 |
+
|
| 661 |
+
166
|
| 662 |
+
00:12:06,000 --> 00:12:11,000
|
| 663 |
+
I can check my card and stock directory and find files there, you see.
|
| 664 |
+
|
| 665 |
+
167
|
| 666 |
+
00:12:12,000 --> 00:12:18,000
|
| 667 |
+
We finished our practice exercise, Holmes's A Small Demo will help you to understand how we can use
|
| 668 |
+
|
| 669 |
+
168
|
| 670 |
+
00:12:18,000 --> 00:12:18,000
|
| 671 |
+
it.
|
| 672 |
+
|
| 673 |
+
169
|
| 674 |
+
00:12:18,000 --> 00:12:21,000
|
| 675 |
+
You're the game collaboration and new task implementation.
|
| 676 |
+
|
| 677 |
+
170
|
| 678 |
+
00:12:22,000 --> 00:12:24,000
|
| 679 |
+
Let's recap what we have learned today.
|
| 680 |
+
|
| 681 |
+
171
|
| 682 |
+
00:12:25,000 --> 00:12:28,000
|
| 683 |
+
Today, we learned why we need to update our local repository.
|
| 684 |
+
|
| 685 |
+
172
|
| 686 |
+
00:12:28,000 --> 00:12:32,000
|
| 687 |
+
We also learned to get Fairgate marriage and get boogerman.
|
| 688 |
+
|
| 689 |
+
173
|
| 690 |
+
00:12:32,000 --> 00:12:38,000
|
| 691 |
+
Now you know that you have to update your master branch before you start working on each new task.
|
| 692 |
+
|
| 693 |
+
174
|
| 694 |
+
00:12:38,000 --> 00:12:44,000
|
| 695 |
+
You also understand the difference between a get FEG marriage and pull commence today.
|
| 696 |
+
|
| 697 |
+
175
|
| 698 |
+
00:12:44,000 --> 00:12:50,000
|
| 699 |
+
So what is fastforward in it and at the end of the lesson I showed you and flow of how team development
|
| 700 |
+
|
| 701 |
+
176
|
| 702 |
+
00:12:50,000 --> 00:12:52,000
|
| 703 |
+
is look like with the help of the get.
|
| 704 |
+
|
| 705 |
+
177
|
| 706 |
+
00:12:53,000 --> 00:12:54,000
|
| 707 |
+
Thanks a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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1
|
| 2 |
+
00:00:06,000 --> 00:00:11,000
|
| 3 |
+
Hello, yes, students, in this lesson, you learn what most conflicts are in simple words, I will
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:11,000 --> 00:00:17,000
|
| 7 |
+
explain in one, much conflicts could appear together, will reproduce real life scenarios, merge conflict.
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:17,000 --> 00:00:23,000
|
| 11 |
+
And what is even more interesting, I will tell you how to solve major conflicts together during the
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:23,000 --> 00:00:23,000
|
| 15 |
+
drama.
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:23,000 --> 00:00:28,000
|
| 19 |
+
We are going to solve much conflict that will appear during the pulling from the remote repository.
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:28,000 --> 00:00:32,000
|
| 23 |
+
And as usual, let's together give a definition to the conflict.
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:33,000 --> 00:00:39,000
|
| 27 |
+
The conflict is a specific event that takes place when it is unable to resolve differences in code between
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:39,000 --> 00:00:40,000
|
| 31 |
+
two commits automatically.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:41,000 --> 00:00:45,000
|
| 35 |
+
This is a event which we can't avoid during the development in the team.
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:45,000 --> 00:00:49,000
|
| 39 |
+
Usually it may happen when two developers change in the same line of code.
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:49,000 --> 00:00:50,000
|
| 43 |
+
How it can be.
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:50,000 --> 00:00:54,000
|
| 47 |
+
For example, imagine that in our project we have some web page and developer.
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:54,000 --> 00:00:59,000
|
| 51 |
+
No one worked on the task to implement login button and added some styles.
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:00:59,000 --> 00:01:06,000
|
| 55 |
+
She included these styles into our HTML page and developing a number to work on the task for implementing
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:01:06,000 --> 00:01:08,000
|
| 59 |
+
carcel on the home page.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:01:08,000 --> 00:01:15,000
|
| 63 |
+
Engineer number two also had to do adjustments in the home page because he wanted to include his custom
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:15,000 --> 00:01:18,000
|
| 67 |
+
styles and adjust page markup a bit.
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:18,000 --> 00:01:21,000
|
| 71 |
+
First, Engineer pushed his code to his original branch.
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:22,000 --> 00:01:25,000
|
| 75 |
+
He also created a pool request that was successfully merged.
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:25,000 --> 00:01:28,000
|
| 79 |
+
But one second engineer tried to create a pool request.
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:28,000 --> 00:01:31,000
|
| 83 |
+
He received an error that there are no conflicts.
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:31,000 --> 00:01:32,000
|
| 87 |
+
Why?
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:32,000 --> 00:01:38,000
|
| 91 |
+
Because two engineers and they did the same file home that each demo and most likely in the same lines
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:38,000 --> 00:01:39,000
|
| 95 |
+
of code.
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:39,000 --> 00:01:47,000
|
| 99 |
+
And you can't understand what version of code is the latest one and the proper one, yet can't match
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:47,000 --> 00:01:48,000
|
| 103 |
+
this code automatically.
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:48,000 --> 00:01:51,000
|
| 107 |
+
This situation is called much conflict.
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:52,000 --> 00:01:53,000
|
| 111 |
+
What to do in this case?
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:01:53,000 --> 00:01:56,000
|
| 115 |
+
In this case, conflict should be resolved manually.
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:01:56,000 --> 00:02:02,000
|
| 119 |
+
Engineer number two has to pull all the latest changes into his branch, investigate where exactly this
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:02,000 --> 00:02:06,000
|
| 123 |
+
conflict is appeared and resolve it by saying resolve it.
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:06,000 --> 00:02:11,000
|
| 127 |
+
I mean change source code and create a command that will be approved to the gate that these changes
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:11,000 --> 00:02:16,000
|
| 131 |
+
are created intentionally and well reviewed by some engineer after much conflict.
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:16,000 --> 00:02:19,000
|
| 135 |
+
As a result, the file can be merged to the master branch.
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:19,000 --> 00:02:25,000
|
| 139 |
+
So today we are going to review the example, how this much conflict is created and how to solve it.
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:25,000 --> 00:02:31,000
|
| 143 |
+
Let's start to start with I'd like to inform you that for the sake of the demo before this lesson,
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:31,000 --> 00:02:36,000
|
| 147 |
+
I created this home, the HTML file in the Web content directory.
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:36,000 --> 00:02:37,000
|
| 151 |
+
Let's take a look at it.
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:39,000 --> 00:02:46,000
|
| 155 |
+
As you can see, this is the simplest possible HTML file with an overall text in it, nothing special
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:46,000 --> 00:02:48,000
|
| 159 |
+
to not lose focus from the goal of our lesson.
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:49,000 --> 00:02:53,000
|
| 163 |
+
This file was created in the separate branch and merged with the remote repository.
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:02:53,000 --> 00:02:55,000
|
| 167 |
+
You already know how to do that.
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:02:55,000 --> 00:02:57,000
|
| 171 |
+
Now imagine the developer.
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:02:57,000 --> 00:03:02,000
|
| 175 |
+
One wanted to create styles for login button and pop up on the homepage.
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:02,000 --> 00:03:04,000
|
| 179 |
+
Let's create a new branch for that.
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:04,000 --> 00:03:10,000
|
| 183 |
+
Yes, which was option C Geet three zero four login styling.
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:11,000 --> 00:03:16,000
|
| 187 |
+
Just for the sake of example, let's imagine that we have some styles folder where Altius has files
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:16,000 --> 00:03:19,000
|
| 191 |
+
should be stored for those who are not aware.
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:19,000 --> 00:03:25,000
|
| 195 |
+
Files with the Texas extension are used for styling your elements on the HTML pages.
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:25,000 --> 00:03:28,000
|
| 199 |
+
This stands for Cascadian Stylesheets.
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:28,000 --> 00:03:32,000
|
| 203 |
+
OK, let me create Styles folder in my SAAC directory.
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:33,000 --> 00:03:34,000
|
| 207 |
+
Mkdir Styles.
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:35,000 --> 00:03:40,000
|
| 211 |
+
Now let's imagine that during the task implementation developer, no one created Neuters as file was
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:40,000 --> 00:03:46,000
|
| 215 |
+
description of custom styles touch styles again nauseousness.
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:46,000 --> 00:03:55,000
|
| 219 |
+
Also Injinoo number one adjusted Holmwood HTML file to include this style there to reproduce the steps
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:55,000 --> 00:03:56,000
|
| 223 |
+
that I did in this lesson.
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:03:56,000 --> 00:03:59,000
|
| 227 |
+
You can use any text or code editor you would like.
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:03:59,000 --> 00:04:05,000
|
| 231 |
+
For the sake of the demo, I will use Nano text editor to save time on switching between different screens.
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:04:05,000 --> 00:04:14,000
|
| 235 |
+
Let me open home e-mail file to adjusted nano web content slash hamdard HDMI.
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:04:15,000 --> 00:04:20,000
|
| 239 |
+
Just to remind you, I always use that key for auto completion internal according to rules.
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:20,000 --> 00:04:27,000
|
| 243 |
+
I can include TSF style on this page like this and the hat that I should put my link back with.
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:27,000 --> 00:04:38,000
|
| 247 |
+
The path to the text file had a link rel stylesheet HSF double dot slash styles slash again not to assess
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:39,000 --> 00:04:42,000
|
| 251 |
+
and clotheslined attack and had attack is closed.
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:43,000 --> 00:04:45,000
|
| 255 |
+
This is not a tumultuous assess.
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:45,000 --> 00:04:48,000
|
| 259 |
+
That's why I won't stop on the things I wrote.
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:48,000 --> 00:04:52,000
|
| 263 |
+
But I would like to draw attention to the lines which we changed.
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:53,000 --> 00:04:55,000
|
| 267 |
+
We changed line three, four and five.
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:56,000 --> 00:04:57,000
|
| 271 |
+
Remember this.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:57,000 --> 00:05:00,000
|
| 275 |
+
This is important for understanding of the conflict topic.
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:05:00,000 --> 00:05:03,000
|
| 279 |
+
I access this file and save it now.
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:05:03,000 --> 00:05:08,000
|
| 283 |
+
Add everything to the staging area, create and commit and push it to the original branch.
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:05:09,000 --> 00:05:12,000
|
| 287 |
+
Those are the things that we have already learned in the previous lessons.
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:05:12,000 --> 00:05:14,000
|
| 291 |
+
Give me a few seconds here.
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:05:15,000 --> 00:05:25,000
|
| 295 |
+
Get at not yet committed again and again yet Bush with option you originally a three zero for Logan
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:05:25,000 --> 00:05:26,000
|
| 299 |
+
stylin.
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:27,000 --> 00:05:33,000
|
| 303 |
+
Also, I can create pool requests, but the important thing right now is not to match your pool request.
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:33,000 --> 00:05:36,000
|
| 307 |
+
Why we need to imitate case one.
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:36,000 --> 00:05:42,000
|
| 311 |
+
Developer number two started implementation of his task without knowing about changes in the home.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:42,000 --> 00:05:44,000
|
| 315 |
+
Each team will understand.
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:44,000 --> 00:05:47,000
|
| 319 |
+
Right now, let's pretend that we as the other engineer.
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:48,000 --> 00:05:54,000
|
| 323 |
+
Let me let me get back to the massive branch and create new branch for my task from it gets which M.
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:55,000 --> 00:05:59,000
|
| 327 |
+
Gates, which was option C, a three zero five homecourt.
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:59,000 --> 00:06:01,000
|
| 331 |
+
So nice.
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:06:02,000 --> 00:06:04,000
|
| 335 |
+
Now I have to create my own styles for Carasso.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:06:05,000 --> 00:06:09,000
|
| 339 |
+
Let me create file in styles directory take into account with each branch.
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:06:09,000 --> 00:06:11,000
|
| 343 |
+
I don't have styles directory.
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:06:11,000 --> 00:06:13,000
|
| 347 |
+
Here, let me show you this.
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:06:14,000 --> 00:06:19,000
|
| 351 |
+
It is optional and you can see that Styles directory is not created yet on this branch.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:06:20,000 --> 00:06:23,000
|
| 355 |
+
Let me quickly created mkdir styles.
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:06:23,000 --> 00:06:32,000
|
| 359 |
+
Now I can create miticides, file touch styles Carasso not to assess and now let me adjust home html
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:32,000 --> 00:06:33,000
|
| 363 |
+
file.
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:34,000 --> 00:06:40,000
|
| 367 |
+
None of content slash home dot HMO, I will put reference to my sister's file here.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:41,000 --> 00:06:48,000
|
| 371 |
+
At least, Carol Stylesheet, a triple double dose slash style slash carrousel, not Ceressus, and
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:48,000 --> 00:06:49,000
|
| 375 |
+
close the attack.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:50,000 --> 00:06:52,000
|
| 379 |
+
Attack is also closed.
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:53,000 --> 00:07:00,000
|
| 383 |
+
And you can notice that I changed lines number three, four and five, the same lines that as a developer
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:07:00,000 --> 00:07:01,000
|
| 387 |
+
changed.
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:07:01,000 --> 00:07:02,000
|
| 391 |
+
This is important.
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:07:03,000 --> 00:07:05,000
|
| 395 |
+
Let me close and save this file.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:07:06,000 --> 00:07:09,000
|
| 399 |
+
I'm going to add all changes to the staging area.
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:07:09,000 --> 00:07:11,000
|
| 403 |
+
Come in then and push to the remote repository.
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:07:12,000 --> 00:07:13,000
|
| 407 |
+
Give me a few seconds here.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:07:14,000 --> 00:07:15,000
|
| 411 |
+
Get at DOT.
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:07:15,000 --> 00:07:18,000
|
| 415 |
+
You'd commit option and carrousel on the home page.
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:19,000 --> 00:07:23,000
|
| 419 |
+
Get push resorption you a region key, a three zero five home Carasso.
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:24,000 --> 00:07:30,000
|
| 423 |
+
Now imagine that during implementation of the home Carasso task pool request for logging's talent was
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:30,000 --> 00:07:31,000
|
| 427 |
+
matched by a technique.
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:32,000 --> 00:07:33,000
|
| 431 |
+
Let me merge it.
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:35,000 --> 00:07:38,000
|
| 435 |
+
OK, it is merged and nothing bad happened.
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:39,000 --> 00:07:42,000
|
| 439 |
+
Now let me create a pool request for carrousel implementation.
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:07:46,000 --> 00:07:53,000
|
| 443 |
+
First of all, I see here warning that this branch can't be automatically merged, but still I can create
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:07:53,000 --> 00:07:53,000
|
| 447 |
+
a pull request.
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:07:54,000 --> 00:08:00,000
|
| 451 |
+
And after I created a request, I see that my emerge button is disabled because of the conflicts you
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:08:00,000 --> 00:08:06,000
|
| 455 |
+
can see in here that you can solve conflicts in the Web editor, while this can be an option in case
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:08:06,000 --> 00:08:08,000
|
| 459 |
+
of the resolving of the small conflict.
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:08:08,000 --> 00:08:10,000
|
| 463 |
+
This is not an option for the most cases.
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:08:11,000 --> 00:08:11,000
|
| 467 |
+
Why?
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:08:12,000 --> 00:08:13,000
|
| 471 |
+
Because of the few reasons.
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:08:14,000 --> 00:08:20,000
|
| 475 |
+
Reason number one, most likely you have more complicated conflicts than we have now here.
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:08:20,000 --> 00:08:26,000
|
| 479 |
+
And this is not convenient to change it in Web editor reason number two, after resolving conflicts,
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:26,000 --> 00:08:30,000
|
| 483 |
+
you want to be sure that you didn't break anything for this?
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:30,000 --> 00:08:37,000
|
| 487 |
+
You have to have your code on your local machine to run unit tests or integration tests on case HDMI
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:37,000 --> 00:08:42,000
|
| 491 |
+
additon to open each HTML page to make sure that everything is OK with your markup.
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:42,000 --> 00:08:46,000
|
| 495 |
+
So I will show you how you can solve conflicts on your local machine.
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:08:46,000 --> 00:08:48,000
|
| 499 |
+
Let me get back to the Kit Bash.
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:08:48,000 --> 00:08:55,000
|
| 503 |
+
I'm on my task home carrousel branch, as you can see here, to resolve the conflicts, I have to merge
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:08:55,000 --> 00:08:57,000
|
| 507 |
+
a region master branch into the current branch.
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:08:57,000 --> 00:08:59,000
|
| 511 |
+
You already know that.
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:08:59,000 --> 00:09:01,000
|
| 515 |
+
Merge command, merge different branches.
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:09:01,000 --> 00:09:07,000
|
| 519 |
+
But let me show you how you can merge remote branch into the current one yet pull a region master.
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:09:08,000 --> 00:09:13,000
|
| 523 |
+
You also learned in previous lessons that pull command, merge changes into the branch.
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:09:14,000 --> 00:09:18,000
|
| 527 |
+
And here you can see the message that there is a conflict in this file.
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:09:18,000 --> 00:09:20,000
|
| 531 |
+
Automatic merge is failed.
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:09:20,000 --> 00:09:22,000
|
| 535 |
+
Let resolve conflicts.
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:09:22,000 --> 00:09:26,000
|
| 539 |
+
I have to open in any code ed file where I have conflicts.
|
| 540 |
+
|
| 541 |
+
136
|
| 542 |
+
00:09:27,000 --> 00:09:28,000
|
| 543 |
+
For the sake of the demo.
|
| 544 |
+
|
| 545 |
+
137
|
| 546 |
+
00:09:28,000 --> 00:09:31,000
|
| 547 |
+
I will use Nnenna Ed in this lesson now.
|
| 548 |
+
|
| 549 |
+
138
|
| 550 |
+
00:09:31,000 --> 00:09:35,000
|
| 551 |
+
No map content egholm not HMO.
|
| 552 |
+
|
| 553 |
+
139
|
| 554 |
+
00:09:35,000 --> 00:09:39,000
|
| 555 |
+
And here you can find different symbols that get added to our file.
|
| 556 |
+
|
| 557 |
+
140
|
| 558 |
+
00:09:40,000 --> 00:09:42,000
|
| 559 |
+
That is how it shows the conflicts.
|
| 560 |
+
|
| 561 |
+
141
|
| 562 |
+
00:09:42,000 --> 00:09:48,000
|
| 563 |
+
You already know that hat is a pointer to the place where you are currently in your working directory.
|
| 564 |
+
|
| 565 |
+
142
|
| 566 |
+
00:09:48,000 --> 00:09:50,000
|
| 567 |
+
So here you can see our version of code.
|
| 568 |
+
|
| 569 |
+
143
|
| 570 |
+
00:09:51,000 --> 00:09:57,000
|
| 571 |
+
We want to insert carrousel to assess and here changes from the master branch that were merged after
|
| 572 |
+
|
| 573 |
+
144
|
| 574 |
+
00:09:57,000 --> 00:09:59,000
|
| 575 |
+
implementation of task by the world number one.
|
| 576 |
+
|
| 577 |
+
145
|
| 578 |
+
00:10:00,000 --> 00:10:01,000
|
| 579 |
+
And check some of that comment.
|
| 580 |
+
|
| 581 |
+
146
|
| 582 |
+
00:10:02,000 --> 00:10:06,000
|
| 583 |
+
We have to adjust file after some analysis.
|
| 584 |
+
|
| 585 |
+
147
|
| 586 |
+
00:10:06,000 --> 00:10:10,000
|
| 587 |
+
I understood that in this particular case, I want to keep my changes and changes of developer.
|
| 588 |
+
|
| 589 |
+
148
|
| 590 |
+
00:10:10,000 --> 00:10:13,000
|
| 591 |
+
No one will see that line.
|
| 592 |
+
|
| 593 |
+
149
|
| 594 |
+
00:10:13,000 --> 00:10:18,000
|
| 595 |
+
Three and five were the same in two versions of code, but only in line number four was different.
|
| 596 |
+
|
| 597 |
+
150
|
| 598 |
+
00:10:19,000 --> 00:10:21,000
|
| 599 |
+
We used different sets, file names here.
|
| 600 |
+
|
| 601 |
+
151
|
| 602 |
+
00:10:22,000 --> 00:10:24,000
|
| 603 |
+
Let me add just markup accordingly.
|
| 604 |
+
|
| 605 |
+
152
|
| 606 |
+
00:10:25,000 --> 00:10:28,000
|
| 607 |
+
After I'm done with changes, I exit and save this file.
|
| 608 |
+
|
| 609 |
+
153
|
| 610 |
+
00:10:29,000 --> 00:10:35,000
|
| 611 |
+
Here in parentheses, you see mansions that I'm in the process of merging two branches also.
|
| 612 |
+
|
| 613 |
+
154
|
| 614 |
+
00:10:35,000 --> 00:10:39,000
|
| 615 |
+
You can see that suggested to me to create the once conflicts are resolved.
|
| 616 |
+
|
| 617 |
+
155
|
| 618 |
+
00:10:40,000 --> 00:10:42,000
|
| 619 |
+
Let's follow this advice and create a committee.
|
| 620 |
+
|
| 621 |
+
156
|
| 622 |
+
00:10:43,000 --> 00:10:49,000
|
| 623 |
+
If you would check status with get status comment, then we would see that new file logging success
|
| 624 |
+
|
| 625 |
+
157
|
| 626 |
+
00:10:49,000 --> 00:10:51,000
|
| 627 |
+
is already added to the staging area.
|
| 628 |
+
|
| 629 |
+
158
|
| 630 |
+
00:10:52,000 --> 00:10:55,000
|
| 631 |
+
That's the one from the master branch where we don't have any conflicts.
|
| 632 |
+
|
| 633 |
+
159
|
| 634 |
+
00:10:56,000 --> 00:10:59,000
|
| 635 |
+
And here is the file where we had a conflict.
|
| 636 |
+
|
| 637 |
+
160
|
| 638 |
+
00:10:59,000 --> 00:11:07,000
|
| 639 |
+
Let me add it to the staging area yet at not now let's check status and we can see that all files are
|
| 640 |
+
|
| 641 |
+
161
|
| 642 |
+
00:11:07,000 --> 00:11:08,000
|
| 643 |
+
in the staging area.
|
| 644 |
+
|
| 645 |
+
162
|
| 646 |
+
00:11:08,000 --> 00:11:12,000
|
| 647 |
+
Now, let's create a climate gate comment.
|
| 648 |
+
|
| 649 |
+
163
|
| 650 |
+
00:11:12,000 --> 00:11:18,000
|
| 651 |
+
I will skip the message now because for such cases get already stolen message for me, the message that
|
| 652 |
+
|
| 653 |
+
164
|
| 654 |
+
00:11:18,000 --> 00:11:21,000
|
| 655 |
+
states that must branch is merged into the task branch.
|
| 656 |
+
|
| 657 |
+
165
|
| 658 |
+
00:11:22,000 --> 00:11:27,000
|
| 659 |
+
Let's close this text editor and we can see that we successfully merged changes.
|
| 660 |
+
|
| 661 |
+
166
|
| 662 |
+
00:11:27,000 --> 00:11:31,000
|
| 663 |
+
Now we need to update our branch in remote repository.
|
| 664 |
+
|
| 665 |
+
167
|
| 666 |
+
00:11:31,000 --> 00:11:32,000
|
| 667 |
+
Let's push our changes.
|
| 668 |
+
|
| 669 |
+
168
|
| 670 |
+
00:11:33,000 --> 00:11:34,000
|
| 671 |
+
Get Bush.
|
| 672 |
+
|
| 673 |
+
169
|
| 674 |
+
00:11:36,000 --> 00:11:39,000
|
| 675 |
+
Now, let me refresh page with my pool request.
|
| 676 |
+
|
| 677 |
+
170
|
| 678 |
+
00:11:42,000 --> 00:11:50,000
|
| 679 |
+
I can't rebase and merge, and I will explain why in the next lesson, but I can merge with creating
|
| 680 |
+
|
| 681 |
+
171
|
| 682 |
+
00:11:50,000 --> 00:11:51,000
|
| 683 |
+
a new command.
|
| 684 |
+
|
| 685 |
+
172
|
| 686 |
+
00:11:52,000 --> 00:11:57,000
|
| 687 |
+
And if you remember that in previous lesson I showed you different margined strategies and how to allow
|
| 688 |
+
|
| 689 |
+
173
|
| 690 |
+
00:11:57,000 --> 00:12:02,000
|
| 691 |
+
different merging strategies here in the settings and the merge button section.
|
| 692 |
+
|
| 693 |
+
174
|
| 694 |
+
00:12:02,000 --> 00:12:06,000
|
| 695 |
+
Congratulations yourself, your first merge conflict.
|
| 696 |
+
|
| 697 |
+
175
|
| 698 |
+
00:12:06,000 --> 00:12:08,000
|
| 699 |
+
But unfortunately, we are not falling right now.
|
| 700 |
+
|
| 701 |
+
176
|
| 702 |
+
00:12:08,000 --> 00:12:11,000
|
| 703 |
+
Best practices of keeping it historically.
|
| 704 |
+
|
| 705 |
+
177
|
| 706 |
+
00:12:12,000 --> 00:12:12,000
|
| 707 |
+
Why?
|
| 708 |
+
|
| 709 |
+
178
|
| 710 |
+
00:12:13,000 --> 00:12:17,000
|
| 711 |
+
Because first of all, we created separate committees during the merger and Origin Master Branch was
|
| 712 |
+
|
| 713 |
+
179
|
| 714 |
+
00:12:17,000 --> 00:12:23,000
|
| 715 |
+
our task branch and right now we are under the risk to create one more committee for merging branches.
|
| 716 |
+
|
| 717 |
+
180
|
| 718 |
+
00:12:24,000 --> 00:12:28,000
|
| 719 |
+
Can you imagine how our history tree will look like after all of this?
|
| 720 |
+
|
| 721 |
+
181
|
| 722 |
+
00:12:29,000 --> 00:12:31,000
|
| 723 |
+
Your tax rate will be disappointed.
|
| 724 |
+
|
| 725 |
+
182
|
| 726 |
+
00:12:31,000 --> 00:12:33,000
|
| 727 |
+
Just joking in the next lessons.
|
| 728 |
+
|
| 729 |
+
183
|
| 730 |
+
00:12:33,000 --> 00:12:37,000
|
| 731 |
+
I will show you how to avoid this and how to keep your tax rate happy.
|
| 732 |
+
|
| 733 |
+
184
|
| 734 |
+
00:12:38,000 --> 00:12:42,000
|
| 735 |
+
But still to understand the next lessons, you had to understand this lesson.
|
| 736 |
+
|
| 737 |
+
185
|
| 738 |
+
00:12:42,000 --> 00:12:47,000
|
| 739 |
+
And why pull an origin master into your branch to resolve conflicts is not the best approach.
|
| 740 |
+
|
| 741 |
+
186
|
| 742 |
+
00:12:48,000 --> 00:12:53,000
|
| 743 |
+
While this approach is still valid in some companies and in some development teams, that is not the
|
| 744 |
+
|
| 745 |
+
187
|
| 746 |
+
00:12:53,000 --> 00:12:57,000
|
| 747 |
+
approach which I would approve in my development team and in my company.
|
| 748 |
+
|
| 749 |
+
188
|
| 750 |
+
00:12:57,000 --> 00:13:02,000
|
| 751 |
+
Probably already aware that I am CEO of my own software development company.
|
| 752 |
+
|
| 753 |
+
189
|
| 754 |
+
00:13:02,000 --> 00:13:08,000
|
| 755 |
+
And when I interviewed engineers, I paid extra attention to the experience of working with it, because
|
| 756 |
+
|
| 757 |
+
190
|
| 758 |
+
00:13:08,000 --> 00:13:14,000
|
| 759 |
+
during the development of complex projects and cross-functional teams, these skills are very important.
|
| 760 |
+
|
| 761 |
+
191
|
| 762 |
+
00:13:14,000 --> 00:13:19,000
|
| 763 |
+
I am going to create top notch software engineers from you during this course.
|
| 764 |
+
|
| 765 |
+
192
|
| 766 |
+
00:13:19,000 --> 00:13:22,000
|
| 767 |
+
That's why I will run as a way to solve financial conflicts.
|
| 768 |
+
|
| 769 |
+
193
|
| 770 |
+
00:13:22,000 --> 00:13:27,000
|
| 771 |
+
OK, and if we are good for the day, let's recap what we have learned today.
|
| 772 |
+
|
| 773 |
+
194
|
| 774 |
+
00:13:28,000 --> 00:13:34,000
|
| 775 |
+
In this lesson, you learned what marriage conflicts are more over together, even we produce much conflict
|
| 776 |
+
|
| 777 |
+
195
|
| 778 |
+
00:13:34,000 --> 00:13:35,000
|
| 779 |
+
in real life.
|
| 780 |
+
|
| 781 |
+
196
|
| 782 |
+
00:13:35,000 --> 00:13:41,000
|
| 783 |
+
Example, you learned how to resolve marriage conflicts locally and how to manage a region must rush
|
| 784 |
+
|
| 785 |
+
197
|
| 786 |
+
00:13:41,000 --> 00:13:43,000
|
| 787 |
+
into a task branch.
|
| 788 |
+
|
| 789 |
+
198
|
| 790 |
+
00:13:43,000 --> 00:13:45,000
|
| 791 |
+
Thanks a lot for your attention.
|
| 792 |
+
|
| 793 |
+
199
|
| 794 |
+
00:13:45,000 --> 00:13:47,000
|
| 795 |
+
See you in the next lesson.
|
| 796 |
+
|
17 - GIT/013 Git Rebasing & Force Update of remote repository_en.srt
ADDED
|
@@ -0,0 +1,968 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:11,000 --> 00:00:11,000
|
| 7 |
+
it is.
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:12,000 --> 00:00:14,000
|
| 11 |
+
I will show you how and when you can apply.
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:14,000 --> 00:00:15,000
|
| 15 |
+
Get your base command.
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:15,000 --> 00:00:18,000
|
| 19 |
+
I will explain what rebase actually means.
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:18,000 --> 00:00:23,000
|
| 23 |
+
Also, I will explain the difference between good marriage and get to base after.
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:23,000 --> 00:00:24,000
|
| 27 |
+
We will understand Ceri.
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:24,000 --> 00:00:30,000
|
| 31 |
+
We'll take a look at real example and we'll learn how we can use our base command on a daily basis.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:31,000 --> 00:00:35,000
|
| 35 |
+
You're going to see how to keep your military clean during the lesson.
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:35,000 --> 00:00:39,000
|
| 39 |
+
You're going to learn how to solve conflicts that could appear during the invasion.
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:39,000 --> 00:00:45,000
|
| 43 |
+
On the other branch, on real examples, I will show you what gets replaced with option continue means
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:46,000 --> 00:00:47,000
|
| 47 |
+
and how to complete the remaining process.
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:48,000 --> 00:00:53,000
|
| 51 |
+
After we change the local comment history, I will show you what force of date is and how force with
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:00:53,000 --> 00:00:55,000
|
| 55 |
+
lease option may help us.
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:00:55,000 --> 00:01:01,000
|
| 59 |
+
And at the end of the lesson I'm going to share with you four Rules of Happy Perquisite by Peter.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:01:02,000 --> 00:01:03,000
|
| 63 |
+
Just jokin is always.
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:04,000 --> 00:01:09,000
|
| 67 |
+
And to start with, let's discuss the problem which we faced during the previous lesson, if we resolved
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:09,000 --> 00:01:16,000
|
| 71 |
+
conflicts with Bookham and you saw that one more comment was created and you also saw that I can't merge
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:16,000 --> 00:01:20,000
|
| 75 |
+
with the best strategy to M. I can only merge with new command.
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:20,000 --> 00:01:27,000
|
| 79 |
+
So our problem is how to get his territory clean, the presidential and union commands.
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:27,000 --> 00:01:30,000
|
| 83 |
+
Let's understand first what our base is and how it works.
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:30,000 --> 00:01:35,000
|
| 87 |
+
In general, there are two main ways to integrate changes from one branch into another.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:35,000 --> 00:01:38,000
|
| 91 |
+
Zaya Yes, merge and military base.
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:38,000 --> 00:01:42,000
|
| 95 |
+
We already learned in previous lessons more about Gaete merging branches.
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:43,000 --> 00:01:47,000
|
| 99 |
+
Now let's understand on the high level what is a rebase let's recall an example.
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:47,000 --> 00:01:52,000
|
| 103 |
+
When we had the branches, the easiest way to synchronize the branches is to merge them.
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:53,000 --> 00:01:58,000
|
| 107 |
+
So to merge C3 and C4 snapshots, we have to create one more snapshot.
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:58,000 --> 00:01:59,000
|
| 111 |
+
Thus one more comment.
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:01:59,000 --> 00:02:00,000
|
| 115 |
+
C five.
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:02:01,000 --> 00:02:04,000
|
| 119 |
+
This option works just fine and we saw how it works.
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:05,000 --> 00:02:10,000
|
| 123 |
+
But do we have another option that will not create additional senseless commit?
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:11,000 --> 00:02:12,000
|
| 127 |
+
Yes, we do.
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:12,000 --> 00:02:15,000
|
| 131 |
+
Based on the awesome branch, what does that mean?
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:15,000 --> 00:02:20,000
|
| 135 |
+
We can take changes that we have in C four commit and put them on top of C three.
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:21,000 --> 00:02:27,000
|
| 139 |
+
That mean you can take changes that were done on one branch and apply those changes on the other branch.
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:28,000 --> 00:02:33,000
|
| 143 |
+
In our example, I can execute Command Guitry Bassmaster while being on the experiment branch.
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:34,000 --> 00:02:38,000
|
| 147 |
+
This will lead us to the good history that you can see on this slide.
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:38,000 --> 00:02:42,000
|
| 151 |
+
You can see that C snapshot is going right after C three.
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:43,000 --> 00:02:48,000
|
| 155 |
+
This will allow the great pull request and merge branches and help with the and strategy.
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:48,000 --> 00:02:54,000
|
| 159 |
+
In this particular scenario, we can switch back to the Master Branch and do fastforward much like it
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:54,000 --> 00:02:55,000
|
| 163 |
+
has shown on the slide.
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:02:56,000 --> 00:03:02,000
|
| 167 |
+
And in this case, you can see that there are no any other comments from Najin branches and we have
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:03:02,000 --> 00:03:03,000
|
| 171 |
+
Coingate history.
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:03:04,000 --> 00:03:09,000
|
| 175 |
+
We're also going to have lessons about interactive freebase a bit later in this course, where I will
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:09,000 --> 00:03:14,000
|
| 179 |
+
show you how you can use reverse command to combine commands or to change commit messages.
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:15,000 --> 00:03:20,000
|
| 183 |
+
But in this lesson, we'll run the rebels command only from the point of margin changes from different
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:20,000 --> 00:03:20,000
|
| 187 |
+
branches.
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:21,000 --> 00:03:26,000
|
| 191 |
+
On the previous slide, you saw base command to replace changes from another branch.
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:26,000 --> 00:03:31,000
|
| 195 |
+
But in real life example, later today we are going to use a bit another variation of this command,
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:31,000 --> 00:03:33,000
|
| 199 |
+
get ball with a base option.
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:34,000 --> 00:03:38,000
|
| 203 |
+
So what is the difference between a military base and pool with a base option?
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:38,000 --> 00:03:43,000
|
| 207 |
+
Using base command replaces the branch which we want get bored with.
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:43,000 --> 00:03:48,000
|
| 211 |
+
The base option can be treated as shorthand for git fetch and then get through base command.
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:48,000 --> 00:03:54,000
|
| 215 |
+
You will be able to fetch all the latest changes from the remote repository prior to revising our code
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:54,000 --> 00:03:54,000
|
| 219 |
+
on top of it.
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:55,000 --> 00:04:01,000
|
| 223 |
+
Because if I would just use Guitry Bassmaster Command, it would only take into account what local repository
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:04:01,000 --> 00:04:05,000
|
| 227 |
+
is already aware of, but not the changes from the remote repository.
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:04:05,000 --> 00:04:07,000
|
| 231 |
+
This is very important, practical tip.
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:04:08,000 --> 00:04:13,000
|
| 235 |
+
That's why this video, of course, is so valuable to all my students, because even if you would read
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:04:13,000 --> 00:04:17,000
|
| 239 |
+
documentation and use it to base, you wouldn't read the expected goal.
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:17,000 --> 00:04:20,000
|
| 243 |
+
And it is not clear that Boogerman has a base option.
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:20,000 --> 00:04:23,000
|
| 247 |
+
If only you read all your documentation.
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:23,000 --> 00:04:30,000
|
| 251 |
+
Probably by this very moment of our lesson, you are wondering what is better get much or get base?
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:31,000 --> 00:04:34,000
|
| 255 |
+
Which one should I use to give you the full answer?
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:34,000 --> 00:04:39,000
|
| 259 |
+
I'd like you to understand one more time what repositories history means from different point of use.
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:40,000 --> 00:04:43,000
|
| 263 |
+
Repository history is the records of what actually happened.
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:44,000 --> 00:04:51,000
|
| 267 |
+
From this point of view, it might seem like not a good idea to change history from this angle.
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:51,000 --> 00:04:56,000
|
| 271 |
+
Using the base is similar to lying about what actually happened in your repository.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:56,000 --> 00:05:01,000
|
| 275 |
+
But is this valid comment all the times or there are some exceptions?
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:05:01,000 --> 00:05:07,000
|
| 279 |
+
What if there are a series of large companies that brings us almost zero information about conversion
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:05:07,000 --> 00:05:08,000
|
| 283 |
+
improvements?
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:05:08,000 --> 00:05:12,000
|
| 287 |
+
That brings us information that branches remerged OK?
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:05:12,000 --> 00:05:17,000
|
| 291 |
+
And what that is logical is that branches should be merged at some point.
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:05:17,000 --> 00:05:24,000
|
| 295 |
+
But I am more interested in the functionality of the specific version of code rather than the fact that
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:05:24,000 --> 00:05:25,000
|
| 299 |
+
there was not much.
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:25,000 --> 00:05:29,000
|
| 303 |
+
That is the point of view on what repositories history means.
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:30,000 --> 00:05:35,000
|
| 307 |
+
My personal opinion is that we should treat our history as a story of how our project was made.
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:35,000 --> 00:05:40,000
|
| 311 |
+
If we are writing a story, there is no harm in doing side notes and tracking each step.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:41,000 --> 00:05:46,000
|
| 315 |
+
But when times come to release the story and show it to the world, I want to tell more coherent story
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:46,000 --> 00:05:48,000
|
| 319 |
+
without all my drafts.
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:48,000 --> 00:05:49,000
|
| 323 |
+
And that didn't pass.
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:50,000 --> 00:05:55,000
|
| 327 |
+
But despite my personal opinion, I believe you understood that there is no right answer which approach
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:55,000 --> 00:05:56,000
|
| 331 |
+
is better.
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:05:56,000 --> 00:06:02,000
|
| 335 |
+
And just keep in mind that all projects are different and there is no silver bullet for each project.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:06:02,000 --> 00:06:04,000
|
| 339 |
+
There is no one size fits all approach.
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:06:05,000 --> 00:06:09,000
|
| 343 |
+
But being a true professional, you have to be aware about different points of view.
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:06:09,000 --> 00:06:13,000
|
| 347 |
+
That's why I believe it is important for me to share this with you.
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:06:14,000 --> 00:06:20,000
|
| 351 |
+
OK, now, when you understood the theory of revision, I suggest looking at our practical example.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:06:21,000 --> 00:06:26,000
|
| 355 |
+
Keen to understand the damage in this lesson, you have to understand the drama from previous lesson
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:06:26,000 --> 00:06:32,000
|
| 359 |
+
because we have the same context as in previous lesson will proceed from the point where we finished
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:32,000 --> 00:06:32,000
|
| 363 |
+
previous time.
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:33,000 --> 00:06:37,000
|
| 367 |
+
Let me call Gitlow command of last's recommits gridlock.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:37,000 --> 00:06:39,000
|
| 371 |
+
Dash three here.
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:39,000 --> 00:06:43,000
|
| 375 |
+
You can see that I have not commit one result together.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:43,000 --> 00:06:44,000
|
| 379 |
+
Much conflict.
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:44,000 --> 00:06:50,000
|
| 383 |
+
You can see here that this much coming of this Ansar's Kummetz, you can check, check, checksum here.
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:06:51,000 --> 00:06:53,000
|
| 387 |
+
And here's a reference to Logan pop up.
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:06:53,000 --> 00:06:54,000
|
| 391 |
+
You're in Logan Command.
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:06:55,000 --> 00:06:59,000
|
| 395 |
+
That is command that emerged from a three zero four branch.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:06:59,000 --> 00:07:06,000
|
| 399 |
+
And we see in parentheses that it is from a region master branch and we have our own command, which
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:07:06,000 --> 00:07:12,000
|
| 403 |
+
we did, and scope of this branch gursel on the home page and then Miyu another option of handling much
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:07:12,000 --> 00:07:13,000
|
| 407 |
+
conflict.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:07:13,000 --> 00:07:19,000
|
| 411 |
+
And to them or a base to you, I suggest we said in our state to the state of this comit carrousel on
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:07:19,000 --> 00:07:24,000
|
| 415 |
+
the home page before we even did a good pull origin master command.
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:25,000 --> 00:07:30,000
|
| 419 |
+
Right now you are going to get reset command, which we are going to learn in the separate lesson.
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:30,000 --> 00:07:36,000
|
| 423 |
+
I have to use it in this lesson so that you would keep track of all my changes in the git repository.
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:36,000 --> 00:07:42,000
|
| 427 |
+
I believe that showing all my actions and to you is the best way to learn such a powerful tool as good.
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:43,000 --> 00:07:50,000
|
| 431 |
+
I will perform the next command and I will explain in short what it does get reset.
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:50,000 --> 00:07:56,000
|
| 435 |
+
This command can reset state of your file system to the specific revision option.
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:56,000 --> 00:08:02,000
|
| 439 |
+
Hard reset command has different modes will learn all possible modes in the separate lesson.
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:08:03,000 --> 00:08:09,000
|
| 443 |
+
Heart means that files from the other region will be restored and all changes from other revisions will
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:08:09,000 --> 00:08:10,000
|
| 447 |
+
be removed.
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:08:11,000 --> 00:08:13,000
|
| 451 |
+
Had had is appointed as a current place.
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:08:13,000 --> 00:08:17,000
|
| 455 |
+
And yet that is our last comment to the one.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:08:17,000 --> 00:08:22,000
|
| 459 |
+
This means reset state of our file system to the state that was one commit ago.
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:08:22,000 --> 00:08:26,000
|
| 463 |
+
That is right before we pulled changes from the original Master Branch.
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:08:26,000 --> 00:08:30,000
|
| 467 |
+
Let's press enter and here we are on the castle on the home page.
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:08:30,000 --> 00:08:32,000
|
| 471 |
+
Commit, let's check.
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:08:32,000 --> 00:08:33,000
|
| 475 |
+
Commit history now.
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:08:33,000 --> 00:08:35,000
|
| 479 |
+
Get locked command.
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:36,000 --> 00:08:36,000
|
| 483 |
+
Awesome.
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:37,000 --> 00:08:39,000
|
| 487 |
+
We can even check our file system.
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:39,000 --> 00:08:45,000
|
| 491 |
+
Let me show you that we don't have Logan says says file from another branch, said Stiles.
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:47,000 --> 00:08:54,000
|
| 495 |
+
And residential, and you can see that we only have Gursel to file and we don't have any logins, he
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:08:54,000 --> 00:08:55,000
|
| 499 |
+
says file here.
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:08:56,000 --> 00:08:56,000
|
| 503 |
+
Cool.
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:08:56,000 --> 00:09:00,000
|
| 507 |
+
Let's get back to the SASE directory, Siggie double dot.
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:09:01,000 --> 00:09:04,000
|
| 511 |
+
And now, instead of doing it, pull origin master.
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:09:04,000 --> 00:09:07,000
|
| 515 |
+
Let me execute another commands that we have learned today.
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:09:08,000 --> 00:09:11,000
|
| 519 |
+
Get was optional base a region master.
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:09:12,000 --> 00:09:18,000
|
| 523 |
+
This was expected in case we wouldn't have any major conflicts, rebates would be very smooth, but
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:09:18,000 --> 00:09:20,000
|
| 527 |
+
that is way too easy for you.
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:09:20,000 --> 00:09:23,000
|
| 531 |
+
Let me show you how to resolve NAHJ conflicts during the invasion.
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:09:24,000 --> 00:09:30,000
|
| 535 |
+
I believe you remember that we expect much conflict in home, not HTML file, but this time we have
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:09:30,000 --> 00:09:32,000
|
| 539 |
+
a bit different message.
|
| 540 |
+
|
| 541 |
+
136
|
| 542 |
+
00:09:32,000 --> 00:09:38,000
|
| 543 |
+
We see that error happened during the invasion and commit could not be applied here.
|
| 544 |
+
|
| 545 |
+
137
|
| 546 |
+
00:09:38,000 --> 00:09:41,000
|
| 547 |
+
It leaves a hint for you what to do in this case.
|
| 548 |
+
|
| 549 |
+
138
|
| 550 |
+
00:09:41,000 --> 00:09:44,000
|
| 551 |
+
We have to resolve all conflicts manually.
|
| 552 |
+
|
| 553 |
+
139
|
| 554 |
+
00:09:44,000 --> 00:09:50,000
|
| 555 |
+
After that, we have to either add or remove files to the staging area and execute rebels continued
|
| 556 |
+
|
| 557 |
+
140
|
| 558 |
+
00:09:50,000 --> 00:09:51,000
|
| 559 |
+
command.
|
| 560 |
+
|
| 561 |
+
141
|
| 562 |
+
00:09:52,000 --> 00:09:58,000
|
| 563 |
+
I don't recommend this keep this coming like it is shown here, because our goal is to resolve conflicts
|
| 564 |
+
|
| 565 |
+
142
|
| 566 |
+
00:09:58,000 --> 00:09:59,000
|
| 567 |
+
and finish freebasing.
|
| 568 |
+
|
| 569 |
+
143
|
| 570 |
+
00:10:00,000 --> 00:10:05,000
|
| 571 |
+
In case you understand that it is a mistake and something is going wrong, you can execute Guitry base
|
| 572 |
+
|
| 573 |
+
144
|
| 574 |
+
00:10:05,000 --> 00:10:07,000
|
| 575 |
+
with abort option.
|
| 576 |
+
|
| 577 |
+
145
|
| 578 |
+
00:10:07,000 --> 00:10:13,000
|
| 579 |
+
By the way, here in parentheses, you can see indications that we are in the process of revision right
|
| 580 |
+
|
| 581 |
+
146
|
| 582 |
+
00:10:13,000 --> 00:10:15,000
|
| 583 |
+
now, but let us resolve conflicts.
|
| 584 |
+
|
| 585 |
+
147
|
| 586 |
+
00:10:16,000 --> 00:10:19,000
|
| 587 |
+
Nano web content slash home, not HDMI.
|
| 588 |
+
|
| 589 |
+
148
|
| 590 |
+
00:10:20,000 --> 00:10:22,000
|
| 591 |
+
Let me quickly resolve these conflicts.
|
| 592 |
+
|
| 593 |
+
149
|
| 594 |
+
00:10:23,000 --> 00:10:27,000
|
| 595 |
+
After conflicts are resolved, I close and save this file.
|
| 596 |
+
|
| 597 |
+
150
|
| 598 |
+
00:10:28,000 --> 00:10:36,000
|
| 599 |
+
Now, as it was said before, I have to add files to the staging area yet at DOD and now we can proceed
|
| 600 |
+
|
| 601 |
+
151
|
| 602 |
+
00:10:36,000 --> 00:10:41,000
|
| 603 |
+
our amazing database, continue to get offers me to adjust my message.
|
| 604 |
+
|
| 605 |
+
152
|
| 606 |
+
00:10:41,000 --> 00:10:45,000
|
| 607 |
+
But I want to keep it the same cursor on the homepage.
|
| 608 |
+
|
| 609 |
+
153
|
| 610 |
+
00:10:45,000 --> 00:10:47,000
|
| 611 |
+
That sounds just perfect.
|
| 612 |
+
|
| 613 |
+
154
|
| 614 |
+
00:10:48,000 --> 00:10:54,000
|
| 615 |
+
So I just closed the file and I see a message that I was successfully based on the other branch.
|
| 616 |
+
|
| 617 |
+
155
|
| 618 |
+
00:10:55,000 --> 00:10:59,000
|
| 619 |
+
Now let me update my branch in remote repository to update my poll request.
|
| 620 |
+
|
| 621 |
+
156
|
| 622 |
+
00:11:00,000 --> 00:11:01,000
|
| 623 |
+
Get Bush.
|
| 624 |
+
|
| 625 |
+
157
|
| 626 |
+
00:11:02,000 --> 00:11:04,000
|
| 627 |
+
Oh, I see error here.
|
| 628 |
+
|
| 629 |
+
158
|
| 630 |
+
00:11:05,000 --> 00:11:06,000
|
| 631 |
+
Those were rejected.
|
| 632 |
+
|
| 633 |
+
159
|
| 634 |
+
00:11:07,000 --> 00:11:07,000
|
| 635 |
+
Why?
|
| 636 |
+
|
| 637 |
+
160
|
| 638 |
+
00:11:07,000 --> 00:11:14,000
|
| 639 |
+
Because I already had a ranch in the remote repository, my region, a three zero five home carousel
|
| 640 |
+
|
| 641 |
+
161
|
| 642 |
+
00:11:14,000 --> 00:11:17,000
|
| 643 |
+
branch, has different comment history rather than my local branch.
|
| 644 |
+
|
| 645 |
+
162
|
| 646 |
+
00:11:17,000 --> 00:11:24,000
|
| 647 |
+
Now, because the base command changes get history and it is not smart enough to understand this.
|
| 648 |
+
|
| 649 |
+
163
|
| 650 |
+
00:11:25,000 --> 00:11:27,000
|
| 651 |
+
Forget it is just looks like a mess.
|
| 652 |
+
|
| 653 |
+
164
|
| 654 |
+
00:11:27,000 --> 00:11:31,000
|
| 655 |
+
Now, our local branch and their branch has a different history of comments.
|
| 656 |
+
|
| 657 |
+
165
|
| 658 |
+
00:11:31,000 --> 00:11:35,000
|
| 659 |
+
Let's take a look one more time at the history of Cummins of the remote branch.
|
| 660 |
+
|
| 661 |
+
166
|
| 662 |
+
00:11:36,000 --> 00:11:37,000
|
| 663 |
+
Can you see these two comments?
|
| 664 |
+
|
| 665 |
+
167
|
| 666 |
+
00:11:38,000 --> 00:11:40,000
|
| 667 |
+
And you can see comments, checksum.
|
| 668 |
+
|
| 669 |
+
168
|
| 670 |
+
00:11:40,000 --> 00:11:45,000
|
| 671 |
+
Now let's return to get Bush and check Commissaire git log.
|
| 672 |
+
|
| 673 |
+
169
|
| 674 |
+
00:11:45,000 --> 00:11:47,000
|
| 675 |
+
Deshotel, can I see this?
|
| 676 |
+
|
| 677 |
+
170
|
| 678 |
+
00:11:48,000 --> 00:11:52,000
|
| 679 |
+
We put our cursor on the homepage comit right on top of the massive branch.
|
| 680 |
+
|
| 681 |
+
171
|
| 682 |
+
00:11:53,000 --> 00:11:58,000
|
| 683 |
+
That is actually what we base does and pay attention to check some here.
|
| 684 |
+
|
| 685 |
+
172
|
| 686 |
+
00:11:58,000 --> 00:11:59,000
|
| 687 |
+
Can I see that?
|
| 688 |
+
|
| 689 |
+
173
|
| 690 |
+
00:11:59,000 --> 00:12:02,000
|
| 691 |
+
It was the same message has different checks.
|
| 692 |
+
|
| 693 |
+
174
|
| 694 |
+
00:12:03,000 --> 00:12:07,000
|
| 695 |
+
OK, well understood that our committee history is different on different branches.
|
| 696 |
+
|
| 697 |
+
175
|
| 698 |
+
00:12:07,000 --> 00:12:08,000
|
| 699 |
+
But what to do now?
|
| 700 |
+
|
| 701 |
+
176
|
| 702 |
+
00:12:08,000 --> 00:12:11,000
|
| 703 |
+
I need to tell you which version is correct.
|
| 704 |
+
|
| 705 |
+
177
|
| 706 |
+
00:12:12,000 --> 00:12:18,000
|
| 707 |
+
I know that my current branch is the most relevant branch, so I have to update my original branch so
|
| 708 |
+
|
| 709 |
+
178
|
| 710 |
+
00:12:18,000 --> 00:12:21,000
|
| 711 |
+
that it would have the same comment history as my local branch.
|
| 712 |
+
|
| 713 |
+
179
|
| 714 |
+
00:12:21,000 --> 00:12:26,000
|
| 715 |
+
To do this, I need to perform the next command, get Bush with option F.
|
| 716 |
+
|
| 717 |
+
180
|
| 718 |
+
00:12:27,000 --> 00:12:29,000
|
| 719 |
+
F stands for Force Update.
|
| 720 |
+
|
| 721 |
+
181
|
| 722 |
+
00:12:30,000 --> 00:12:37,000
|
| 723 |
+
Be extra careful when you do this, because force update will erase changes that are currently present
|
| 724 |
+
|
| 725 |
+
182
|
| 726 |
+
00:12:37,000 --> 00:12:41,000
|
| 727 |
+
in the remote repository in this branch if you are going to use from base command.
|
| 728 |
+
|
| 729 |
+
183
|
| 730 |
+
00:12:41,000 --> 00:12:45,000
|
| 731 |
+
That means sometimes you would need to use force update option.
|
| 732 |
+
|
| 733 |
+
184
|
| 734 |
+
00:12:45,000 --> 00:12:47,000
|
| 735 |
+
But one more time.
|
| 736 |
+
|
| 737 |
+
185
|
| 738 |
+
00:12:48,000 --> 00:12:49,000
|
| 739 |
+
Be extra careful.
|
| 740 |
+
|
| 741 |
+
186
|
| 742 |
+
00:12:50,000 --> 00:12:57,000
|
| 743 |
+
Use this option only with your branches, only with branches that only you are aware of, because in
|
| 744 |
+
|
| 745 |
+
187
|
| 746 |
+
00:12:57,000 --> 00:13:03,000
|
| 747 |
+
case somebody created the branch from your branch and you change history and your branch was merged,
|
| 748 |
+
|
| 749 |
+
188
|
| 750 |
+
00:13:03,000 --> 00:13:08,000
|
| 751 |
+
that will cause extra efforts for the engineer who created the branch from your branch.
|
| 752 |
+
|
| 753 |
+
189
|
| 754 |
+
00:13:08,000 --> 00:13:15,000
|
| 755 |
+
Real life example, KYAY automation engineer who is going to help you with writing your tests for your
|
| 756 |
+
|
| 757 |
+
190
|
| 758 |
+
00:13:15,000 --> 00:13:16,000
|
| 759 |
+
home.
|
| 760 |
+
|
| 761 |
+
191
|
| 762 |
+
00:13:16,000 --> 00:13:23,000
|
| 763 |
+
Carasso created his own branch from your branch, your updated comment history and merge it to the master
|
| 764 |
+
|
| 765 |
+
192
|
| 766 |
+
00:13:23,000 --> 00:13:25,000
|
| 767 |
+
key engineer can't match.
|
| 768 |
+
|
| 769 |
+
193
|
| 770 |
+
00:13:25,000 --> 00:13:32,000
|
| 771 |
+
Mostly his branch needs that your branch needs to master right now without freebasing and solving conflicts
|
| 772 |
+
|
| 773 |
+
194
|
| 774 |
+
00:13:32,000 --> 00:13:33,000
|
| 775 |
+
one more time.
|
| 776 |
+
|
| 777 |
+
195
|
| 778 |
+
00:13:33,000 --> 00:13:39,000
|
| 779 |
+
Or imagine that key engineer merged his or her changes into your branch.
|
| 780 |
+
|
| 781 |
+
196
|
| 782 |
+
00:13:39,000 --> 00:13:46,000
|
| 783 |
+
And by applying for update, he overrides those changes and the documents were lost.
|
| 784 |
+
|
| 785 |
+
197
|
| 786 |
+
00:13:46,000 --> 00:13:51,000
|
| 787 |
+
This even sounds complicated, so please try to avoid this.
|
| 788 |
+
|
| 789 |
+
198
|
| 790 |
+
00:13:52,000 --> 00:13:58,000
|
| 791 |
+
Today, we're going to create a few rules that will save you a ton of time and your nerves in the future.
|
| 792 |
+
|
| 793 |
+
199
|
| 794 |
+
00:13:58,000 --> 00:14:01,000
|
| 795 |
+
I call this rules for rules of happy workwise.
|
| 796 |
+
|
| 797 |
+
200
|
| 798 |
+
00:14:01,000 --> 00:14:03,000
|
| 799 |
+
Get by and repeat the rule.
|
| 800 |
+
|
| 801 |
+
201
|
| 802 |
+
00:14:03,000 --> 00:14:09,000
|
| 803 |
+
Number one, always create branches from the master branch, but not from the other development branches.
|
| 804 |
+
|
| 805 |
+
202
|
| 806 |
+
00:14:10,000 --> 00:14:18,000
|
| 807 |
+
Rule number two, force update only your own branches that you can be sure nobody using because of the
|
| 808 |
+
|
| 809 |
+
203
|
| 810 |
+
00:14:18,000 --> 00:14:21,000
|
| 811 |
+
risk of losing data force is very risky mode.
|
| 812 |
+
|
| 813 |
+
204
|
| 814 |
+
00:14:22,000 --> 00:14:27,000
|
| 815 |
+
What is less risky is the rule of thumb is using force with less option.
|
| 816 |
+
|
| 817 |
+
205
|
| 818 |
+
00:14:27,000 --> 00:14:35,000
|
| 819 |
+
What is this about force, which is a safer option that will not override any work on the remote branch
|
| 820 |
+
|
| 821 |
+
206
|
| 822 |
+
00:14:35,000 --> 00:14:39,000
|
| 823 |
+
if more comments were added to the remote branch by another team member.
|
| 824 |
+
|
| 825 |
+
207
|
| 826 |
+
00:14:39,000 --> 00:14:42,000
|
| 827 |
+
Based on this, let's make rule number three.
|
| 828 |
+
|
| 829 |
+
208
|
| 830 |
+
00:14:42,000 --> 00:14:47,000
|
| 831 |
+
When you need to use force update, always use force with less option.
|
| 832 |
+
|
| 833 |
+
209
|
| 834 |
+
00:14:47,000 --> 00:14:52,000
|
| 835 |
+
I can't even count how much time this simple rule saves me tons of time.
|
| 836 |
+
|
| 837 |
+
210
|
| 838 |
+
00:14:53,000 --> 00:14:56,000
|
| 839 |
+
So we use force with this option.
|
| 840 |
+
|
| 841 |
+
211
|
| 842 |
+
00:14:56,000 --> 00:14:57,000
|
| 843 |
+
Let's press enter button.
|
| 844 |
+
|
| 845 |
+
212
|
| 846 |
+
00:14:58,000 --> 00:15:04,000
|
| 847 |
+
Take into account no update in my branch, I successfully updated my branch in the remote repository
|
| 848 |
+
|
| 849 |
+
213
|
| 850 |
+
00:15:04,000 --> 00:15:07,000
|
| 851 |
+
and my request let's check my power now.
|
| 852 |
+
|
| 853 |
+
214
|
| 854 |
+
00:15:08,000 --> 00:15:09,000
|
| 855 |
+
Can you see this?
|
| 856 |
+
|
| 857 |
+
215
|
| 858 |
+
00:15:09,000 --> 00:15:15,000
|
| 859 |
+
I have one comment instead of two and also check some of the comment, carrousel on the home page is
|
| 860 |
+
|
| 861 |
+
216
|
| 862 |
+
00:15:15,000 --> 00:15:16,000
|
| 863 |
+
changed.
|
| 864 |
+
|
| 865 |
+
217
|
| 866 |
+
00:15:17,000 --> 00:15:19,000
|
| 867 |
+
Now I can use Rebase and my strategy.
|
| 868 |
+
|
| 869 |
+
218
|
| 870 |
+
00:15:20,000 --> 00:15:21,000
|
| 871 |
+
That is awesome.
|
| 872 |
+
|
| 873 |
+
219
|
| 874 |
+
00:15:21,000 --> 00:15:25,000
|
| 875 |
+
We did this together and now it is time for the rule number four.
|
| 876 |
+
|
| 877 |
+
220
|
| 878 |
+
00:15:26,000 --> 00:15:29,000
|
| 879 |
+
Rule number four always are based on a region.
|
| 880 |
+
|
| 881 |
+
221
|
| 882 |
+
00:15:29,000 --> 00:15:31,000
|
| 883 |
+
Must have brunch before creating a comet.
|
| 884 |
+
|
| 885 |
+
222
|
| 886 |
+
00:15:32,000 --> 00:15:34,000
|
| 887 |
+
Now you know how to replace and M..
|
| 888 |
+
|
| 889 |
+
223
|
| 890 |
+
00:15:35,000 --> 00:15:41,000
|
| 891 |
+
I would even say that this is a best practice to rule based on the region master as often as you can
|
| 892 |
+
|
| 893 |
+
224
|
| 894 |
+
00:15:41,000 --> 00:15:47,000
|
| 895 |
+
to fix conflicts gradually and to test your implementation on the latest version of the code during
|
| 896 |
+
|
| 897 |
+
225
|
| 898 |
+
00:15:47,000 --> 00:15:50,000
|
| 899 |
+
the development to not spend a lot of time.
|
| 900 |
+
|
| 901 |
+
226
|
| 902 |
+
00:15:50,000 --> 00:15:56,000
|
| 903 |
+
When you worked one week on your task and after solving all conflicts, you realized that feature doesn't
|
| 904 |
+
|
| 905 |
+
227
|
| 906 |
+
00:15:56,000 --> 00:15:57,000
|
| 907 |
+
work as expected.
|
| 908 |
+
|
| 909 |
+
228
|
| 910 |
+
00:15:57,000 --> 00:16:00,000
|
| 911 |
+
OK, which is really a lot today.
|
| 912 |
+
|
| 913 |
+
229
|
| 914 |
+
00:16:00,000 --> 00:16:02,000
|
| 915 |
+
Let's recap what we have learned today.
|
| 916 |
+
|
| 917 |
+
230
|
| 918 |
+
00:16:03,000 --> 00:16:04,000
|
| 919 |
+
In this lesson.
|
| 920 |
+
|
| 921 |
+
231
|
| 922 |
+
00:16:04,000 --> 00:16:09,000
|
| 923 |
+
We learned what the basis we understood the difference between merge and rebase.
|
| 924 |
+
|
| 925 |
+
232
|
| 926 |
+
00:16:09,000 --> 00:16:15,000
|
| 927 |
+
We tried to answer the question, what is better to use it, merge or get rebates from different points
|
| 928 |
+
|
| 929 |
+
233
|
| 930 |
+
00:16:15,000 --> 00:16:15,000
|
| 931 |
+
of view?
|
| 932 |
+
|
| 933 |
+
234
|
| 934 |
+
00:16:16,000 --> 00:16:19,000
|
| 935 |
+
One real example, you saw how a command works.
|
| 936 |
+
|
| 937 |
+
235
|
| 938 |
+
00:16:19,000 --> 00:16:22,000
|
| 939 |
+
You know, when you need to execute, get from base, continued command.
|
| 940 |
+
|
| 941 |
+
236
|
| 942 |
+
00:16:23,000 --> 00:16:27,000
|
| 943 |
+
Also Villon, when we need to use force update mode.
|
| 944 |
+
|
| 945 |
+
237
|
| 946 |
+
00:16:27,000 --> 00:16:31,000
|
| 947 |
+
And how fast was this option can help us to not override other comments.
|
| 948 |
+
|
| 949 |
+
238
|
| 950 |
+
00:16:32,000 --> 00:16:36,000
|
| 951 |
+
And at the end of the lesson we reviewed for roles, have happy work with it.
|
| 952 |
+
|
| 953 |
+
239
|
| 954 |
+
00:16:36,000 --> 00:16:38,000
|
| 955 |
+
We learned a lot today.
|
| 956 |
+
|
| 957 |
+
240
|
| 958 |
+
00:16:38,000 --> 00:16:40,000
|
| 959 |
+
I'm really happy you saw this lesson.
|
| 960 |
+
|
| 961 |
+
241
|
| 962 |
+
00:16:41,000 --> 00:16:42,000
|
| 963 |
+
Thanks a lot for your attention.
|
| 964 |
+
|
| 965 |
+
242
|
| 966 |
+
00:16:42,000 --> 00:16:46,000
|
| 967 |
+
The students have agreed the rest of the day and see you in the next lesson.
|
| 968 |
+
|
17 - GIT/014 Git Interactive Rebase_en.srt
ADDED
|
@@ -0,0 +1,540 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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| 9 |
+
3
|
| 10 |
+
00:00:10,000 --> 00:00:15,000
|
| 11 |
+
Today, I will show you when and how you can use interactive free based on real examples.
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:15,000 --> 00:00:20,000
|
| 15 |
+
I will show you how you can change any message from your repository history and we'll show you how to
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:20,000 --> 00:00:22,000
|
| 19 |
+
combine to commit into one.
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:22,000 --> 00:00:25,000
|
| 23 |
+
After this lesson, you learn how to squash it.
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:26,000 --> 00:00:30,000
|
| 27 |
+
I will share with you best practices of working with give and keep good history clean.
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:31,000 --> 00:00:35,000
|
| 31 |
+
Let's start and we will start from the example that we had in previous lesson.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:35,000 --> 00:00:40,000
|
| 35 |
+
Imagine that the men on the task branch, you understood that you have to do one more comment.
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:41,000 --> 00:00:43,000
|
| 39 |
+
Probably you forgot to add some styles.
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:43,000 --> 00:00:50,000
|
| 43 |
+
For the sake of example, let me adjust carousel to assess file nonhostile slash carousel dot to assess.
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:51,000 --> 00:00:55,000
|
| 47 |
+
I will just put new ones here to not spend a lot of time on modifying this file.
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:56,000 --> 00:01:03,000
|
| 51 |
+
I add these changes to the staging area get at DOT and now you need to include latest changes into your
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:01:03,000 --> 00:01:03,000
|
| 55 |
+
branch.
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:01:03,000 --> 00:01:04,000
|
| 59 |
+
What you can do.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:01:05,000 --> 00:01:09,000
|
| 63 |
+
The first option, which we have already learned, and which I want to remind you is to amend the last
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:09,000 --> 00:01:11,000
|
| 67 |
+
commit like this yet come.
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:11,000 --> 00:01:15,000
|
| 71 |
+
It was optional and was optional added.
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:15,000 --> 00:01:19,000
|
| 75 |
+
This will allow you to change your latest commit without changing commit message.
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:19,000 --> 00:01:25,000
|
| 79 |
+
But let's pretend you didn't want to amend commit for some reasons and want to create one more comment.
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:26,000 --> 00:01:30,000
|
| 83 |
+
When you're dealing with comments that were merged into your branch by a colleague of yours who doesn't
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:30,000 --> 00:01:32,000
|
| 87 |
+
know, get as good as you are.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:32,000 --> 00:01:35,000
|
| 91 |
+
And that's why you have Xhaka credit for this change.
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:36,000 --> 00:01:37,000
|
| 95 |
+
Let me create a committee now.
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:38,000 --> 00:01:41,000
|
| 99 |
+
You can meet with Option M to assess class for homecare.
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:41,000 --> 00:01:46,000
|
| 103 |
+
So Slider is added, OK, and now you have to comments on your branch.
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:46,000 --> 00:01:48,000
|
| 107 |
+
Let's add one more comment.
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:48,000 --> 00:01:51,000
|
| 111 |
+
We need this to have at least three comments to play with on our branch.
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:01:52,000 --> 00:01:55,000
|
| 115 |
+
That is for the sake of the demo, the same as before.
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:01:55,000 --> 00:02:03,000
|
| 119 |
+
I will quickly adjust our two file and I will create one more snapshot nonhostile slash Carasso dot
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:03,000 --> 00:02:05,000
|
| 123 |
+
to assess engine your lines here.
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:07,000 --> 00:02:13,000
|
| 127 |
+
You'd commit dash a dash and one Monticello's glass for home Kurzel Slider is added.
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:16,000 --> 00:02:18,000
|
| 131 |
+
OK, now we have three comments.
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:19,000 --> 00:02:23,000
|
| 135 |
+
Imagine that you are not happy with Canet message and want to change it.
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:23,000 --> 00:02:25,000
|
| 139 |
+
What options do you have to adjust?
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:25,000 --> 00:02:32,000
|
| 143 |
+
Can it get can it was option amand but what if you don't want to change economic message for the latest
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:32,000 --> 00:02:32,000
|
| 147 |
+
comment?
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:33,000 --> 00:02:37,000
|
| 151 |
+
What if you want to change economic message that goes right before the last one?
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:37,000 --> 00:02:39,000
|
| 155 |
+
Interactive information will help you with this.
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:40,000 --> 00:02:42,000
|
| 159 |
+
What is interactive freebase?
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:42,000 --> 00:02:44,000
|
| 163 |
+
Interactive Freebasing?
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:02:44,000 --> 00:02:49,000
|
| 167 |
+
It makes it easy to clean up your comments before they get based or moved onto another branch.
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:02:50,000 --> 00:02:59,000
|
| 171 |
+
Military base was option I had to the three I stands for interactive free base, we want to proceed
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:02:59,000 --> 00:03:02,000
|
| 175 |
+
with interactive rebates for last's recommits.
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:02,000 --> 00:03:04,000
|
| 179 |
+
That's why I wrote Hand.
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:04,000 --> 00:03:06,000
|
| 183 |
+
That is a pointer to our current state.
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:06,000 --> 00:03:07,000
|
| 187 |
+
Delusory.
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:08,000 --> 00:03:10,000
|
| 191 |
+
That means recommits back from the current one.
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:11,000 --> 00:03:12,000
|
| 195 |
+
Lets press enter now.
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:13,000 --> 00:03:13,000
|
| 199 |
+
Awesome.
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:14,000 --> 00:03:19,000
|
| 203 |
+
Here we see our three last Kummetz starting from the latest to the newest.
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:19,000 --> 00:03:25,000
|
| 207 |
+
And I see that the change message I have to write are letter near the camp where I want to change cammed
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:25,000 --> 00:03:31,000
|
| 211 |
+
message and I want to change not the last message but commit message that goes before the last one.
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:32,000 --> 00:03:38,000
|
| 215 |
+
So I put our letter next to the USS Glassful home carrousel is added commit message.
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:39,000 --> 00:03:46,000
|
| 219 |
+
I say file by pressing control and s and close the text editor in this window we can change comit message
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:46,000 --> 00:03:47,000
|
| 223 |
+
as we wish.
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:03:47,000 --> 00:03:54,000
|
| 227 |
+
Let's add more details to first class for scrolling Carasso on the home page is added.
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:03:55,000 --> 00:04:01,000
|
| 231 |
+
Now, let's save this file and close the text editor here, you can see notification that we successfully
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:04:01,000 --> 00:04:02,000
|
| 235 |
+
based and updated the branch.
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:04:03,000 --> 00:04:06,000
|
| 239 |
+
Let's check in with history, long story.
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:07,000 --> 00:04:14,000
|
| 243 |
+
And we can see that my message for this CANET and check some of this can it was changed grade after
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:14,000 --> 00:04:15,000
|
| 247 |
+
we changed the message for comment.
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:15,000 --> 00:04:21,000
|
| 251 |
+
We took a look at our branch history one more time and realize that it is way too many comments about
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:21,000 --> 00:04:22,000
|
| 255 |
+
the same thing.
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:22,000 --> 00:04:26,000
|
| 259 |
+
We have three comments right now for the one single piece of functionality.
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:27,000 --> 00:04:32,000
|
| 263 |
+
We know that in case we would put this change to the remote repository, our tech might be disappointed.
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:32,000 --> 00:04:33,000
|
| 267 |
+
Why?
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:33,000 --> 00:04:37,000
|
| 271 |
+
Because was the one single task grade style and focus on the home page.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:38,000 --> 00:04:40,000
|
| 275 |
+
We have three committees right now.
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:04:40,000 --> 00:04:46,000
|
| 279 |
+
Instead of having one single command, your tablet might ask you to squash comments in order to keep
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:04:46,000 --> 00:04:47,000
|
| 283 |
+
Guitry clean.
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:04:47,000 --> 00:04:48,000
|
| 287 |
+
What does squash mean?
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:04:49,000 --> 00:04:55,000
|
| 291 |
+
In other words, you can combine two or more commands into the one to ensure clean good history.
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:04:55,000 --> 00:05:02,000
|
| 295 |
+
You can mount Kummetz so they would disappear, but not the changes which were done in scope of these
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:05:02,000 --> 00:05:03,000
|
| 299 |
+
snapshots.
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:04,000 --> 00:05:09,000
|
| 303 |
+
Let's imagine the case that during the development of your task, you get multiple commands and after
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:09,000 --> 00:05:14,000
|
| 307 |
+
that you realized that it would be better to have either one commit a group, commit in a different
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:14,000 --> 00:05:16,000
|
| 311 |
+
manner how to do this.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:17,000 --> 00:05:20,000
|
| 315 |
+
Interactive rebase will help us also with this task.
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:20,000 --> 00:05:22,000
|
| 319 |
+
Guitry base was option.
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:22,000 --> 00:05:24,000
|
| 323 |
+
I had killed the three.
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:25,000 --> 00:05:26,000
|
| 327 |
+
You're already familiar with this command.
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:27,000 --> 00:05:31,000
|
| 331 |
+
You can specify as many comments backwards as you want instead of three.
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:05:31,000 --> 00:05:36,000
|
| 335 |
+
I am specifying only three right now because we all remember four rules of happy work with Gaete.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:05:36,000 --> 00:05:42,000
|
| 339 |
+
From the previous lesson, I can modify only commands that are on my branch but not commit that already
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:05:42,000 --> 00:05:48,000
|
| 343 |
+
exist and must have branch I press and at the same time in history, as we already saw today, was ablated
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:05:48,000 --> 00:05:49,000
|
| 347 |
+
commit message.
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:05:50,000 --> 00:05:54,000
|
| 351 |
+
We can see that to combine commands we can use either squash or fix up.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:05:54,000 --> 00:05:56,000
|
| 355 |
+
Will you squash one.
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:05:56,000 --> 00:05:58,000
|
| 359 |
+
We want to change it message and fix up one.
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:05:58,000 --> 00:05:59,000
|
| 363 |
+
We want to keep coming.
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:05:59,000 --> 00:06:01,000
|
| 367 |
+
The message of the first command.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:02,000 --> 00:06:07,000
|
| 371 |
+
Most likely if you combine multiple commands, you want to reflect this in the correct message.
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:07,000 --> 00:06:11,000
|
| 375 |
+
That's why more often you're going to squash rather than fix.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:11,000 --> 00:06:15,000
|
| 379 |
+
An important thing to mention here, you can squash the first commit in the list.
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:16,000 --> 00:06:23,000
|
| 383 |
+
In other words, here in the first row, you should have to be able to squash all the comments I wrote
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:06:23,000 --> 00:06:27,000
|
| 387 |
+
as letter near to commit s stands for squash.
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:06:28,000 --> 00:06:30,000
|
| 391 |
+
And in case you forgot, you can find other shorthands here.
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:06:31,000 --> 00:06:38,000
|
| 395 |
+
I press control and ask to save the file and close it now and ask my I to address commit message.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:06:39,000 --> 00:06:42,000
|
| 399 |
+
I see the command lines and commit messages of my other comments.
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:06:43,000 --> 00:06:47,000
|
| 403 |
+
Let me clean this up a bit and leave the one message which I'd like to keep.
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:06:47,000 --> 00:06:51,000
|
| 407 |
+
In addition to this one I want to add a few words is styled.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:06:52,000 --> 00:06:54,000
|
| 411 |
+
I save the file and close it.
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:06:54,000 --> 00:06:56,000
|
| 415 |
+
I see a message that I successfully replaced.
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:06:57,000 --> 00:06:59,000
|
| 419 |
+
What else potentially might happen here?
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:06:59,000 --> 00:07:06,000
|
| 423 |
+
Potentially you can see a message about much conflict during are basin similar to the one you saw in
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:06,000 --> 00:07:07,000
|
| 427 |
+
previous lesson.
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:07,000 --> 00:07:13,000
|
| 431 |
+
Take into account you combine comments that might be merged conflicts, but you don't really know how
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:13,000 --> 00:07:15,000
|
| 435 |
+
to deal with conflicts during the invasion.
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:15,000 --> 00:07:20,000
|
| 439 |
+
Since we showed this in the previous lesson, let's check our command history now.
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:07:20,000 --> 00:07:22,000
|
| 443 |
+
Get log dash three.
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:07:23,000 --> 00:07:27,000
|
| 447 |
+
Great, you can see our comment was updated message and pay attention.
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:07:27,000 --> 00:07:34,000
|
| 451 |
+
You took some if checksum is different, your you know, that pushed the remote repository will be rejected.
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:07:34,000 --> 00:07:39,000
|
| 455 |
+
Beside our audit committee here, you can see all the comments from the remote master branch.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:07:39,000 --> 00:07:45,000
|
| 459 |
+
And we can see here our chametz, where we adjusted Susanne's file because they're mounted.
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:07:45,000 --> 00:07:47,000
|
| 463 |
+
But the changes are in place.
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:07:47,000 --> 00:07:55,000
|
| 467 |
+
We can open our chasez file just to check this Nuna styles, Desh, Castle, Dot to assess and find
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:07:55,000 --> 00:07:56,000
|
| 471 |
+
that newlines.
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:07:56,000 --> 00:08:00,000
|
| 475 |
+
Edit editing first commit and new line so that you're in the second place.
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:08:00,000 --> 00:08:04,000
|
| 479 |
+
We can count number of new lines, but I believe it is even visually obvious.
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:05,000 --> 00:08:10,000
|
| 483 |
+
We did all we wanted and you already know that in case there is a difference between comment history
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:10,000 --> 00:08:16,000
|
| 487 |
+
and my local branch and remote branch, we need to for update our remote repository and unpressed lesson
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:16,000 --> 00:08:18,000
|
| 491 |
+
learned best practices.
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:18,000 --> 00:08:23,000
|
| 495 |
+
And we are going to use force with at least now used brute force with less.
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:08:23,000 --> 00:08:28,000
|
| 499 |
+
We added additional changes and combine them in one snapshot and updated our budget request.
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:08:29,000 --> 00:08:33,000
|
| 503 |
+
This will make you happy on your future project, I promise you.
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:08:33,000 --> 00:08:36,000
|
| 507 |
+
Now let's recap what we have learned today.
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:08:36,000 --> 00:08:39,000
|
| 511 |
+
In this lesson we learned what interactive rebase is.
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:08:39,000 --> 00:08:42,000
|
| 515 |
+
You learn how to start interactive replays.
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:08:42,000 --> 00:08:48,000
|
| 519 |
+
You saw how you can change any commitments that in your repository after this lesson, you also know
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:08:48,000 --> 00:08:50,000
|
| 523 |
+
how to combine few comments together.
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:08:51,000 --> 00:08:54,000
|
| 527 |
+
We learned best practices of working with Gaede today.
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:08:55,000 --> 00:08:56,000
|
| 531 |
+
That's all for now.
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:08:56,000 --> 00:08:58,000
|
| 535 |
+
Thanks a lot for your attention.
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:08:58,000 --> 00:08:59,000
|
| 539 |
+
See you in the next lesson.
|
| 540 |
+
|
17 - GIT/015 Git reset_en.srt
ADDED
|
@@ -0,0 +1,656 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1
|
| 2 |
+
00:00:06,000 --> 00:00:10,000
|
| 3 |
+
Hello, dear students, in this lesson, we are going to learn in detail what is Guter said command
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:10,000 --> 00:00:12,000
|
| 7 |
+
and how we can use it.
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:12,000 --> 00:00:17,000
|
| 11 |
+
We'll start from the problem statement and when we might want to use it afterwards.
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:17,000 --> 00:00:21,000
|
| 15 |
+
We'll learn in theory how it works to understand how users networks will.
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:21,000 --> 00:00:29,000
|
| 19 |
+
Compared with Check-Out Command, we'll use three different modes how to reset my work served mixed
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:29,000 --> 00:00:29,000
|
| 23 |
+
and hard.
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:30,000 --> 00:00:31,000
|
| 27 |
+
Besides a series overview.
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:31,000 --> 00:00:32,000
|
| 31 |
+
One real example.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:32,000 --> 00:00:36,000
|
| 35 |
+
I'm going to show you how you might use this command in your repository.
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:36,000 --> 00:00:37,000
|
| 39 |
+
Let's start.
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:38,000 --> 00:00:41,000
|
| 43 |
+
So why do you need to use get reset command, get reset.
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:41,000 --> 00:00:45,000
|
| 47 |
+
Command is a really powerful tool that will help you to undo changes.
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:46,000 --> 00:00:52,000
|
| 51 |
+
It might happen that you created snapshots that you don't need anymore, or probably for some reasons
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:00:52,000 --> 00:00:57,000
|
| 55 |
+
you want to remove commands from your local branch, but you don't want to remove changes from your
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:00:57,000 --> 00:01:00,000
|
| 59 |
+
working directory for such cases.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:01:00,000 --> 00:01:00,000
|
| 63 |
+
Get reset.
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:00,000 --> 00:01:02,000
|
| 67 |
+
Command might be used.
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:03,000 --> 00:01:05,000
|
| 71 |
+
You can find tutorials on the Internet.
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:05,000 --> 00:01:10,000
|
| 75 |
+
But in my opinion, they're really hard to understand for the people who have never had experience with
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:10,000 --> 00:01:10,000
|
| 79 |
+
it.
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:11,000 --> 00:01:16,000
|
| 83 |
+
That's why in this lesson, I will try to explain this topic from the practical point of view to help
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:16,000 --> 00:01:20,000
|
| 87 |
+
you understand the topic better to understand how to reset command work.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:20,000 --> 00:01:22,000
|
| 91 |
+
Let's compare it with Check-Out Command.
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:23,000 --> 00:01:29,000
|
| 95 |
+
Here's our Master Branch and here's our head pointer that points to the latest snapshot on this branch.
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:29,000 --> 00:01:35,000
|
| 99 |
+
So what happened when we call you checkout command, when we try to switch to another commit?
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:36,000 --> 00:01:41,000
|
| 103 |
+
We can execute Gitche called command with the region, checksum where we want to switch our head pointer
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:42,000 --> 00:01:48,000
|
| 107 |
+
in this particular scenario, if checksum is me, then I can move head pointer by executing command
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:48,000 --> 00:01:53,000
|
| 111 |
+
Check-Out B But the master branch is still pointing out to the latest command here.
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:01:54,000 --> 00:01:59,000
|
| 115 |
+
If you remember, during one of our lessons we discussed Detached Heads State.
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:01:59,000 --> 00:02:02,000
|
| 119 |
+
This is exactly the scenario of detached head.
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:02,000 --> 00:02:06,000
|
| 123 |
+
So what does research come and do that is different from Chicot?
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:06,000 --> 00:02:07,000
|
| 127 |
+
Come on.
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:08,000 --> 00:02:10,000
|
| 131 |
+
In the case I will use gets reset command.
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:10,000 --> 00:02:16,000
|
| 135 |
+
We check some of the specific revision that will move both head pointer and current branch pointer to
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:16,000 --> 00:02:17,000
|
| 139 |
+
the specific revision.
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:18,000 --> 00:02:19,000
|
| 143 |
+
That's what it always does.
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:19,000 --> 00:02:22,000
|
| 147 |
+
No matter what option will be used with reset command.
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:23,000 --> 00:02:25,000
|
| 151 |
+
Can you see the difference on this visualization?
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:26,000 --> 00:02:29,000
|
| 155 |
+
Hope it is clear now what reset command does.
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:29,000 --> 00:02:36,000
|
| 159 |
+
But besides updating of command pointers like head pointer and branch pointer, reset command will also
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:36,000 --> 00:02:40,000
|
| 163 |
+
update the state of our staging area and update the state of our country.
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:02:40,000 --> 00:02:42,000
|
| 167 |
+
That is our files in our file system.
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:02:43,000 --> 00:02:48,000
|
| 171 |
+
Updates in the staging area and our country will be different depending on what mode of reset we are
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:02:48,000 --> 00:02:51,000
|
| 175 |
+
going to use as a result from agenda.
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:02:51,000 --> 00:02:55,000
|
| 179 |
+
There are three possible modes soft, mixed and hard.
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:02:56,000 --> 00:03:00,000
|
| 183 |
+
Let's learn right now what will happen in case we reset in soft mode.
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:00,000 --> 00:03:06,000
|
| 187 |
+
If we use get reset with soft option, we still move ahead and branch pointers to the specific region
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:06,000 --> 00:03:07,000
|
| 191 |
+
and that's it.
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:07,000 --> 00:03:13,000
|
| 195 |
+
Nice and above that changes from your working tree will be there and in the staging area.
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:14,000 --> 00:03:20,000
|
| 199 |
+
In simple words, the changes that you did in files before reset and commit these changes, you will
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:20,000 --> 00:03:22,000
|
| 203 |
+
be present in files of your project.
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:22,000 --> 00:03:28,000
|
| 207 |
+
Moreover, these changes will be in the staging area in case after asset in soft mode.
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:28,000 --> 00:03:30,000
|
| 211 |
+
You would call your status command.
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:30,000 --> 00:03:34,000
|
| 215 |
+
You would find all your changes added to the staging area in green color.
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:35,000 --> 00:03:40,000
|
| 219 |
+
Execution of command is going to lead you directly to the state where you were before 7:00.
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:41,000 --> 00:03:46,000
|
| 223 |
+
Here on this slide, you can see that soft mode keeps all changes in the staging area.
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:03:46,000 --> 00:03:50,000
|
| 227 |
+
In case you are going to use mixed option, it is similar to softwoods.
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:03:50,000 --> 00:03:57,000
|
| 231 |
+
Only one difference changes still will be present in the working directory, but they won't be present
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:03:57,000 --> 00:03:58,000
|
| 235 |
+
in the staging area.
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:03:58,000 --> 00:04:04,000
|
| 239 |
+
In simple words, you still will be able to find the changes in files, but when you will call git status,
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:05,000 --> 00:04:08,000
|
| 243 |
+
you're going to see that all changes are not added to the staging area.
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:09,000 --> 00:04:15,000
|
| 247 |
+
You would need to perform it add and after that you commit command in case you want to restore the state
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:15,000 --> 00:04:20,000
|
| 251 |
+
before setting the previous two options you might want to use when you kind of okay with changes that
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:20,000 --> 00:04:21,000
|
| 255 |
+
you have done.
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:21,000 --> 00:04:24,000
|
| 259 |
+
But you have to do some modifications in the good history.
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:24,000 --> 00:04:26,000
|
| 263 |
+
The first option for that is really hard.
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:27,000 --> 00:04:32,000
|
| 267 |
+
This is the most direct and dangerous option that is frequently used after executing this reset.
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:32,000 --> 00:04:34,000
|
| 271 |
+
Command was a hard option.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:34,000 --> 00:04:41,000
|
| 275 |
+
Get will make sure that your staging area and are working very much that of the specific commit in simple
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:04:41,000 --> 00:04:48,000
|
| 279 |
+
words, your file system will be the same as it was after which you specified in reset command when
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:04:48,000 --> 00:04:49,000
|
| 283 |
+
this mode is needed.
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:04:49,000 --> 00:04:55,000
|
| 287 |
+
Personally, I used this command a lot when I realized that I messed up completely the state of my files
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:04:55,000 --> 00:04:59,000
|
| 291 |
+
and I want to get everything back as it was when it worked, at least somehow.
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:05:00,000 --> 00:05:03,000
|
| 295 |
+
Sometimes you might want to reset the state of some specific revision.
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:05:04,000 --> 00:05:09,000
|
| 299 |
+
Probably you want to reset state of your local repository to the state that you have in the remote repository.
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:09,000 --> 00:05:12,000
|
| 303 |
+
You might want to do so in case something went wrong.
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:12,000 --> 00:05:15,000
|
| 307 |
+
During The Amazing today you're in the demo.
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:15,000 --> 00:05:18,000
|
| 311 |
+
I will show you how to reset your changes in different modes.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:19,000 --> 00:05:24,000
|
| 315 |
+
Now, when you understood the theory, let's practice a bit and I'll show you how you can use gets reset
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:24,000 --> 00:05:25,000
|
| 319 |
+
command in different modes.
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:26,000 --> 00:05:27,000
|
| 323 |
+
We are on the Master Branch.
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:27,000 --> 00:05:32,000
|
| 327 |
+
Let's check our gate history gate log dash three.
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:32,000 --> 00:05:35,000
|
| 331 |
+
Here is a command that we did during this course.
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:05:35,000 --> 00:05:39,000
|
| 335 |
+
You remember we added stock management service and created separate snapshots for that.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:05:40,000 --> 00:05:44,000
|
| 339 |
+
Afterwards we credit card management service file and created separate snapshots for that.
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:05:45,000 --> 00:05:53,000
|
| 343 |
+
And after that I did create HTML file homeport HTML for our lessons to understand much conflict topic.
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:05:53,000 --> 00:05:54,000
|
| 347 |
+
Remember that.
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:05:54,000 --> 00:06:00,000
|
| 351 |
+
Let me show you, for example, that after soft reset to the state of the Stock Management Command Card
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:06:00,000 --> 00:06:06,000
|
| 355 |
+
Management Service and home e-mail are still present in the country, but the state of the branch and
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:06:06,000 --> 00:06:07,000
|
| 359 |
+
head pointer is different.
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:08,000 --> 00:06:17,000
|
| 363 |
+
Guter said was option soft e 71, A five, b, I entered first characters of this commit and press enter.
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:17,000 --> 00:06:21,000
|
| 367 |
+
Let's check our comment history to understand where we are now.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:21,000 --> 00:06:22,000
|
| 371 |
+
Get lost there.
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:22,000 --> 00:06:28,000
|
| 375 |
+
Three You see here in parenthesis that our head and master pointers are on this comment.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:29,000 --> 00:06:36,000
|
| 379 |
+
Let me check its status and its status and you can see the two files from the documents are present
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:36,000 --> 00:06:42,000
|
| 383 |
+
in my file system and automatically added to the staging area to return my project to the state where
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:06:42,000 --> 00:06:43,000
|
| 387 |
+
it was before the reset.
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:06:43,000 --> 00:06:50,000
|
| 391 |
+
But with a new command, I have to come them one more time, get command with option and court management
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:06:50,000 --> 00:06:51,000
|
| 395 |
+
and home HMO.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:06:52,000 --> 00:06:55,000
|
| 399 |
+
And we created new command with these changes.
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:06:55,000 --> 00:07:02,000
|
| 403 |
+
Now I want to demo to you makes the more me find commands that we recently used and just change it a
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:07:02,000 --> 00:07:02,000
|
| 407 |
+
bit.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:07:03,000 --> 00:07:03,000
|
| 411 |
+
Here it is.
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:07:04,000 --> 00:07:07,000
|
| 415 |
+
Let me removed soft here, by the way.
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:07,000 --> 00:07:08,000
|
| 419 |
+
Mixed mode is a default.
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:09,000 --> 00:07:12,000
|
| 423 |
+
That means you shouldn't necessarily write me here.
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:13,000 --> 00:07:15,000
|
| 427 |
+
You can just remove any options here.
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:15,000 --> 00:07:18,000
|
| 431 |
+
That would mean resetting in the default mixed mode.
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:18,000 --> 00:07:22,000
|
| 435 |
+
Let me check it lock now it log Destry.
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:22,000 --> 00:07:28,000
|
| 439 |
+
I'm on the committee where I wanted to be and like check status now get status.
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:07:28,000 --> 00:07:33,000
|
| 443 |
+
And you can see that files are present in my work entry in my file system, but they are not in the
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:07:33,000 --> 00:07:34,000
|
| 447 |
+
staging area.
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:07:35,000 --> 00:07:38,000
|
| 451 |
+
Can you understand the difference between soft and mixed mode now?
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:07:39,000 --> 00:07:44,000
|
| 455 |
+
The return the previous state I should execute get at DOD command and after that it changes.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:07:45,000 --> 00:07:48,000
|
| 459 |
+
Let's use the same messages previously for the sake of the demo.
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:07:49,000 --> 00:07:56,000
|
| 463 |
+
Awesome, and let me show you the last but not the least option, hard lessons said enhancement to this
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:07:56,000 --> 00:07:59,000
|
| 467 |
+
commit spaces are added to the hello world.
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:07:59,000 --> 00:08:06,000
|
| 471 |
+
While we should see how the state of our file system will be different from that e-mail, card management
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:08:06,000 --> 00:08:09,000
|
| 475 |
+
servers and stock management service files would disappear.
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:08:10,000 --> 00:08:14,000
|
| 479 |
+
Let's reset resorption heart two six seven two six F..
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:15,000 --> 00:08:16,000
|
| 483 |
+
Let's check in with history now.
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:17,000 --> 00:08:18,000
|
| 487 |
+
Get logged three.
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:19,000 --> 00:08:25,000
|
| 491 |
+
OK, our head pointer and branch are pointing to the committee that we expect, but what is with our
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:25,000 --> 00:08:26,000
|
| 495 |
+
filesystem now?
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:08:27,000 --> 00:08:34,000
|
| 499 |
+
It's status and we can see that there is nothing to commit, and that is my voluntary claim, I'm in
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:08:34,000 --> 00:08:36,000
|
| 503 |
+
the Israeli folder right now.
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:08:36,000 --> 00:08:44,000
|
| 507 |
+
Let me check the state of the file system unless there shall we can see that I have only discount completion
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:08:44,000 --> 00:08:45,000
|
| 511 |
+
service and hello, world file.
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:08:45,000 --> 00:08:50,000
|
| 515 |
+
I do not have Nasacort nor stock folders where my other files were stored.
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:08:51,000 --> 00:08:54,000
|
| 519 |
+
Now you can see how it was that was hard option, Kenora said.
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:08:54,000 --> 00:08:56,000
|
| 523 |
+
The state of the file system.
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:08:56,000 --> 00:08:59,000
|
| 527 |
+
One more trick, probably in some lessons.
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:08:59,000 --> 00:09:05,000
|
| 531 |
+
You saw that I researched state of the branch without reference to the specific checks, but using relative
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:09:05,000 --> 00:09:07,000
|
| 535 |
+
navigation from the head pointer.
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:09:07,000 --> 00:09:09,000
|
| 539 |
+
Let me show you one more time.
|
| 540 |
+
|
| 541 |
+
136
|
| 542 |
+
00:09:10,000 --> 00:09:14,000
|
| 543 |
+
Get reset with option heart had to the three.
|
| 544 |
+
|
| 545 |
+
137
|
| 546 |
+
00:09:14,000 --> 00:09:20,000
|
| 547 |
+
You can see how I can move that Anabranch pointer to three cm is back from the point where I was.
|
| 548 |
+
|
| 549 |
+
138
|
| 550 |
+
00:09:20,000 --> 00:09:21,000
|
| 551 |
+
This is pretty convenient.
|
| 552 |
+
|
| 553 |
+
139
|
| 554 |
+
00:09:21,000 --> 00:09:25,000
|
| 555 |
+
As for me, probably you would also use this variation of reset command.
|
| 556 |
+
|
| 557 |
+
140
|
| 558 |
+
00:09:26,000 --> 00:09:33,000
|
| 559 |
+
And one more real life scenario, imagine that you wanted either to squash commits or a message or something
|
| 560 |
+
|
| 561 |
+
141
|
| 562 |
+
00:09:33,000 --> 00:09:36,000
|
| 563 |
+
else went wrong during the invasion or during the development.
|
| 564 |
+
|
| 565 |
+
142
|
| 566 |
+
00:09:36,000 --> 00:09:41,000
|
| 567 |
+
And you want to reset the state of your working tree, your file system, as it is in a remote repository
|
| 568 |
+
|
| 569 |
+
143
|
| 570 |
+
00:09:41,000 --> 00:09:42,000
|
| 571 |
+
right now.
|
| 572 |
+
|
| 573 |
+
144
|
| 574 |
+
00:09:43,000 --> 00:09:49,000
|
| 575 |
+
What I recommend you to do, the first thing that I always do is execution of each command with option
|
| 576 |
+
|
| 577 |
+
145
|
| 578 |
+
00:09:49,000 --> 00:09:52,000
|
| 579 |
+
like this need fetch resorption.
|
| 580 |
+
|
| 581 |
+
146
|
| 582 |
+
00:09:52,000 --> 00:09:59,000
|
| 583 |
+
All this is just to make sure that you fetch the latest state of the remote repository after that reset
|
| 584 |
+
|
| 585 |
+
147
|
| 586 |
+
00:09:59,000 --> 00:10:02,000
|
| 587 |
+
with the hard option to the State of Origin branch.
|
| 588 |
+
|
| 589 |
+
148
|
| 590 |
+
00:10:03,000 --> 00:10:09,000
|
| 591 |
+
In this particular case, we played with our master branch and I want to restore the state of our region.
|
| 592 |
+
|
| 593 |
+
149
|
| 594 |
+
00:10:09,000 --> 00:10:14,000
|
| 595 |
+
Must have branch reset with option, heart or region slash master.
|
| 596 |
+
|
| 597 |
+
150
|
| 598 |
+
00:10:14,000 --> 00:10:17,000
|
| 599 |
+
And you can see that I'm on the latest commit right now.
|
| 600 |
+
|
| 601 |
+
151
|
| 602 |
+
00:10:18,000 --> 00:10:20,000
|
| 603 |
+
So there you saw that in reset command.
|
| 604 |
+
|
| 605 |
+
152
|
| 606 |
+
00:10:20,000 --> 00:10:26,000
|
| 607 |
+
You can use chametz checksum, relative amount of comments from the head pointer and even specific branch,
|
| 608 |
+
|
| 609 |
+
153
|
| 610 |
+
00:10:27,000 --> 00:10:27,000
|
| 611 |
+
I believe.
|
| 612 |
+
|
| 613 |
+
154
|
| 614 |
+
00:10:27,000 --> 00:10:31,000
|
| 615 |
+
Now you know about reset command even more than some senior software engineers.
|
| 616 |
+
|
| 617 |
+
155
|
| 618 |
+
00:10:32,000 --> 00:10:33,000
|
| 619 |
+
Hope you enjoyed the lesson.
|
| 620 |
+
|
| 621 |
+
156
|
| 622 |
+
00:10:34,000 --> 00:10:36,000
|
| 623 |
+
Let's recap what we have learned today.
|
| 624 |
+
|
| 625 |
+
157
|
| 626 |
+
00:10:37,000 --> 00:10:40,000
|
| 627 |
+
Today, we learned what is a good reset command and when we can use it.
|
| 628 |
+
|
| 629 |
+
158
|
| 630 |
+
00:10:41,000 --> 00:10:44,000
|
| 631 |
+
We understand the difference between reaching out and gives reset command.
|
| 632 |
+
|
| 633 |
+
159
|
| 634 |
+
00:10:45,000 --> 00:10:51,000
|
| 635 |
+
You learn three modes of reset command, soft, mixed and hard on the real example.
|
| 636 |
+
|
| 637 |
+
160
|
| 638 |
+
00:10:51,000 --> 00:10:55,000
|
| 639 |
+
You saw how to reset state of the branch if you coming back from the head pointer or to the specific
|
| 640 |
+
|
| 641 |
+
161
|
| 642 |
+
00:10:55,000 --> 00:10:56,000
|
| 643 |
+
command.
|
| 644 |
+
|
| 645 |
+
162
|
| 646 |
+
00:10:56,000 --> 00:11:01,000
|
| 647 |
+
Also, you learned how to reset state of the branch to the state of the branch in the remote repository.
|
| 648 |
+
|
| 649 |
+
163
|
| 650 |
+
00:11:02,000 --> 00:11:05,000
|
| 651 |
+
That's all what I planned to talk about in this lesson with you.
|
| 652 |
+
|
| 653 |
+
164
|
| 654 |
+
00:11:05,000 --> 00:11:08,000
|
| 655 |
+
Thanks a lot for your attention and see you in the next lesson.
|
| 656 |
+
|
17 - GIT/016 Git stash_en.srt
ADDED
|
@@ -0,0 +1,728 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1
|
| 2 |
+
00:00:06,000 --> 00:00:09,000
|
| 3 |
+
Hello there, students in this class and we are going to lunch with you get Stasch command.
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:09,000 --> 00:00:12,000
|
| 7 |
+
I'm going to tell you when you might need to use it.
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:12,000 --> 00:00:16,000
|
| 11 |
+
You'll understand how to reapply changes from your stash on real examples.
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:16,000 --> 00:00:21,000
|
| 15 |
+
I will show you how to manage multiple stashes and even how to create a branch from your stash.
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:21,000 --> 00:00:25,000
|
| 19 |
+
And also, we are going to run different commands that will allow you to clean your stash and to perform
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:25,000 --> 00:00:27,000
|
| 23 |
+
as operations with it.
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:27,000 --> 00:00:33,000
|
| 27 |
+
Let's start first of all, let's understand potential problems at stash command may help us to resolve.
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:33,000 --> 00:00:39,000
|
| 31 |
+
Imagine that you are sitting at your computer and work on some task and all of a sudden you receive
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:39,000 --> 00:00:40,000
|
| 35 |
+
a call from your manager.
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:40,000 --> 00:00:46,000
|
| 39 |
+
Your manager screams that you urgently need to fix some other thing or you have to start work on the
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:46,000 --> 00:00:47,000
|
| 43 |
+
other task immediately.
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:47,000 --> 00:00:49,000
|
| 47 |
+
But it didn't finish your current task.
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:49,000 --> 00:00:53,000
|
| 51 |
+
Your manager told you that you have to give up everything and start work on the new task.
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:00:54,000 --> 00:00:59,000
|
| 55 |
+
The state of a file system doesn't allow you to create a committee right now, probably because you
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:00:59,000 --> 00:01:04,000
|
| 59 |
+
even can't build your project successfully or you are just in the middle of something important to finish.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:01:04,000 --> 00:01:09,000
|
| 63 |
+
And it looks like that you have to put all your changes aside to get back to them later.
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:10,000 --> 00:01:15,000
|
| 67 |
+
Hope that you understood the problem and real life case that might happen with you almost on a daily
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:15,000 --> 00:01:15,000
|
| 71 |
+
basis.
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:16,000 --> 00:01:23,000
|
| 75 |
+
But how to address this issue with the help of the Get Eustache Command will help us with this station.
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:23,000 --> 00:01:30,000
|
| 79 |
+
Take the state of a working directory that is humidified direct files, stage changes and saves it on
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:30,000 --> 00:01:35,000
|
| 83 |
+
a stack of unfinished changes that you can apply at any time, even on different branch.
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:36,000 --> 00:01:37,000
|
| 87 |
+
What a staircase.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:37,000 --> 00:01:38,000
|
| 91 |
+
I will explain a bit later.
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:39,000 --> 00:01:39,000
|
| 95 |
+
Nonwork.
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:40,000 --> 00:01:45,000
|
| 99 |
+
I believe that the best way to understand how Eustache Command works is to show it to you in it.
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:45,000 --> 00:01:49,000
|
| 103 |
+
But I am a master branch right now and my work in tree is clean.
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:49,000 --> 00:01:53,000
|
| 107 |
+
Let's imagine I'm in the process of implementation of some important task.
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:53,000 --> 00:02:00,000
|
| 111 |
+
I create a new branch and get to reach resorption c a three zero six important task.
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:02:00,000 --> 00:02:08,000
|
| 115 |
+
OK, and being on this branch in SASE folder, I modified home HTML file to not switch the windows between
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:02:08,000 --> 00:02:09,000
|
| 119 |
+
different code editors.
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:09,000 --> 00:02:15,000
|
| 123 |
+
Let me do small changes right here in the terminal using nano text editor nano web content slash home
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:15,000 --> 00:02:17,000
|
| 127 |
+
dot html.
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:17,000 --> 00:02:19,000
|
| 131 |
+
I added some important changes here.
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:20,000 --> 00:02:24,000
|
| 135 |
+
Be some important line tag is closed.
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:24,000 --> 00:02:31,000
|
| 139 |
+
After I did all my changes, I saved a file and now I received a message from my manager who is in panic
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:31,000 --> 00:02:34,000
|
| 143 |
+
and asks me to start work on the super important task.
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:35,000 --> 00:02:39,000
|
| 147 |
+
I don't need changes from home HTML file that we have just created.
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:39,000 --> 00:02:41,000
|
| 151 |
+
Deunan another task implementation.
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:42,000 --> 00:02:50,000
|
| 155 |
+
Let me check the status of my branch, get status and you can see I have one file modified and currently
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:50,000 --> 00:02:53,000
|
| 159 |
+
it is in the state one creating snapshot with it doesn't make a lot of sense.
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:54,000 --> 00:02:56,000
|
| 163 |
+
So I will put a temporary in my stash.
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:02:57,000 --> 00:02:59,000
|
| 167 |
+
How simply by executing the next command.
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:03:00,000 --> 00:03:02,000
|
| 171 |
+
Eustache Great.
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:03:02,000 --> 00:03:04,000
|
| 175 |
+
Now our changes are in Stasch.
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:04,000 --> 00:03:09,000
|
| 179 |
+
Let's check status one more time and you can see that right now it is nothing to commit.
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:10,000 --> 00:03:13,000
|
| 183 |
+
But now I can be sure that my changes won't disappear.
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:14,000 --> 00:03:18,000
|
| 187 |
+
I'm returning to the Master Branch to create the new branch uSwitch Dash.
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:19,000 --> 00:03:25,000
|
| 191 |
+
Here I create a new branch, uSwitch, which resorption CGA three 07.
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:25,000 --> 00:03:26,000
|
| 195 |
+
Super important task.
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:27,000 --> 00:03:31,000
|
| 199 |
+
OK, and now I can continue work on my new important task.
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:31,000 --> 00:03:34,000
|
| 203 |
+
My changes that are currently in Stasch are not present on this branch.
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:34,000 --> 00:03:35,000
|
| 207 |
+
Let me show you this.
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:36,000 --> 00:03:39,000
|
| 211 |
+
None of Condon's home, not HTML.
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:39,000 --> 00:03:48,000
|
| 215 |
+
And we can find our important line here cuz now let's imagine that you realize that you need those changes
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:48,000 --> 00:03:49,000
|
| 219 |
+
here and you need them back.
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:50,000 --> 00:03:52,000
|
| 223 |
+
How get your changes back from Stasch.
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:03:52,000 --> 00:03:56,000
|
| 227 |
+
You need to apply changes from your stash to do this.
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:03:56,000 --> 00:03:57,000
|
| 231 |
+
Let's use the next command.
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:03:57,000 --> 00:03:59,000
|
| 235 |
+
Eustache apply.
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:03:59,000 --> 00:04:06,000
|
| 239 |
+
And instantly you see the status of the branch and indications and home e-mail file is modified, let
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:06,000 --> 00:04:07,000
|
| 243 |
+
me open it to double check.
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:08,000 --> 00:04:11,000
|
| 247 |
+
Yes, I see my important line here.
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:11,000 --> 00:04:12,000
|
| 251 |
+
Awesome.
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:13,000 --> 00:04:18,000
|
| 255 |
+
Now, important information about Stasch, this command, great stack of changes.
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:18,000 --> 00:04:21,000
|
| 259 |
+
They understand how a stack of changes may look like.
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:21,000 --> 00:04:22,000
|
| 263 |
+
Let me show you quickly.
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:23,000 --> 00:04:30,000
|
| 267 |
+
In computer science, tech is an abstract data type that serves as a collection of elements, it works
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:30,000 --> 00:04:31,000
|
| 271 |
+
according to leave for principle.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:32,000 --> 00:04:35,000
|
| 275 |
+
One more fancy word what does leave or stand for?
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:04:36,000 --> 00:04:39,000
|
| 279 |
+
Leifur is an acronym from Last In, First Out.
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:04:40,000 --> 00:04:45,000
|
| 283 |
+
This is a method of storing data in data structures, according to which the last element get into the
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:04:45,000 --> 00:04:48,000
|
| 287 |
+
container, leaves the containers the first.
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:04:48,000 --> 00:04:51,000
|
| 291 |
+
And on the screen you can see visualization of Steck.
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:04:51,000 --> 00:04:55,000
|
| 295 |
+
Imagine that each element here is a separate batch of changes.
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:04:56,000 --> 00:05:00,000
|
| 299 |
+
When you use Stasch command, your changes are on the bottom of this container.
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:01,000 --> 00:05:06,000
|
| 303 |
+
When you use against apply command, the changes from top of the stack apply to your branch.
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:07,000 --> 00:05:12,000
|
| 307 |
+
And if you use git stash command multiple times, the new changes will be on top.
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:13,000 --> 00:05:14,000
|
| 311 |
+
Does it make sense?
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:15,000 --> 00:05:21,000
|
| 315 |
+
Now imagine that you used Stasch command multiple times and you have a lot of changes in your Stasch
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:21,000 --> 00:05:24,000
|
| 319 |
+
stack, how to view all changes that you have in your stack of changes.
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:25,000 --> 00:05:27,000
|
| 323 |
+
Let me show you the list.
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:27,000 --> 00:05:28,000
|
| 327 |
+
All the changes that you have in your stack.
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:28,000 --> 00:05:31,000
|
| 331 |
+
Use the next command git stash list.
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:05:32,000 --> 00:05:36,000
|
| 335 |
+
And specially for this lesson, I prepared a few items to have multiple elements here.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:05:37,000 --> 00:05:41,000
|
| 339 |
+
You can see that our last stash has index zero and it is on the top of our stack.
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:05:42,000 --> 00:05:48,000
|
| 343 |
+
That means you can apply it on different branches, but probably you might be wondering how to apply.
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:05:48,000 --> 00:05:51,000
|
| 347 |
+
Are the changes from the stack for the sake of the demo?
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:05:51,000 --> 00:05:52,000
|
| 351 |
+
Let me apply changes from this stack.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:05:52,000 --> 00:05:59,000
|
| 355 |
+
Was the indexed One Eustache apply and after that I will use the name of the stash that is specified
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:05:59,000 --> 00:06:03,000
|
| 359 |
+
here, stash add and one in curly brackets.
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:04,000 --> 00:06:10,000
|
| 363 |
+
Before I press and I want to warn you that you're going to see error message hypocenter.
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:10,000 --> 00:06:13,000
|
| 367 |
+
And as I promised, here is the error.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:13,000 --> 00:06:16,000
|
| 371 |
+
Don't worry, everything is under control.
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:16,000 --> 00:06:21,000
|
| 375 |
+
I did this on purpose to show you this error message that you may see some time get.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:21,000 --> 00:06:26,000
|
| 379 |
+
Sometimes we'll show you this message to warn you that your changes might be overwritten after some
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:26,000 --> 00:06:27,000
|
| 383 |
+
specific operation.
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:06:27,000 --> 00:06:31,000
|
| 387 |
+
And this is one more case to Eustache as a temporary storage for your changes.
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:06:32,000 --> 00:06:34,000
|
| 391 |
+
I already have these changes in my stash.
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:06:34,000 --> 00:06:39,000
|
| 395 |
+
So let me just come in, then get dash a dash and commit.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:06:40,000 --> 00:06:45,000
|
| 399 |
+
Sorry about this message, just don't want to spend time on the details that we already discussed.
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:06:46,000 --> 00:06:50,000
|
| 403 |
+
Hope you understand that such a meaningful message is not the best practice.
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:06:50,000 --> 00:06:54,000
|
| 407 |
+
And I use it only for the sake of the drama to not lose the focus from the Stasch.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:06:54,000 --> 00:06:56,000
|
| 411 |
+
Come on now.
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:06:56,000 --> 00:07:00,000
|
| 415 |
+
When I created the snapshot, let me try to apply one more time.
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:00,000 --> 00:07:04,000
|
| 419 |
+
Are the changes from the Stasch and you see that some changes were applied here.
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:05,000 --> 00:07:11,000
|
| 423 |
+
Namely, Log-in says, as file was removed and changes in home each time on file were also applied.
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:12,000 --> 00:07:16,000
|
| 427 |
+
There is even a conflict in this file since it was modified in different versions.
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:17,000 --> 00:07:21,000
|
| 431 |
+
You just have to open this file and to resolve conflicts for the sake of the demo.
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:21,000 --> 00:07:27,000
|
| 435 |
+
Let me reset the state of the current branch to its original state, yet reset resorption heart to the
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:27,000 --> 00:07:28,000
|
| 439 |
+
head pointer.
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:07:29,000 --> 00:07:31,000
|
| 443 |
+
Let's talk about another problem.
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:07:31,000 --> 00:07:33,000
|
| 447 |
+
Do you remember what is in my stash list?
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:07:33,000 --> 00:07:36,000
|
| 451 |
+
Let me show it one more time yet stash lists.
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:07:37,000 --> 00:07:42,000
|
| 455 |
+
How do you think will I remember that that changes and how much time I'll file in the stash tomorrow
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:07:43,000 --> 00:07:44,000
|
| 459 |
+
or in a month.
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:07:44,000 --> 00:07:48,000
|
| 463 |
+
That's why it usually does a good practice to give a name to each stash.
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:07:49,000 --> 00:07:51,000
|
| 467 |
+
Let me do some changes in the repository.
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:07:51,000 --> 00:07:59,000
|
| 471 |
+
For example, let me remove login scissors file ram style slash logging that says there is a standard
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:07:59,000 --> 00:08:02,000
|
| 475 |
+
command in Linux terminals to remove files.
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:08:03,000 --> 00:08:10,000
|
| 479 |
+
Let me stash my current changes with a specific message you'd stash safe logins, he says is removed
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:11,000 --> 00:08:12,000
|
| 483 |
+
and lets presenta.
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:12,000 --> 00:08:18,000
|
| 487 |
+
Now, when I will see the stash in the future in my specialist, I will instantly understand what changes
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:18,000 --> 00:08:20,000
|
| 491 |
+
it contains existentialists.
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:21,000 --> 00:08:25,000
|
| 495 |
+
And here I can see my last stash and it is on the top of the stack.
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:08:25,000 --> 00:08:26,000
|
| 499 |
+
Great.
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:08:27,000 --> 00:08:33,000
|
| 503 |
+
OK, now let me explain you one more thing, probably you noticed that I applied different stashes,
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:08:33,000 --> 00:08:39,000
|
| 507 |
+
but they're still in my stack how to apply stash and remove it from the stack for doing this.
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:08:39,000 --> 00:08:42,000
|
| 511 |
+
You have to use Bob Camonte instead of apply like this.
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:08:42,000 --> 00:08:48,000
|
| 515 |
+
Eustache Pop, we see that I applied my last stash and login success is removed.
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:08:48,000 --> 00:08:50,000
|
| 519 |
+
Let me check my specialist now.
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:08:51,000 --> 00:08:54,000
|
| 523 |
+
And now you can see that it has disappeared from here.
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:08:55,000 --> 00:08:56,000
|
| 527 |
+
Let's move on.
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:08:56,000 --> 00:09:02,000
|
| 531 |
+
One more thing that we didn't discuss yet is that you can stash only changes that are in the staging
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:09:02,000 --> 00:09:06,000
|
| 535 |
+
area or changes that were done in files that are tracked by it.
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:09:07,000 --> 00:09:10,000
|
| 539 |
+
Imagine that we created a file and after that we were interrupted.
|
| 540 |
+
|
| 541 |
+
136
|
| 542 |
+
00:09:11,000 --> 00:09:12,000
|
| 543 |
+
We have to stash it.
|
| 544 |
+
|
| 545 |
+
137
|
| 546 |
+
00:09:12,000 --> 00:09:19,000
|
| 547 |
+
Let me quickly create a file here, touch some important file dot java right now.
|
| 548 |
+
|
| 549 |
+
138
|
| 550 |
+
00:09:19,000 --> 00:09:21,000
|
| 551 |
+
This file isn't tracked by yet.
|
| 552 |
+
|
| 553 |
+
139
|
| 554 |
+
00:09:21,000 --> 00:09:22,000
|
| 555 |
+
Let me show you this.
|
| 556 |
+
|
| 557 |
+
140
|
| 558 |
+
00:09:23,000 --> 00:09:23,000
|
| 559 |
+
It's status.
|
| 560 |
+
|
| 561 |
+
141
|
| 562 |
+
00:09:24,000 --> 00:09:29,000
|
| 563 |
+
And in case I would try to suggest changes on the removal of Logan's SS will be stored.
|
| 564 |
+
|
| 565 |
+
142
|
| 566 |
+
00:09:30,000 --> 00:09:32,000
|
| 567 |
+
Let me prove you this, Eustache.
|
| 568 |
+
|
| 569 |
+
143
|
| 570 |
+
00:09:33,000 --> 00:09:40,000
|
| 571 |
+
And now let's check your status one more time and see that my new file is still in Ontrack State and
|
| 572 |
+
|
| 573 |
+
144
|
| 574 |
+
00:09:40,000 --> 00:09:43,000
|
| 575 |
+
is not in the Stasch, how to add it to the stash?
|
| 576 |
+
|
| 577 |
+
145
|
| 578 |
+
00:09:44,000 --> 00:09:46,000
|
| 579 |
+
We have to use a special option for that.
|
| 580 |
+
|
| 581 |
+
146
|
| 582 |
+
00:09:46,000 --> 00:09:49,000
|
| 583 |
+
Let me show you need Stasch with option U.
|
| 584 |
+
|
| 585 |
+
147
|
| 586 |
+
00:09:50,000 --> 00:09:52,000
|
| 587 |
+
U stands for untracked files.
|
| 588 |
+
|
| 589 |
+
148
|
| 590 |
+
00:09:52,000 --> 00:09:54,000
|
| 591 |
+
Instead of you, you can use a option.
|
| 592 |
+
|
| 593 |
+
149
|
| 594 |
+
00:09:55,000 --> 00:09:58,000
|
| 595 |
+
A stands for all besides untracked files.
|
| 596 |
+
|
| 597 |
+
150
|
| 598 |
+
00:09:58,000 --> 00:10:02,000
|
| 599 |
+
It would also stash files that are ignored according to our Getting Your File.
|
| 600 |
+
|
| 601 |
+
151
|
| 602 |
+
00:10:03,000 --> 00:10:07,000
|
| 603 |
+
But I doubt that you would ever want it to include ignored files to your stash.
|
| 604 |
+
|
| 605 |
+
152
|
| 606 |
+
00:10:07,000 --> 00:10:08,000
|
| 607 |
+
That's why.
|
| 608 |
+
|
| 609 |
+
153
|
| 610 |
+
00:10:08,000 --> 00:10:12,000
|
| 611 |
+
Let's use you option here, Hypocenter.
|
| 612 |
+
|
| 613 |
+
154
|
| 614 |
+
00:10:13,000 --> 00:10:16,000
|
| 615 |
+
Let me check your status now, your status.
|
| 616 |
+
|
| 617 |
+
155
|
| 618 |
+
00:10:17,000 --> 00:10:17,000
|
| 619 |
+
Awesome.
|
| 620 |
+
|
| 621 |
+
156
|
| 622 |
+
00:10:18,000 --> 00:10:24,000
|
| 623 |
+
Finally, it looks like our new file was stashed, and now imagine that you want to create a branch
|
| 624 |
+
|
| 625 |
+
157
|
| 626 |
+
00:10:24,000 --> 00:10:25,000
|
| 627 |
+
from your stash.
|
| 628 |
+
|
| 629 |
+
158
|
| 630 |
+
00:10:25,000 --> 00:10:31,000
|
| 631 |
+
Imagine that when you finished work on the super important task, you already removed all old branches
|
| 632 |
+
|
| 633 |
+
159
|
| 634 |
+
00:10:31,000 --> 00:10:32,000
|
| 635 |
+
and you have to create a new one.
|
| 636 |
+
|
| 637 |
+
160
|
| 638 |
+
00:10:33,000 --> 00:10:41,000
|
| 639 |
+
How to create a new branch from Stash use the next command, Eustache Branch, a three zero seven new.
|
| 640 |
+
|
| 641 |
+
161
|
| 642 |
+
00:10:42,000 --> 00:10:46,000
|
| 643 |
+
You can specify here any Stasha you would like without specifying Stasha.
|
| 644 |
+
|
| 645 |
+
162
|
| 646 |
+
00:10:47,000 --> 00:10:53,000
|
| 647 |
+
The first stash from the stack will be used and you see that I have new untracked file on my new branch
|
| 648 |
+
|
| 649 |
+
163
|
| 650 |
+
00:10:54,000 --> 00:10:56,000
|
| 651 |
+
that also moved me to the new branch.
|
| 652 |
+
|
| 653 |
+
164
|
| 654 |
+
00:10:57,000 --> 00:11:03,000
|
| 655 |
+
You can see it here in parentheses and what to do in case you don't want to apply your stash, but you
|
| 656 |
+
|
| 657 |
+
165
|
| 658 |
+
00:11:03,000 --> 00:11:08,000
|
| 659 |
+
just want to remove it, use the next command, get stash, drop.
|
| 660 |
+
|
| 661 |
+
166
|
| 662 |
+
00:11:08,000 --> 00:11:10,000
|
| 663 |
+
You can specify any stash.
|
| 664 |
+
|
| 665 |
+
167
|
| 666 |
+
00:11:10,000 --> 00:11:14,000
|
| 667 |
+
I here, for example, stash at zero.
|
| 668 |
+
|
| 669 |
+
168
|
| 670 |
+
00:11:14,000 --> 00:11:18,000
|
| 671 |
+
Now let's check stash list, new stash list.
|
| 672 |
+
|
| 673 |
+
169
|
| 674 |
+
00:11:18,000 --> 00:11:22,000
|
| 675 |
+
And you see that our first stash in stack was removed by us.
|
| 676 |
+
|
| 677 |
+
170
|
| 678 |
+
00:11:25,000 --> 00:11:31,000
|
| 679 |
+
In case you want to clear all stack of stashes, use the next command, get Stasch clear.
|
| 680 |
+
|
| 681 |
+
171
|
| 682 |
+
00:11:32,000 --> 00:11:38,000
|
| 683 |
+
And in case we would check our specialists, now we are going to see nothing and here is empty list,
|
| 684 |
+
|
| 685 |
+
172
|
| 686 |
+
00:11:38,000 --> 00:11:39,000
|
| 687 |
+
nothing is here.
|
| 688 |
+
|
| 689 |
+
173
|
| 690 |
+
00:11:40,000 --> 00:11:44,000
|
| 691 |
+
Great, it looks like that is all what I plan to share with you in this lesson.
|
| 692 |
+
|
| 693 |
+
174
|
| 694 |
+
00:11:44,000 --> 00:11:46,000
|
| 695 |
+
Let's recap what we have learned today.
|
| 696 |
+
|
| 697 |
+
175
|
| 698 |
+
00:11:47,000 --> 00:11:50,000
|
| 699 |
+
So today we learned what the stashes now we know how to use stash.
|
| 700 |
+
|
| 701 |
+
176
|
| 702 |
+
00:11:50,000 --> 00:11:52,000
|
| 703 |
+
Come on, on real examples.
|
| 704 |
+
|
| 705 |
+
177
|
| 706 |
+
00:11:52,000 --> 00:11:54,000
|
| 707 |
+
We learned how to manage multiple stashes.
|
| 708 |
+
|
| 709 |
+
178
|
| 710 |
+
00:11:55,000 --> 00:11:59,000
|
| 711 |
+
We learned how to stash direct files and how to clear your stash if needed.
|
| 712 |
+
|
| 713 |
+
179
|
| 714 |
+
00:11:59,000 --> 00:12:04,000
|
| 715 |
+
We also learned what is the difference between stash supply and stash pop.
|
| 716 |
+
|
| 717 |
+
180
|
| 718 |
+
00:12:04,000 --> 00:12:05,000
|
| 719 |
+
That's all for now.
|
| 720 |
+
|
| 721 |
+
181
|
| 722 |
+
00:12:06,000 --> 00:12:07,000
|
| 723 |
+
Thanks a lot for your attention.
|
| 724 |
+
|
| 725 |
+
182
|
| 726 |
+
00:12:07,000 --> 00:12:09,000
|
| 727 |
+
See you in the next lesson.
|
| 728 |
+
|
17 - GIT/017 Restoring lost snapshots in Git git reflog_en.srt
ADDED
|
@@ -0,0 +1,412 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1
|
| 2 |
+
00:00:06,000 --> 00:00:06,000
|
| 3 |
+
Hello, Jim.
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:06,000 --> 00:00:11,000
|
| 7 |
+
Today, we're going to have super interesting topic and this last one, I'll show you how you can restore
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:11,000 --> 00:00:12,000
|
| 11 |
+
literally everything.
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:12,000 --> 00:00:18,000
|
| 15 |
+
What was ever present in any snapshot in it, even if it was overwritten, is by force push or hard
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:18,000 --> 00:00:19,000
|
| 19 |
+
reset.
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:19,000 --> 00:00:22,000
|
| 23 |
+
But I will run such command as gets where flock.
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:22,000 --> 00:00:25,000
|
| 27 |
+
We're going to understand when and why we have to use.
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:25,000 --> 00:00:30,000
|
| 31 |
+
It will imitate cases when we lost some changes and we need to restore them.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:30,000 --> 00:00:35,000
|
| 35 |
+
After this lesson, you will be able to use reflood command with different options and variations.
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:35,000 --> 00:00:42,000
|
| 39 |
+
Like a pro, you are going to learn how to restore lost command in the new branch or reset current branch
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:42,000 --> 00:00:43,000
|
| 43 |
+
to the committees that were lost.
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:44,000 --> 00:00:49,000
|
| 47 |
+
Let's understand first, why do we need to use lock and what problem it may help us to solve?
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:50,000 --> 00:00:55,000
|
| 51 |
+
It may happen that at some point during your journey you may accidentally lose a command.
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:00:55,000 --> 00:01:00,000
|
| 55 |
+
Like I told you before, it may happen during the force delete of your work or during the hard reset
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:01:01,000 --> 00:01:06,000
|
| 59 |
+
or you use interactive rebate's to squash commands and the resolving of conflicts during the invasion
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:01:06,000 --> 00:01:08,000
|
| 63 |
+
went wrong and some changes were lost.
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:08,000 --> 00:01:16,000
|
| 67 |
+
So how to get those changes back in if something were ever committed, might be restored, yet won't
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:16,000 --> 00:01:21,000
|
| 71 |
+
be able to restore files that were never in the staging area and were never committed before.
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:22,000 --> 00:01:26,000
|
| 75 |
+
I suggest that a lot of the kids were locked directly from the practical exercise.
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:27,000 --> 00:01:30,000
|
| 79 |
+
Let's start to show you how to restore changes.
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:30,000 --> 00:01:32,000
|
| 83 |
+
Let me intentionally lose some data.
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:32,000 --> 00:01:34,000
|
| 87 |
+
I'm on the master branch.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:34,000 --> 00:01:35,000
|
| 91 |
+
Let me show you.
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:35,000 --> 00:01:38,000
|
| 95 |
+
Let latest Kummetz gate log dash three.
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:39,000 --> 00:01:47,000
|
| 99 |
+
Let me Hardell said Doulos commits yet reset hard had yielded to OK the branches reset.
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:48,000 --> 00:01:51,000
|
| 103 |
+
Let's check commit history Dedlock.
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:52,000 --> 00:01:59,000
|
| 107 |
+
Now we can say that we lost to commit, OK, there is no harm for me to restore the changes from the
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:59,000 --> 00:02:05,000
|
| 111 |
+
region branch, but it might happen that a regional branch was also accidentally overwritten or completely
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:02:05,000 --> 00:02:05,000
|
| 115 |
+
removed.
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:02:06,000 --> 00:02:08,000
|
| 119 |
+
You won't believe me, but such cases may happen.
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:09,000 --> 00:02:14,000
|
| 123 |
+
At the first glance, it looks like that I only need to remember to check some of the lost comments,
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:14,000 --> 00:02:16,000
|
| 127 |
+
but we didn't memorize them.
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:16,000 --> 00:02:19,000
|
| 131 |
+
Agree the most complicated in this task to learn.
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:19,000 --> 00:02:21,000
|
| 135 |
+
Check some of those comments.
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:21,000 --> 00:02:25,000
|
| 139 |
+
And the easiest thing to answer this question is to call it red flag.
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:25,000 --> 00:02:27,000
|
| 143 |
+
Come on, what is a red flag?
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:28,000 --> 00:02:32,000
|
| 147 |
+
As we are working with gait and movement pointers get silently records.
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:32,000 --> 00:02:35,000
|
| 151 |
+
What is our head pointer and how does it look like?
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:36,000 --> 00:02:42,000
|
| 155 |
+
That means that each time we are creating a new snapshot or switching branches, the red flag is updated.
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:43,000 --> 00:02:49,000
|
| 159 |
+
You can investigate the history of all changes in your repository by executing the next command gateway
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:49,000 --> 00:02:49,000
|
| 163 |
+
flock.
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:02:50,000 --> 00:02:56,000
|
| 167 |
+
We can see information about each operation that was done here about each commit, each research on
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:02:56,000 --> 00:02:57,000
|
| 171 |
+
the region must have branch.
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:02:58,000 --> 00:03:02,000
|
| 175 |
+
You can find information here about different branches by the reference in the parentheses.
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:02,000 --> 00:03:06,000
|
| 179 |
+
Also, you may find checksum of each state right here.
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:06,000 --> 00:03:08,000
|
| 183 |
+
By the way, this is the last program.
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:08,000 --> 00:03:13,000
|
| 187 |
+
This is a program for text terminals, for Unix like systems to close it.
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:13,000 --> 00:03:16,000
|
| 191 |
+
Just press Kyuki to remember it.
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:16,000 --> 00:03:18,000
|
| 195 |
+
Q stands for it.
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:18,000 --> 00:03:20,000
|
| 199 |
+
Here, let me press Q.
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:21,000 --> 00:03:22,000
|
| 203 |
+
OK, Hillary.
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:22,000 --> 00:03:26,000
|
| 207 |
+
So where's the place where you can get check some of the comments that you want to restore?
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:26,000 --> 00:03:31,000
|
| 211 |
+
I know that for some students, the way our flag looks like is not very informative.
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:32,000 --> 00:03:38,000
|
| 215 |
+
We can't see the detailed content messages we may find on the description of the operation, but not
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:38,000 --> 00:03:39,000
|
| 219 |
+
the details about the commit.
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:40,000 --> 00:03:47,000
|
| 223 |
+
What would I suggest to you is to use the next command get look with option G here you may find a list
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:03:47,000 --> 00:03:49,000
|
| 227 |
+
of all commits was a red flag reference.
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:03:50,000 --> 00:03:52,000
|
| 231 |
+
Here is our committee that we have lost.
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:03:53,000 --> 00:03:56,000
|
| 235 |
+
Let me create a new branch with the state of that snapshot.
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:03:57,000 --> 00:03:59,000
|
| 239 |
+
Yet Branch lost changes.
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:00,000 --> 00:04:08,000
|
| 243 |
+
And now I have to specify, commit checks that I want to restore E 50, be a D great.
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:09,000 --> 00:04:13,000
|
| 247 |
+
Now let's check commit history, get log last changes.
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:14,000 --> 00:04:19,000
|
| 251 |
+
Just to remind you to check the current history of the specific branch, we should specify branch name
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:19,000 --> 00:04:25,000
|
| 255 |
+
next to log command and we can see that our new branch contains commands that were lost.
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:26,000 --> 00:04:31,000
|
| 259 |
+
So as far as you may understand, you can restore, Anderson, what was present in any committee in
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:31,000 --> 00:04:37,000
|
| 263 |
+
your local repository or anything where hat pointer of your local repository ever pointed to.
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:37,000 --> 00:04:40,000
|
| 267 |
+
Also, one more important note.
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:40,000 --> 00:04:44,000
|
| 271 |
+
By default, information in red flag is stored for 90 days.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:44,000 --> 00:04:45,000
|
| 275 |
+
Usually it is enough.
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:04:46,000 --> 00:04:52,000
|
| 279 |
+
It is very unlikely that you lived your happy life for 91 days and after that realized that you need
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:04:52,000 --> 00:04:53,000
|
| 283 |
+
to restore some lost command.
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:04:54,000 --> 00:04:57,000
|
| 287 |
+
Let me show you one more Syntex of restoring changes.
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:04:58,000 --> 00:05:03,000
|
| 291 |
+
I'm on the massive branch and I didn't switch to the new branch with the name lost changes that we created
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:05:03,000 --> 00:05:06,000
|
| 295 |
+
with the last comment on the massive branch.
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:05:06,000 --> 00:05:10,000
|
| 299 |
+
I still don't have my last comments after the hard reset.
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:11,000 --> 00:05:13,000
|
| 303 |
+
Let me reset was hard to Morcom.
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:13,000 --> 00:05:19,000
|
| 307 |
+
It's back here is our leaders had hard to prove that we really moved a few comments back and that we
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:19,000 --> 00:05:21,000
|
| 311 |
+
have lost even more comments.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:21,000 --> 00:05:23,000
|
| 315 |
+
Let me show you commit history.
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:23,000 --> 00:05:29,000
|
| 319 |
+
You'd log that story and you can see that we lost our five zero beard commit.
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:30,000 --> 00:05:34,000
|
| 323 |
+
Let me show you one more time that shows a whole raft.
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:34,000 --> 00:05:36,000
|
| 327 |
+
Look, let me show you the flag.
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:36,000 --> 00:05:42,000
|
| 331 |
+
Only for the past one hour traffic was option since equals to one our.
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:05:43,000 --> 00:05:48,000
|
| 335 |
+
And I see limited amount of red flag you can use day instead of hours if you wish.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:05:48,000 --> 00:05:52,000
|
| 339 |
+
So here is a state of our head pointer before I set it.
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:05:52,000 --> 00:05:55,000
|
| 343 |
+
Has Index had at nine and two.
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:05:56,000 --> 00:06:02,000
|
| 347 |
+
That's the sad state of the current branch to the opposition leader, said resorption, hard hat and
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:06:03,000 --> 00:06:04,000
|
| 351 |
+
to unlet.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:06:04,000 --> 00:06:08,000
|
| 355 |
+
Check our comment history one more time gridlock.
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:06:08,000 --> 00:06:09,000
|
| 359 |
+
And here we are.
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:10,000 --> 00:06:13,000
|
| 363 |
+
We successfully restored state of our filesystem and state of our branch.
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:13,000 --> 00:06:15,000
|
| 367 |
+
That was before the last reset.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:16,000 --> 00:06:19,000
|
| 371 |
+
I believe this information will help you a lot in the future.
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:20,000 --> 00:06:22,000
|
| 375 |
+
That's all what I planned to share with you today.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:22,000 --> 00:06:24,000
|
| 379 |
+
Let's recap what we have learned today.
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:25,000 --> 00:06:28,000
|
| 383 |
+
So today we learned what a leader travelogue is.
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:06:28,000 --> 00:06:31,000
|
| 387 |
+
Now you know how to use this command during the lesson.
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:06:31,000 --> 00:06:37,000
|
| 391 |
+
We restore our lost commits by creating a branch from then lost it all by yourself in the current branch
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:06:37,000 --> 00:06:40,000
|
| 395 |
+
to the previous state before some comments were lost.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:06:40,000 --> 00:06:44,000
|
| 399 |
+
Also, we learned how to show red filtered by time passed.
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:06:45,000 --> 00:06:47,000
|
| 403 |
+
That's all what we have for today.
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:06:47,000 --> 00:06:48,000
|
| 407 |
+
Thanks a lot for your attention.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:06:49,000 --> 00:06:50,000
|
| 411 |
+
See you in the next lesson.
|
| 412 |
+
|
17 - GIT/018 Git cherry-pick moving commits between branches_en.srt
ADDED
|
@@ -0,0 +1,592 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1
|
| 2 |
+
00:00:06,000 --> 00:00:10,000
|
| 3 |
+
Hello, Jim, today we're going to discuss with you one more important command that may help you to
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:10,000 --> 00:00:13,000
|
| 7 |
+
modify comit history, then we'll talk about cherrypick.
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:13,000 --> 00:00:20,000
|
| 11 |
+
Come on, as usual, we'll discuss when we need to use this command after we'll understand when we need
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:20,000 --> 00:00:20,000
|
| 15 |
+
to use cherrypick.
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:20,000 --> 00:00:25,000
|
| 19 |
+
Command will proceed with our practice exercise to understand how we can use it.
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:25,000 --> 00:00:31,000
|
| 23 |
+
In this lesson, I will share with you my experience of using cherrypick and I will tell you why this
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:31,000 --> 00:00:33,000
|
| 27 |
+
command is not considered as a best practice.
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:33,000 --> 00:00:37,000
|
| 31 |
+
And even despite that, why we may need to use this command some time.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:38,000 --> 00:00:43,000
|
| 35 |
+
I'm going to teach you how to cherrypick multiple commands at once and how to resolve conflicts during
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:43,000 --> 00:00:43,000
|
| 39 |
+
cherrypicking.
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:44,000 --> 00:00:48,000
|
| 43 |
+
And at the end of the lesson, I will share with you best practices of using cherrypick.
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:49,000 --> 00:00:55,000
|
| 47 |
+
So when we have to use cherrypick, there are different cases when you might want to use cherrypick
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:55,000 --> 00:00:56,000
|
| 51 |
+
command.
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:00:56,000 --> 00:01:01,000
|
| 55 |
+
Some of them deliver hotfix to the end user as fast as possible.
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:01:02,000 --> 00:01:04,000
|
| 59 |
+
Imagine that you created Reles Branch.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:01:04,000 --> 00:01:09,000
|
| 63 |
+
Rie's branch should contain only source code that is going to be part of the built of your application
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:09,000 --> 00:01:14,000
|
| 67 |
+
that is going to be deployed on your production environment where it will be available to the end user.
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:15,000 --> 00:01:20,000
|
| 71 |
+
And imagine that you realize that you're basing on merging of the latest changes before creation of
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:20,000 --> 00:01:21,000
|
| 75 |
+
the release branch.
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:21,000 --> 00:01:25,000
|
| 79 |
+
You missed important change and now you have a defect in the release branch.
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:26,000 --> 00:01:30,000
|
| 83 |
+
The fix for this defect is present in the snapshot in your feature branch.
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:31,000 --> 00:01:32,000
|
| 87 |
+
It was tested.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:32,000 --> 00:01:33,000
|
| 91 |
+
It was approved.
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:33,000 --> 00:01:39,000
|
| 95 |
+
So the only thing that you have to do is to move the committee from the feature branch to your branch
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:39,000 --> 00:01:42,000
|
| 99 |
+
and to move one snapshot from one branch to another.
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:42,000 --> 00:01:49,000
|
| 103 |
+
We have to use the feature command or imagine another case and doing changes and restoring lost Kummetz.
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:50,000 --> 00:01:56,000
|
| 107 |
+
Not all branches are merged into the master branch and some chametz might be lost using letterer floor
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:56,000 --> 00:01:57,000
|
| 111 |
+
command.
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:01:57,000 --> 00:02:01,000
|
| 115 |
+
You may find snapshots that you need and cherrypick it into your branch.
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:02:01,000 --> 00:02:08,000
|
| 119 |
+
One more scenario, regular time collaboration in case you and team members work on the same feature
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:08,000 --> 00:02:13,000
|
| 123 |
+
and you have some shared functionality, you might want to test something on your branch that includes
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:13,000 --> 00:02:14,000
|
| 127 |
+
other changes.
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:14,000 --> 00:02:21,000
|
| 131 |
+
For example, backend engineers created a data structure that Fronton team also needs to use, and Fronton
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:21,000 --> 00:02:26,000
|
| 135 |
+
developers may use cherrypick command to get those changes into their branch.
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:26,000 --> 00:02:31,000
|
| 139 |
+
Probably during the life of the developer, you will find other real life cases when you may use to
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:31,000 --> 00:02:36,000
|
| 143 |
+
be command, but I believe you understand why you may want to use it.
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:36,000 --> 00:02:38,000
|
| 147 |
+
And now attention.
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:38,000 --> 00:02:41,000
|
| 151 |
+
I don't want you to share with attack tactless information.
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:41,000 --> 00:02:44,000
|
| 155 |
+
That and reporter had told you that using of cherrypick is a best practice.
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:45,000 --> 00:02:51,000
|
| 159 |
+
I want to say that cherrypick command usually consider is not a good practice and regular mergers are
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:51,000 --> 00:02:53,000
|
| 163 |
+
preferred instead when it is possible.
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:02:54,000 --> 00:03:01,000
|
| 167 |
+
But sometimes you might want to use this command while you Topeka's consider it is not a best practice
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:03:01,000 --> 00:03:02,000
|
| 171 |
+
notice.
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:03:02,000 --> 00:03:08,000
|
| 175 |
+
I said literally consider it not as a best practice, but not necessarily the bad thing.
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:09,000 --> 00:03:12,000
|
| 179 |
+
To understand this, let's review how Get-Rich-Quick works.
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:12,000 --> 00:03:15,000
|
| 183 |
+
It creates a tension separate come.
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:15,000 --> 00:03:20,000
|
| 187 |
+
It was different hash and has no reference to original comment.
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:21,000 --> 00:03:27,000
|
| 191 |
+
Content of command will be fully duplicated, but it will consider Newcome it an original one as two
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:27,000 --> 00:03:28,000
|
| 195 |
+
different commands.
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:28,000 --> 00:03:34,000
|
| 199 |
+
That's why some developers may consider cherrypick as a bad thing because it may cause problems like
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:34,000 --> 00:03:38,000
|
| 203 |
+
having duplicate commands and multiple branches messing up with a good history and others.
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:39,000 --> 00:03:43,000
|
| 207 |
+
But in case you are using this command attentively, there is no harm in that.
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:44,000 --> 00:03:50,000
|
| 211 |
+
For example, there might be cases when you can't merge some branch because it contains a lot of other
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:50,000 --> 00:03:52,000
|
| 215 |
+
changes that are not needed anymore.
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:52,000 --> 00:03:56,000
|
| 219 |
+
And at some specific moment of time, you need only one single command.
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:56,000 --> 00:04:02,000
|
| 223 |
+
That's where cherrypick command may help you so used cherrypick with caution.
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:04:02,000 --> 00:04:07,000
|
| 227 |
+
At the end of the lesson, we are going to summarize rules that you have to follow during the cherrypicking.
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:04:08,000 --> 00:04:14,000
|
| 231 |
+
Now let me show you the real example of cherrypicking the head for this lesson for the sake of the Dharma
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:04:14,000 --> 00:04:16,000
|
| 235 |
+
Abbotabad branch was fuken its.
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:04:16,000 --> 00:04:21,000
|
| 239 |
+
Let me briefly explain to you the state of my current repository so that you would understand the example.
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:22,000 --> 00:04:27,000
|
| 243 |
+
Imagine that I am working on the implementation of LOG-IN functionality and I create a separate branch
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:27,000 --> 00:04:30,000
|
| 247 |
+
for that was the name Keet three zero eight log.
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:30,000 --> 00:04:33,000
|
| 251 |
+
Again, you can see that I am currently on it.
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:34,000 --> 00:04:37,000
|
| 255 |
+
Let me show you the history of what I have already done.
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:38,000 --> 00:04:41,000
|
| 259 |
+
This log was option one line necessary.
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:41,000 --> 00:04:46,000
|
| 263 |
+
Option one line allows me to format output in a bit different ways than usual.
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:46,000 --> 00:04:51,000
|
| 267 |
+
I press enter here what I have already done while being on this branch.
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:52,000 --> 00:04:54,000
|
| 271 |
+
I implement in styles for login bottom.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:54,000 --> 00:04:58,000
|
| 275 |
+
Also I implement and backend part of login feature.
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:04:58,000 --> 00:05:01,000
|
| 279 |
+
And here's a snapshot of the original master branch.
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:05:01,000 --> 00:05:03,000
|
| 283 |
+
And imagine that during the.
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:05:03,000 --> 00:05:09,000
|
| 287 |
+
Essence of my work quality assurance engineers found a lot of defects, and we are not in the position
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:05:09,000 --> 00:05:16,000
|
| 291 |
+
to match my branch to a three zero eight into the master branch, but everybody really liked the style
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:05:16,000 --> 00:05:21,000
|
| 295 |
+
of my login button and product on requested to have the other buttons in the same style.
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:05:22,000 --> 00:05:28,000
|
| 299 |
+
That's why I want to prepare pool requests for only styles of my button and we'll merge that branch
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:28,000 --> 00:05:33,000
|
| 303 |
+
into the master so that other developers also will be able to pick up the changes.
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:33,000 --> 00:05:36,000
|
| 307 |
+
While I will be fixing all the defects.
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:36,000 --> 00:05:38,000
|
| 311 |
+
Was back in court for the next week or two.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:39,000 --> 00:05:41,000
|
| 315 |
+
Just joking, you know that I would fix it faster.
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:42,000 --> 00:05:48,000
|
| 319 |
+
But just as an example, this shouldn't be a problem because I will rebase my branch with the back and
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:48,000 --> 00:05:55,000
|
| 323 |
+
quote on the master before merging or even just remove Starlin snapshot from the current branch to understand
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:55,000 --> 00:05:56,000
|
| 327 |
+
the real life case.
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:57,000 --> 00:05:59,000
|
| 331 |
+
Let me now show you how to do that.
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:05:59,000 --> 00:06:03,000
|
| 335 |
+
First of all, let me create the branch from the latest master branch.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:06:04,000 --> 00:06:05,000
|
| 339 |
+
Good switch, master.
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:06:06,000 --> 00:06:10,000
|
| 343 |
+
Nudes, which resorption CGA three zero nine modern styles.
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:06:12,000 --> 00:06:19,000
|
| 347 |
+
OK, I'm on the new branch and imagine that I did some changes in the log into this House file, just
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:06:19,000 --> 00:06:25,000
|
| 351 |
+
did any random changes, Nonno style slash log in order to assess.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:06:25,000 --> 00:06:29,000
|
| 355 |
+
Let me write here some text, some changes.
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:06:30,000 --> 00:06:37,000
|
| 359 |
+
And save it now, let me come in this year to commit with option A and resorption and subcamp.
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:39,000 --> 00:06:47,000
|
| 363 |
+
Hypocenter and now being on this branch, I have to cherry pick this game, it was Jackson E, C, six,
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:47,000 --> 00:06:52,000
|
| 367 |
+
B, five, E, C, two copies that come in and apply it on my new branch.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:52,000 --> 00:06:54,000
|
| 371 |
+
Let me execute the next command.
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:55,000 --> 00:06:57,000
|
| 375 |
+
Get cherrypick E, C six.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:57,000 --> 00:06:58,000
|
| 379 |
+
B, five.
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:58,000 --> 00:06:59,000
|
| 383 |
+
E, c.
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:07:00,000 --> 00:07:06,000
|
| 387 |
+
In case we wouldn't adjust the says as file, we want to see conflicts here and your it would be applied,
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:07:07,000 --> 00:07:09,000
|
| 391 |
+
but that is way too easy for you.
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:07:10,000 --> 00:07:16,000
|
| 395 |
+
I wanted to imitate state of the conflict during the cherrypicking to show you the process of the conflict
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:07:16,000 --> 00:07:17,000
|
| 399 |
+
resolving during the cherrypick.
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:07:18,000 --> 00:07:24,000
|
| 403 |
+
You see that it indicates that we are in the process of the cherry picking and gives us advice to resolve
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:07:24,000 --> 00:07:26,000
|
| 407 |
+
conflicts and add files to the staging area.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:07:27,000 --> 00:07:28,000
|
| 411 |
+
Let me check your status.
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:07:29,000 --> 00:07:37,000
|
| 415 |
+
And see here in the but it is said that there is a conflict in Logan says file, so let's open it in
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:37,000 --> 00:07:40,000
|
| 419 |
+
the editor and let's resolve the conflicts now.
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:41,000 --> 00:07:47,000
|
| 423 |
+
No styles log into SS will imitate the fact that we resolved all conflicts.
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:49,000 --> 00:07:53,000
|
| 427 |
+
Now, let's mark this file as a result, get at DOT.
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:53,000 --> 00:08:01,000
|
| 431 |
+
Now, let's continue our cherry picking process to do this, let's perform the next command, get cherrypick
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:08:01,000 --> 00:08:07,000
|
| 435 |
+
with option continue and it allows us to adjust, commit message by default.
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:08:07,000 --> 00:08:10,000
|
| 439 |
+
It keeps the region commit message of the previous commit.
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:08:11,000 --> 00:08:16,000
|
| 443 |
+
Let's save and close this file and we can see that we applied our changes here.
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:08:16,000 --> 00:08:18,000
|
| 447 |
+
Let's check our current history.
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:08:19,000 --> 00:08:21,000
|
| 451 |
+
Good luck with option one line.
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:08:21,000 --> 00:08:22,000
|
| 455 |
+
That's three.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:08:23,000 --> 00:08:28,000
|
| 459 |
+
And here's our new comment and attention, in case you would compare, check some of this comet and
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:08:28,000 --> 00:08:34,000
|
| 463 |
+
check some of original comet from a three zero eight range, you're going to find that they are different.
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:08:35,000 --> 00:08:38,000
|
| 467 |
+
That means that these two are not the same comet.
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:08:39,000 --> 00:08:42,000
|
| 471 |
+
This one is just a copy of the first one.
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:08:42,000 --> 00:08:49,000
|
| 475 |
+
And now a few more important variations and options of cherrypick command in case something went wrong
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:08:49,000 --> 00:08:50,000
|
| 479 |
+
during the conflict resolution.
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:50,000 --> 00:08:56,000
|
| 483 |
+
You can just abort the process of cherrypicking like this, get cherrypick with option abort.
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:57,000 --> 00:09:01,000
|
| 487 |
+
Also, if you wish, you may cherry pick multiple comets at once.
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:09:01,000 --> 00:09:02,000
|
| 491 |
+
To do this.
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:09:02,000 --> 00:09:08,000
|
| 495 |
+
You have specified checksum of all comets separated by space like this year.
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:09:08,000 --> 00:09:15,000
|
| 499 |
+
Cherrypick E, C six B five e C and three F three one six six six.
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:09:16,000 --> 00:09:17,000
|
| 503 |
+
Those are two comets from our damos.
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:09:18,000 --> 00:09:22,000
|
| 507 |
+
Now when you know how to use cherrypick, let's talk about the best practices.
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:09:24,000 --> 00:09:30,000
|
| 511 |
+
The rule number one, if it's not critical and you can apply necessary changes with much opt for much
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:09:30,000 --> 00:09:37,000
|
| 515 |
+
option, it is considered to be a general practice to prefer much option of a cherrypick rule number
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:09:37,000 --> 00:09:44,000
|
| 519 |
+
to avoid creating any duplication by using cherrypick if you cherry picked commands and removed all
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:09:44,000 --> 00:09:46,000
|
| 523 |
+
branch or just reset the old branch.
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:09:46,000 --> 00:09:47,000
|
| 527 |
+
That's fine.
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:09:47,000 --> 00:09:49,000
|
| 531 |
+
And this will not lead to any issues.
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:09:50,000 --> 00:09:54,000
|
| 535 |
+
Potential issues may happen in case you keep two branches and have duplicated Kummetz.
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:09:55,000 --> 00:10:01,000
|
| 539 |
+
Rule number three, sometimes it is considered as a good practice during the cherrypick to specify the
|
| 540 |
+
|
| 541 |
+
136
|
| 542 |
+
00:10:01,000 --> 00:10:07,000
|
| 543 |
+
hash code or the original commit, it may help you to do this in case you will use exception like this.
|
| 544 |
+
|
| 545 |
+
137
|
| 546 |
+
00:10:07,000 --> 00:10:10,000
|
| 547 |
+
Get your pick was option X.
|
| 548 |
+
|
| 549 |
+
138
|
| 550 |
+
00:10:10,000 --> 00:10:16,000
|
| 551 |
+
This option will automatically adds information about the regional committee into your new one.
|
| 552 |
+
|
| 553 |
+
139
|
| 554 |
+
00:10:16,000 --> 00:10:20,000
|
| 555 |
+
And here on the screenshot, you may see how your comit message will look like.
|
| 556 |
+
|
| 557 |
+
140
|
| 558 |
+
00:10:21,000 --> 00:10:26,000
|
| 559 |
+
You learned a lot today about cherrypick, let's recap what we have learned today.
|
| 560 |
+
|
| 561 |
+
141
|
| 562 |
+
00:10:27,000 --> 00:10:32,000
|
| 563 |
+
Now, you know when you might need to apply cherrypick command, because we discussed with you different
|
| 564 |
+
|
| 565 |
+
142
|
| 566 |
+
00:10:32,000 --> 00:10:34,000
|
| 567 |
+
cases when this command will help you.
|
| 568 |
+
|
| 569 |
+
143
|
| 570 |
+
00:10:35,000 --> 00:10:39,000
|
| 571 |
+
Also, you understood why cherrypick is not considered to be as a good practice.
|
| 572 |
+
|
| 573 |
+
144
|
| 574 |
+
00:10:39,000 --> 00:10:43,000
|
| 575 |
+
One real example, you saw how to resolve conflicts during cherrypicking.
|
| 576 |
+
|
| 577 |
+
145
|
| 578 |
+
00:10:44,000 --> 00:10:47,000
|
| 579 |
+
Now you know how to cherrypick multiple Kummetz at once.
|
| 580 |
+
|
| 581 |
+
146
|
| 582 |
+
00:10:47,000 --> 00:10:52,000
|
| 583 |
+
And at the end of the lesson, we learned best practices of using cherrypick command.
|
| 584 |
+
|
| 585 |
+
147
|
| 586 |
+
00:10:52,000 --> 00:10:54,000
|
| 587 |
+
That's all for today.
|
| 588 |
+
|
| 589 |
+
148
|
| 590 |
+
00:10:54,000 --> 00:10:57,000
|
| 591 |
+
Thanks a lot for your attention and see you in the next lesson.
|
| 592 |
+
|
17 - GIT/019 Cloning remote repository git clone.html
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
+
<title>Cloning remote repository git clone</title>
|
| 7 |
+
|
| 8 |
+
<style>
|
| 9 |
+
* {
|
| 10 |
+
box-sizing: border-box;
|
| 11 |
+
margin: 0;
|
| 12 |
+
padding: 0;
|
| 13 |
+
}
|
| 14 |
+
body {
|
| 15 |
+
font-family: var(--font-stack-text);
|
| 16 |
+
font-weight: 400;
|
| 17 |
+
line-height: 1.4;
|
| 18 |
+
font-size: 1.6rem;
|
| 19 |
+
color: #2d2f31;
|
| 20 |
+
}
|
| 21 |
+
.container {
|
| 22 |
+
position: relative;
|
| 23 |
+
height: 100%;
|
| 24 |
+
overflow-y: auto;
|
| 25 |
+
}
|
| 26 |
+
.content {
|
| 27 |
+
padding: 3.2rem 4.8rem;
|
| 28 |
+
word-break: break-word;
|
| 29 |
+
max-width: 69.6rem;
|
| 30 |
+
margin: 0 auto;
|
| 31 |
+
}
|
| 32 |
+
.heading {
|
| 33 |
+
margin-bottom: 24px;
|
| 34 |
+
font-family: -apple-system, BlinkMacSystemFont, Roboto, "Segoe UI", Helvetica, Arial, sans-serif,
|
| 35 |
+
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
| 36 |
+
font-weight: 700;
|
| 37 |
+
line-height: 1.2;
|
| 38 |
+
letter-spacing: 0;
|
| 39 |
+
font-size: 32px;
|
| 40 |
+
max-width: 36em;
|
| 41 |
+
}
|
| 42 |
+
.article-asset-container {
|
| 43 |
+
padding: 2.4rem;
|
| 44 |
+
}
|
| 45 |
+
.article-asset-container p {
|
| 46 |
+
font-size: 19px;
|
| 47 |
+
}
|
| 48 |
+
code {
|
| 49 |
+
background-color: #fff;
|
| 50 |
+
border: 1px solid #d1d7dc;
|
| 51 |
+
color: #b4690e;
|
| 52 |
+
font-size: 80%;
|
| 53 |
+
padding: 0.2rem 0.4rem;
|
| 54 |
+
font-family: sfmono-regular, Consolas, liberation mono, Menlo, Courier, monospace;
|
| 55 |
+
}
|
| 56 |
+
p {
|
| 57 |
+
font-weight: 400;
|
| 58 |
+
}
|
| 59 |
+
</style>
|
| 60 |
+
</head>
|
| 61 |
+
<body>
|
| 62 |
+
<div class="container">
|
| 63 |
+
<div class="content">
|
| 64 |
+
<div class="heading">Cloning remote repository git clone</div>
|
| 65 |
+
<div class="article-asset-container"><p>To clone remote repository, please, follow next steps:</p><p>- Open the repository that you want to clone, for example, open my repository for my Java students here - https://github.com/AndriiPiatakha/learnit_java_core</p><p>- On the github, find green button with the 'Code' text on it. <br>- Select the protocol that you want to use during the cloning git repository. You can select either HTTPS or SSH. Please, take a look at the screenshot.<br></p><figure><img src="https://img-c.udemycdn.com/redactor/raw/article_lecture/2020-11-05_14-12-12-67371fa192aa3ddf03456864b51b9a53.jpg"></figure><p><br>- copy the string with address to the clipboard. </p><p>- navigate in your filesystem where you want to clone your repository<br>- open gitbash in that directory and type the next:<br><br><strong><em>git clone <HERE PASTE THE STATE OF YOUR CLIPBOARD></em></strong></p><p>Take a look at the screenshot:</p><figure><img src="https://img-c.udemycdn.com/redactor/raw/article_lecture/2020-11-05_14-14-43-dd660c5627f6c2b83a7fdd847108c5e1.jpg"></figure><p>- Press enter button</p><p>- Congratulations! You have just cloned the remote repository!</p></div>
|
| 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+
00:00:06,000 --> 00:00:10,000
|
| 3 |
+
And now the students in this class and we are going to discuss the topic that will be interesting for
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:10,000 --> 00:00:16,000
|
| 7 |
+
developers who work in such integrated development environment as Eclipse, we're going to learn today
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:16,000 --> 00:00:22,000
|
| 11 |
+
how to integrate it with eclipse for development come for besides buttons and widgets that will configure
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:22,000 --> 00:00:24,000
|
| 15 |
+
an eclipse during the lesson.
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:24,000 --> 00:00:30,000
|
| 19 |
+
I will show you how you can use get Bush directly from the eclipse together on real example.
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:30,000 --> 00:00:33,000
|
| 23 |
+
We are going to learn how to execute basic operations from Eclipse.
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:34,000 --> 00:00:40,000
|
| 27 |
+
I make overview of widgets that will allow you to see good history navigate between branches, push
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:40,000 --> 00:00:43,000
|
| 31 |
+
and pull changes from the remote repository.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:43,000 --> 00:00:48,000
|
| 35 |
+
After this lesson, you will learn how you can resolve conflicts in eclipse interface.
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:49,000 --> 00:00:51,000
|
| 39 |
+
Let's start and turn the topic.
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:51,000 --> 00:00:53,000
|
| 43 |
+
I said just jump into the practice.
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:53,000 --> 00:00:55,000
|
| 47 |
+
Here's my Eclipse workspace.
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:55,000 --> 00:01:00,000
|
| 51 |
+
I created a completely new workspace and reset perspective for you to default to configure it with you
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:01:00,000 --> 00:01:01,000
|
| 55 |
+
from scratch.
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:01:01,000 --> 00:01:07,000
|
| 59 |
+
I have Empathies Java Project, which we did together during the learning of the get in the workspace.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:01:07,000 --> 00:01:09,000
|
| 63 |
+
How to Impact Projects into Eclipse.
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:09,000 --> 00:01:11,000
|
| 67 |
+
I'm going to show you in the separate lesson.
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:11,000 --> 00:01:14,000
|
| 71 |
+
Do not lose focus from the topic right now.
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:15,000 --> 00:01:22,000
|
| 75 |
+
When I in the Project Eclipse automatically recognised that there is a git repository and you see that
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:22,000 --> 00:01:25,000
|
| 79 |
+
in square brackets, it is even specifying my current branch.
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:26,000 --> 00:01:31,000
|
| 83 |
+
But nevertheless, I will show you how that you get repository to eclipse manually just in case.
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:32,000 --> 00:01:35,000
|
| 87 |
+
First of all, let's add all views here that we need.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:36,000 --> 00:01:38,000
|
| 91 |
+
Click on Window Show.
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:38,000 --> 00:01:43,000
|
| 95 |
+
You are the one here git folder or use search bar to find it faster.
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:44,000 --> 00:01:47,000
|
| 99 |
+
I would say that you'd stadion and git repositories.
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:47,000 --> 00:01:48,000
|
| 103 |
+
Those are tools that you need.
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:48,000 --> 00:01:49,000
|
| 107 |
+
One hundred percent.
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:50,000 --> 00:01:56,000
|
| 111 |
+
Well, at least in my opinion, I'm holding control button and with a mouse left click select the options
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:01:56,000 --> 00:01:57,000
|
| 115 |
+
that I need.
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:01:58,000 --> 00:02:04,000
|
| 119 |
+
Let's also select get lock and it is good that we have learned how to work with Gatins again.
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:04,000 --> 00:02:08,000
|
| 123 |
+
But at least now you already understand what all these views are about.
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:09,000 --> 00:02:13,000
|
| 127 |
+
You already know what is a staging area, what is a good red flag.
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:13,000 --> 00:02:19,000
|
| 131 |
+
You already know what they're getting directed for basis after we selected all use we need.
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:19,000 --> 00:02:20,000
|
| 135 |
+
Let's press open button.
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:22,000 --> 00:02:30,000
|
| 139 |
+
Nice views were opened just to remind you that you can move these views wherever you like them most
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:30,000 --> 00:02:32,000
|
| 143 |
+
here in the clips, for example.
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:32,000 --> 00:02:36,000
|
| 147 |
+
Let me move git repositories widget here at the bottom with other views.
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:36,000 --> 00:02:41,000
|
| 151 |
+
And you can see that my clips recognized each repository in my project automatically.
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:42,000 --> 00:02:47,000
|
| 155 |
+
But just for the future and just in case, I want you to know how to add the existing repository to
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:47,000 --> 00:02:53,000
|
| 159 |
+
their clips, because it might be that the clips will not automatically recognize that you have not
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:53,000 --> 00:02:54,000
|
| 163 |
+
get folder in your project.
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:02:54,000 --> 00:02:57,000
|
| 167 |
+
And in this case you have to edit manually.
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:02:58,000 --> 00:03:03,000
|
| 171 |
+
For the sake of example, let me remove the digital repository from this view in the clips mouse right.
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:03:03,000 --> 00:03:11,000
|
| 175 |
+
Click remove repository from you because I want to remove git repository only from eclipse view and
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:11,000 --> 00:03:17,000
|
| 179 |
+
I don't want to remove the don't get folder from the file system and I don't want to remove the project
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:17,000 --> 00:03:20,000
|
| 183 |
+
and eclipse associated with this git repository.
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:20,000 --> 00:03:23,000
|
| 187 |
+
I want to keep project in my workspace for you.
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:23,000 --> 00:03:25,000
|
| 191 |
+
That's why I press this button.
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:26,000 --> 00:03:27,000
|
| 195 |
+
Awesome.
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:27,000 --> 00:03:30,000
|
| 199 |
+
Now we don't have any repository here.
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:30,000 --> 00:03:32,000
|
| 203 |
+
You can create a new repository if you wish.
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:33,000 --> 00:03:35,000
|
| 207 |
+
That is similar to executing Mutiny's.
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:35,000 --> 00:03:35,000
|
| 211 |
+
Come on.
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:36,000 --> 00:03:40,000
|
| 215 |
+
You might also an existing repository with the help of the eclipse wizard.
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:40,000 --> 00:03:45,000
|
| 219 |
+
And in case you already have git repository in your computer, you can just add it to the workspace.
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:46,000 --> 00:03:51,000
|
| 223 |
+
I believe there is no need to go over each of this option in detail because creating a good repository
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:03:51,000 --> 00:03:56,000
|
| 227 |
+
is just specifying directory where you want to create don't get older and present.
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:03:56,000 --> 00:04:02,000
|
| 231 |
+
Great Bottom Clonan Repository is just specifying the past as a repository and your credentials in case
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:04:02,000 --> 00:04:05,000
|
| 235 |
+
you want a repository with the help of a HTTPS protocol.
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:04:06,000 --> 00:04:13,000
|
| 239 |
+
But from my experience, this option at an existing local repository is used most of the times by me,
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:14,000 --> 00:04:19,000
|
| 243 |
+
and I don't know why, probably because I don't rely on the eclipse tools to manage Mangat repository.
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:19,000 --> 00:04:26,000
|
| 247 |
+
Usually I fetch all projects with a simple git clone command in the git bash and after that an important
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:26,000 --> 00:04:30,000
|
| 251 |
+
project to the eclipse and an existing local git repository.
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:31,000 --> 00:04:37,000
|
| 255 |
+
Personally, for me, this option is the easiest one, but my job is to share with you all possible
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:37,000 --> 00:04:40,000
|
| 259 |
+
options and let you decide what works the best for you.
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:41,000 --> 00:04:46,000
|
| 263 |
+
That's why let me show you how I usually add existing local repositories to Eclipse.
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:46,000 --> 00:04:53,000
|
| 267 |
+
And now you should specify a folder where your local repository is located and navigate it to the folder
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:53,000 --> 00:04:59,000
|
| 271 |
+
that we created together during the course while learning Gaede and press select folder button here
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:59,000 --> 00:05:02,000
|
| 275 |
+
clip's shows me repositories that it found in this folder.
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:05:02,000 --> 00:05:08,000
|
| 279 |
+
I checked this checkbox and press that button and here's my repository back again.
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:05:09,000 --> 00:05:10,000
|
| 283 |
+
Let me expand it.
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:05:11,000 --> 00:05:13,000
|
| 287 |
+
It is very convenient to switch branches here.
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:05:14,000 --> 00:05:20,000
|
| 291 |
+
You might find here local and remote branches nable left click on the massive branch will move me to
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:05:20,000 --> 00:05:23,000
|
| 295 |
+
the master branch eclipse will ask for confirmation.
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:05:24,000 --> 00:05:28,000
|
| 299 |
+
Just click checkout and you already know how you check out command works.
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:28,000 --> 00:05:35,000
|
| 303 |
+
So I believe you understood what happened behind the scene and you may see a small T care next to the
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:35,000 --> 00:05:36,000
|
| 307 |
+
massive branch name.
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:37,000 --> 00:05:40,000
|
| 311 |
+
Let me switch back to the Kayseri 09 branch.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:41,000 --> 00:05:41,000
|
| 315 |
+
Right.
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:41,000 --> 00:05:47,000
|
| 319 |
+
Click on the branch would allow you to do the operations that will want to perform in Git Bush.
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:47,000 --> 00:05:51,000
|
| 323 |
+
You may reset branch in different modes, so it makes and hard.
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:52,000 --> 00:05:58,000
|
| 327 |
+
You may replace your branch if needed, merged, delete, rename and perform all other operations that
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:58,000 --> 00:06:00,000
|
| 331 |
+
you may perform in the git bash.
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:06:01,000 --> 00:06:05,000
|
| 335 |
+
We don't have docs in our repository yet, so it is empty here.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:06:06,000 --> 00:06:13,000
|
| 339 |
+
What a task is will be discussed in the separate question here, you may find your main references in
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:06:13,000 --> 00:06:13,000
|
| 343 |
+
your repository.
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:06:13,000 --> 00:06:17,000
|
| 347 |
+
You may check out the if you wish in remote.
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:06:17,000 --> 00:06:24,000
|
| 351 |
+
You may check to what remote repository you are connected right now in Stasch comments, you can explore
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:06:24,000 --> 00:06:25,000
|
| 355 |
+
the state of your stasch.
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:06:26,000 --> 00:06:33,000
|
| 359 |
+
And you're working directory, that is technically a project that may collapse everything here, based
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:33,000 --> 00:06:38,000
|
| 363 |
+
on my experience, I mostly use this section to navigate between branches, create new branch if needed,
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:38,000 --> 00:06:40,000
|
| 367 |
+
and remove all branches.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:41,000 --> 00:06:48,000
|
| 371 |
+
Let's move on this, Sunny, as a positive name means that I have some onstage changes you may find
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:48,000 --> 00:06:48,000
|
| 375 |
+
similar.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:48,000 --> 00:06:54,000
|
| 379 |
+
Some here in the package explore how to identify what change are we talking about?
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:54,000 --> 00:06:56,000
|
| 383 |
+
Let's check separate tab for that.
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:06:56,000 --> 00:07:02,000
|
| 387 |
+
Yet, Stadion here, you can manage what is in the staging area right here, commit message and commit
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:07:02,000 --> 00:07:03,000
|
| 391 |
+
changes if you want.
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:07:03,000 --> 00:07:08,000
|
| 395 |
+
You also can commit and push to the remote with a single button click here.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:07:08,000 --> 00:07:13,000
|
| 399 |
+
From this view, I see that DOT project file is marked as unstaged changes here.
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:07:14,000 --> 00:07:20,000
|
| 403 |
+
This is configuration of eclipse file that the groups created after we implement the project into it.
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:07:20,000 --> 00:07:22,000
|
| 407 |
+
Let me update yet.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:07:22,000 --> 00:07:23,000
|
| 411 |
+
Ignore the just ignore this file.
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:07:24,000 --> 00:07:28,000
|
| 415 |
+
I can't find it in your file in the package Explorer review.
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:28,000 --> 00:07:30,000
|
| 419 |
+
But let me open the gate of you for that.
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:31,000 --> 00:07:34,000
|
| 423 |
+
I click window shoe view navigator.
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:35,000 --> 00:07:42,000
|
| 427 |
+
And this view, I can see old files as they are look like in my file system and here's Technophile,
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:43,000 --> 00:07:46,000
|
| 431 |
+
let me add here DOT Project and save the file.
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:47,000 --> 00:07:53,000
|
| 435 |
+
And you must use it instantly, not project file is gone from unstaged changes and to ignore it, you're
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:54,000 --> 00:07:59,000
|
| 439 |
+
going to press this green plus sign to add all files from this section to the stage changes section.
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:07:59,000 --> 00:08:00,000
|
| 443 |
+
That's right.
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:08:00,000 --> 00:08:03,000
|
| 447 |
+
Commit message and troops files ignored.
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:08:03,000 --> 00:08:09,000
|
| 451 |
+
And I can make a comment by clicking here, but probably I would commit and push changes to the remote
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:08:09,000 --> 00:08:11,000
|
| 455 |
+
repository simultaneously.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:08:11,000 --> 00:08:16,000
|
| 459 |
+
To do this, I have to click on it and push button here in the desert.
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:08:16,000 --> 00:08:19,000
|
| 463 |
+
You should set up stream branch for the current branch.
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:08:19,000 --> 00:08:25,000
|
| 467 |
+
That is exactly what we did when we specified you option during the push to the remote repository.
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:08:26,000 --> 00:08:32,000
|
| 471 |
+
Just click all these buttons until you see confirmation that your changes were pushed because the remote
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:08:32,000 --> 00:08:37,000
|
| 475 |
+
we may check GitHub, but believe me, changes are there in the remote already.
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:08:37,000 --> 00:08:40,000
|
| 479 |
+
Let me show you a few more things you can press.
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:40,000 --> 00:08:41,000
|
| 483 |
+
Mouse, right.
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:41,000 --> 00:08:44,000
|
| 487 |
+
Click on the project and you'll find a team section.
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:45,000 --> 00:08:48,000
|
| 491 |
+
This section is integration with it in Eclipse.
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:48,000 --> 00:08:54,000
|
| 495 |
+
And you might find here a lot of different options like fetch from upstream push or bold changes and
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:08:54,000 --> 00:08:55,000
|
| 499 |
+
many others.
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:08:56,000 --> 00:09:02,000
|
| 503 |
+
Take your time to investigate the section and ask me in case you have any questions to check, commit
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:09:02,000 --> 00:09:02,000
|
| 507 |
+
history.
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:09:03,000 --> 00:09:06,000
|
| 511 |
+
You can press show in history here.
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:09:06,000 --> 00:09:11,000
|
| 515 |
+
You may see cammed hash commit message, author of the Commit and Date of the Snapshot.
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:09:11,000 --> 00:09:16,000
|
| 519 |
+
And this window, you can check what files were changed in scope of the particular comment.
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:09:16,000 --> 00:09:21,000
|
| 523 |
+
You may open the file to see the difference before and after the snapshot to understand what exactly
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:09:21,000 --> 00:09:22,000
|
| 527 |
+
was changed.
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:09:23,000 --> 00:09:28,000
|
| 531 |
+
This is where we use a full tool during the investigation of the effects when after specific commit
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:09:28,000 --> 00:09:29,000
|
| 535 |
+
something went wrong.
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:09:30,000 --> 00:09:35,000
|
| 539 |
+
Also here in the history, you may reset your branch to a specific committee or check out there.
|
| 540 |
+
|
| 541 |
+
136
|
| 542 |
+
00:09:36,000 --> 00:09:37,000
|
| 543 |
+
You just click mouse, right.
|
| 544 |
+
|
| 545 |
+
137
|
| 546 |
+
00:09:37,000 --> 00:09:40,000
|
| 547 |
+
Click and select exactly what you need.
|
| 548 |
+
|
| 549 |
+
138
|
| 550 |
+
00:09:41,000 --> 00:09:46,000
|
| 551 |
+
Now I want to show you a few more configurations that I found extremely helpful.
|
| 552 |
+
|
| 553 |
+
139
|
| 554 |
+
00:09:46,000 --> 00:09:50,000
|
| 555 |
+
I want to tell you how you can add a few buttons here on the toolbar.
|
| 556 |
+
|
| 557 |
+
140
|
| 558 |
+
00:09:50,000 --> 00:09:54,000
|
| 559 |
+
Click window perspective, customize perspective.
|
| 560 |
+
|
| 561 |
+
141
|
| 562 |
+
00:09:55,000 --> 00:09:59,000
|
| 563 |
+
Now go to the action of ability and select it here.
|
| 564 |
+
|
| 565 |
+
142
|
| 566 |
+
00:09:59,000 --> 00:10:05,000
|
| 567 |
+
After that, go to the toolbar visibility and make sure that it is selected here.
|
| 568 |
+
|
| 569 |
+
143
|
| 570 |
+
00:10:06,000 --> 00:10:11,000
|
| 571 |
+
Click, apply and close, and now here on the top, you have very convenient buttons.
|
| 572 |
+
|
| 573 |
+
144
|
| 574 |
+
00:10:12,000 --> 00:10:20,000
|
| 575 |
+
No matter what you want to do, push back from upstream pool, check out the branch, Rebase Mirch,
|
| 576 |
+
|
| 577 |
+
145
|
| 578 |
+
00:10:20,000 --> 00:10:26,000
|
| 579 |
+
or he said you can start the separation's simply by clicking the right button in the toolbar.
|
| 580 |
+
|
| 581 |
+
146
|
| 582 |
+
00:10:27,000 --> 00:10:33,000
|
| 583 |
+
And even in case you can't find is important that you need or you want to execute some specific command
|
| 584 |
+
|
| 585 |
+
147
|
| 586 |
+
00:10:33,000 --> 00:10:34,000
|
| 587 |
+
was a specific option.
|
| 588 |
+
|
| 589 |
+
148
|
| 590 |
+
00:10:34,000 --> 00:10:40,000
|
| 591 |
+
You always may open it feedback directly from Eclipse and start working it to open it.
|
| 592 |
+
|
| 593 |
+
149
|
| 594 |
+
00:10:40,000 --> 00:10:44,000
|
| 595 |
+
Bushing An Eclipse finds the icon of the console in the toolbar.
|
| 596 |
+
|
| 597 |
+
150
|
| 598 |
+
00:10:45,000 --> 00:10:48,000
|
| 599 |
+
Hear this, click on it and select it.
|
| 600 |
+
|
| 601 |
+
151
|
| 602 |
+
00:10:48,000 --> 00:10:53,000
|
| 603 |
+
Bush in the dropdown here in the bus should be installed on your computer.
|
| 604 |
+
|
| 605 |
+
152
|
| 606 |
+
00:10:53,000 --> 00:10:58,000
|
| 607 |
+
In either case, you won't be able to find it here in the dropdown list.
|
| 608 |
+
|
| 609 |
+
153
|
| 610 |
+
00:10:58,000 --> 00:11:02,000
|
| 611 |
+
Now you may click OK Button and terminal is opened.
|
| 612 |
+
|
| 613 |
+
154
|
| 614 |
+
00:11:03,000 --> 00:11:05,000
|
| 615 |
+
Important thing to mention here.
|
| 616 |
+
|
| 617 |
+
155
|
| 618 |
+
00:11:05,000 --> 00:11:11,000
|
| 619 |
+
Always pay attention to the directory WAGGETT Bush is opened in case you have multiple yet repositories
|
| 620 |
+
|
| 621 |
+
156
|
| 622 |
+
00:11:11,000 --> 00:11:19,000
|
| 623 |
+
in the single eclipse workspace that keeps my open you another directory or it may open your home directory
|
| 624 |
+
|
| 625 |
+
157
|
| 626 |
+
00:11:20,000 --> 00:11:23,000
|
| 627 |
+
to make sure that eclipse will open the user right directly.
|
| 628 |
+
|
| 629 |
+
158
|
| 630 |
+
00:11:23,000 --> 00:11:29,000
|
| 631 |
+
I always press the project first here and only after that I click open terminal icon homes.
|
| 632 |
+
|
| 633 |
+
159
|
| 634 |
+
00:11:29,000 --> 00:11:31,000
|
| 635 |
+
This information will help you.
|
| 636 |
+
|
| 637 |
+
160
|
| 638 |
+
00:11:31,000 --> 00:11:33,000
|
| 639 |
+
That is practical, deep.
|
| 640 |
+
|
| 641 |
+
161
|
| 642 |
+
00:11:33,000 --> 00:11:35,000
|
| 643 |
+
That is really helpful to students in my opinion.
|
| 644 |
+
|
| 645 |
+
162
|
| 646 |
+
00:11:36,000 --> 00:11:38,000
|
| 647 |
+
We didn't talk about Rafalski yet.
|
| 648 |
+
|
| 649 |
+
163
|
| 650 |
+
00:11:38,000 --> 00:11:40,000
|
| 651 |
+
Nothing special here.
|
| 652 |
+
|
| 653 |
+
164
|
| 654 |
+
00:11:40,000 --> 00:11:44,000
|
| 655 |
+
I believe you already learned in the separate lesson what a greater focus here.
|
| 656 |
+
|
| 657 |
+
165
|
| 658 |
+
00:11:44,000 --> 00:11:48,000
|
| 659 |
+
You might find the red flag, if you will domus right click.
|
| 660 |
+
|
| 661 |
+
166
|
| 662 |
+
00:11:48,000 --> 00:11:51,000
|
| 663 |
+
You can find additional options that might be useful for you.
|
| 664 |
+
|
| 665 |
+
167
|
| 666 |
+
00:11:52,000 --> 00:11:57,000
|
| 667 |
+
And the last things that I wanted to share with you today is to show you how you can resolve conflicts
|
| 668 |
+
|
| 669 |
+
168
|
| 670 |
+
00:11:57,000 --> 00:12:02,000
|
| 671 |
+
in eclipse, especially for that I prepared a separate branch where I reproduce, merge conflicts,
|
| 672 |
+
|
| 673 |
+
169
|
| 674 |
+
00:12:02,000 --> 00:12:06,000
|
| 675 |
+
state how to reproduce and what merge conflict is.
|
| 676 |
+
|
| 677 |
+
170
|
| 678 |
+
00:12:06,000 --> 00:12:12,000
|
| 679 |
+
Please feel free to learn in the separate lesson dedicated to the merge conflicts in this lesson output
|
| 680 |
+
|
| 681 |
+
171
|
| 682 |
+
00:12:12,000 --> 00:12:15,000
|
| 683 |
+
the stress only on the eclipse tools to integrate with the grid.
|
| 684 |
+
|
| 685 |
+
172
|
| 686 |
+
00:12:16,000 --> 00:12:19,000
|
| 687 |
+
Here is a separate branch with so much conflict in it.
|
| 688 |
+
|
| 689 |
+
173
|
| 690 |
+
00:12:20,000 --> 00:12:22,000
|
| 691 |
+
I called the branch merge conflict dilemma.
|
| 692 |
+
|
| 693 |
+
174
|
| 694 |
+
00:12:23,000 --> 00:12:29,000
|
| 695 |
+
Usually when you have much conflict, eclipse highlights to your files in which you have much conflict
|
| 696 |
+
|
| 697 |
+
175
|
| 698 |
+
00:12:29,000 --> 00:12:30,000
|
| 699 |
+
with the red dots like this.
|
| 700 |
+
|
| 701 |
+
176
|
| 702 |
+
00:12:31,000 --> 00:12:37,000
|
| 703 |
+
So now it is impossible to mis file with the next conflict when we open the file, which is a good science
|
| 704 |
+
|
| 705 |
+
177
|
| 706 |
+
00:12:37,000 --> 00:12:41,000
|
| 707 |
+
where I get separated for different state of the file from different snapshots.
|
| 708 |
+
|
| 709 |
+
178
|
| 710 |
+
00:12:42,000 --> 00:12:45,000
|
| 711 |
+
But the groups offer special tool to merge conflicts in files.
|
| 712 |
+
|
| 713 |
+
179
|
| 714 |
+
00:12:46,000 --> 00:12:48,000
|
| 715 |
+
Let me show it to you, Mouse.
|
| 716 |
+
|
| 717 |
+
180
|
| 718 |
+
00:12:48,000 --> 00:12:53,000
|
| 719 |
+
Right, click on file game merge two here on top.
|
| 720 |
+
|
| 721 |
+
181
|
| 722 |
+
00:12:53,000 --> 00:12:56,000
|
| 723 |
+
You are going to see Kummetz hash that have conflict.
|
| 724 |
+
|
| 725 |
+
182
|
| 726 |
+
00:12:57,000 --> 00:13:04,000
|
| 727 |
+
Usually you can't edit text in the window on the right, but you can modify text in the window on the
|
| 728 |
+
|
| 729 |
+
183
|
| 730 |
+
00:13:04,000 --> 00:13:04,000
|
| 731 |
+
left.
|
| 732 |
+
|
| 733 |
+
184
|
| 734 |
+
00:13:04,000 --> 00:13:09,000
|
| 735 |
+
Here you can click this arrow to place everything from the right window to the left window.
|
| 736 |
+
|
| 737 |
+
185
|
| 738 |
+
00:13:10,000 --> 00:13:15,000
|
| 739 |
+
When you are going to have more conflicts, there will be different arrows for each specific conflict.
|
| 740 |
+
|
| 741 |
+
186
|
| 742 |
+
00:13:16,000 --> 00:13:21,000
|
| 743 |
+
And after you modify the file on the left, you can press control and ask to save the file.
|
| 744 |
+
|
| 745 |
+
187
|
| 746 |
+
00:13:21,000 --> 00:13:27,000
|
| 747 |
+
If we would check the same file in the text editor, we are going to find that all signs that it put
|
| 748 |
+
|
| 749 |
+
188
|
| 750 |
+
00:13:27,000 --> 00:13:27,000
|
| 751 |
+
here.
|
| 752 |
+
|
| 753 |
+
189
|
| 754 |
+
00:13:27,000 --> 00:13:31,000
|
| 755 |
+
I removed grate in the gas station.
|
| 756 |
+
|
| 757 |
+
190
|
| 758 |
+
00:13:31,000 --> 00:13:34,000
|
| 759 |
+
You can put a file to the staging area to more conflict.
|
| 760 |
+
|
| 761 |
+
191
|
| 762 |
+
00:13:34,000 --> 00:13:39,000
|
| 763 |
+
As a result, when conflict is resolved, you may see a small asterisk on the file.
|
| 764 |
+
|
| 765 |
+
192
|
| 766 |
+
00:13:39,000 --> 00:13:45,000
|
| 767 |
+
And after all, conflicts are resolved and there are no more red dots, you can open it.
|
| 768 |
+
|
| 769 |
+
193
|
| 770 |
+
00:13:45,000 --> 00:13:46,000
|
| 771 |
+
Brush and continue.
|
| 772 |
+
|
| 773 |
+
194
|
| 774 |
+
00:13:46,000 --> 00:13:48,000
|
| 775 |
+
Is a rebasing or cherrypicking something?
|
| 776 |
+
|
| 777 |
+
195
|
| 778 |
+
00:13:48,000 --> 00:13:50,000
|
| 779 |
+
What caused the merge conflicts?
|
| 780 |
+
|
| 781 |
+
196
|
| 782 |
+
00:13:51,000 --> 00:13:55,000
|
| 783 |
+
I believe we learned a lot today about the clips and get integration.
|
| 784 |
+
|
| 785 |
+
197
|
| 786 |
+
00:13:55,000 --> 00:14:02,000
|
| 787 |
+
Now I want you to take your time and as much heat related violence as possible to learn the material
|
| 788 |
+
|
| 789 |
+
198
|
| 790 |
+
00:14:02,000 --> 00:14:02,000
|
| 791 |
+
better.
|
| 792 |
+
|
| 793 |
+
199
|
| 794 |
+
00:14:02,000 --> 00:14:06,000
|
| 795 |
+
The best thing to learn this is to practice as much as you can.
|
| 796 |
+
|
| 797 |
+
200
|
| 798 |
+
00:14:07,000 --> 00:14:10,000
|
| 799 |
+
Meanwhile, let's recap what we have learned today.
|
| 800 |
+
|
| 801 |
+
201
|
| 802 |
+
00:14:10,000 --> 00:14:13,000
|
| 803 |
+
The Navy learned how we might interact with it.
|
| 804 |
+
|
| 805 |
+
202
|
| 806 |
+
00:14:13,000 --> 00:14:18,000
|
| 807 |
+
With the help of a glimpse, we learned what views the clips we may use to execute to give commands.
|
| 808 |
+
|
| 809 |
+
203
|
| 810 |
+
00:14:19,000 --> 00:14:25,000
|
| 811 |
+
Also today, you saw how you can execute basic operations from a collapse besides the collapse configuration.
|
| 812 |
+
|
| 813 |
+
204
|
| 814 |
+
00:14:25,000 --> 00:14:32,000
|
| 815 |
+
We also learned how to use it directly from Eclipse today, where even did can commit and push that
|
| 816 |
+
|
| 817 |
+
205
|
| 818 |
+
00:14:32,000 --> 00:14:34,000
|
| 819 |
+
snapshot to the remote repository.
|
| 820 |
+
|
| 821 |
+
206
|
| 822 |
+
00:14:34,000 --> 00:14:39,000
|
| 823 |
+
And in the end of the lesson, I showed you how you might use magenta in eclipse.
|
| 824 |
+
|
| 825 |
+
207
|
| 826 |
+
00:14:39,000 --> 00:14:41,000
|
| 827 |
+
Hope you enjoyed the lesson.
|
| 828 |
+
|
| 829 |
+
208
|
| 830 |
+
00:14:41,000 --> 00:14:44,000
|
| 831 |
+
Thanks a lot for your attention and see you in the next lesson.
|
| 832 |
+
|
17 - GIT/external-links.txt
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
002 Git-download-Web-site
|
| 3 |
+
https://git-scm.com/downloads
|
| 4 |
+
|
| 5 |
+
005 Git-ignore-for-different-languages
|
| 6 |
+
https://github.com/github/gitignore
|
| 7 |
+
|
| 8 |
+
009 -ls-command-details
|
| 9 |
+
https://www.rapidtables.com/code/linux/ls.html
|
18 - Excpetion Handling/001 Exception Handling in Java_en.srt
ADDED
|
@@ -0,0 +1,1500 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1
|
| 2 |
+
00:00:05,000 --> 00:00:06,000
|
| 3 |
+
Hello there.
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:06,000 --> 00:00:10,000
|
| 7 |
+
Students in this class and we are going to discuss an important topic, you would use knowledge from
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:10,000 --> 00:00:13,000
|
| 11 |
+
this last year in your own life as a software engineer.
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:14,000 --> 00:00:17,000
|
| 15 |
+
They will talk about exceptions and how to handle exceptions in Java.
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:17,000 --> 00:00:19,000
|
| 19 |
+
I will explain what exceptions are.
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:20,000 --> 00:00:22,000
|
| 23 |
+
We will talk about Iraqi of exceptions.
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:23,000 --> 00:00:24,000
|
| 27 |
+
After this lesson.
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:24,000 --> 00:00:27,000
|
| 31 |
+
You will understand what checked and checked exceptions are.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:27,000 --> 00:00:30,000
|
| 35 |
+
Besides all this, we are going to learn how to handle exceptions.
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:30,000 --> 00:00:35,000
|
| 39 |
+
You'll learn what try catch block is and what finally block is well known.
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:35,000 --> 00:00:38,000
|
| 43 |
+
Different variations of catch blocks in this lesson.
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:38,000 --> 00:00:42,000
|
| 47 |
+
We'll also talk about how to declare that some method will throw exception.
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:43,000 --> 00:00:48,000
|
| 51 |
+
You are going to learn what specific case was thrown exceptions during inheritance and methods of arriving.
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:00:48,000 --> 00:00:54,000
|
| 55 |
+
And at the end of the lesson you learn how to create your own custom exceptions to meet the requirements
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:00:54,000 --> 00:00:55,000
|
| 59 |
+
of business logic.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:00:55,000 --> 00:01:00,000
|
| 63 |
+
During the lesson I, I'll share with you best practices and tips how to work with exceptions in Java
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:00,000 --> 00:01:03,000
|
| 67 |
+
to help you handle exceptions like approach.
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:03,000 --> 00:01:08,000
|
| 71 |
+
Let's start from understanding what exceptions have explaining in simple words.
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:08,000 --> 00:01:14,000
|
| 75 |
+
Imagine that you wrote the logic for your online store, and the content managers may now upload information
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:14,000 --> 00:01:21,000
|
| 79 |
+
about products to your program manager, store information about products and specific files with GSV
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:21,000 --> 00:01:28,000
|
| 83 |
+
format that is comma separated values format that is widely used in transferring and storing data will
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:28,000 --> 00:01:33,000
|
| 87 |
+
face with files of such format in the near future will not focus on the specific file format.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:34,000 --> 00:01:39,000
|
| 91 |
+
Just imagine that managers can upload information with products to your program, bypassing a specific
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:39,000 --> 00:01:39,000
|
| 95 |
+
file.
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:40,000 --> 00:01:46,000
|
| 99 |
+
And what if manager parse the file name and file past that does not exist on the file system at all.
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:46,000 --> 00:01:48,000
|
| 103 |
+
That is exceptional case.
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:48,000 --> 00:01:52,000
|
| 107 |
+
Your program does not have predefined logic by default to handle that.
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:53,000 --> 00:01:54,000
|
| 111 |
+
That is called exception.
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:01:55,000 --> 00:02:01,000
|
| 115 |
+
Your program can't predict that users who will interact with your program will pass invalid link to
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:02:01,000 --> 00:02:02,000
|
| 119 |
+
the file.
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:02,000 --> 00:02:06,000
|
| 123 |
+
It is not an issue of your application that is technical limitations at all.
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:06,000 --> 00:02:08,000
|
| 127 |
+
Users should respect.
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:09,000 --> 00:02:14,000
|
| 131 |
+
But what to do in this case, they have to catch this exceptional case and write a code that will tell
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:14,000 --> 00:02:15,000
|
| 135 |
+
what to do next.
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:15,000 --> 00:02:22,000
|
| 139 |
+
In such cases, for example, do we want to inform our users that file does not exist and let him or
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:22,000 --> 00:02:24,000
|
| 143 |
+
her to upload file one more time?
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:24,000 --> 00:02:29,000
|
| 147 |
+
Or do we want to just ignore this fact and inform users at zero products added?
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:30,000 --> 00:02:36,000
|
| 151 |
+
Product owners can come up with numerous cases how to handle this case from user experience site, but
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:36,000 --> 00:02:38,000
|
| 155 |
+
we have to implement that.
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:38,000 --> 00:02:40,000
|
| 159 |
+
Does this example make sense clearer?
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:40,000 --> 00:02:43,000
|
| 163 |
+
Can you understand now what an exception is?
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:02:43,000 --> 00:02:47,000
|
| 167 |
+
OK, if you understood this example, let's move on.
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:02:47,000 --> 00:02:50,000
|
| 171 |
+
The next example would be a bit more technical.
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:02:50,000 --> 00:02:54,000
|
| 175 |
+
That's why let me show it to you on the real code example.
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:02:55,000 --> 00:02:59,000
|
| 179 |
+
Imagine that you implemented masses that should charge users during the checkout process.
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:00,000 --> 00:03:02,000
|
| 183 |
+
We call it charge user.
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:02,000 --> 00:03:07,000
|
| 187 |
+
And this matter takes user object as an argument, an amount of money to charge.
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:07,000 --> 00:03:15,000
|
| 191 |
+
Specially for this example, I created simple class user that contains only one filled amount of money
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:15,000 --> 00:03:20,000
|
| 195 |
+
and tumescence getter and setter to manipulate with the state of this type.
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:20,000 --> 00:03:24,000
|
| 199 |
+
This simple user class will keep you focused on our example.
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:25,000 --> 00:03:28,000
|
| 203 |
+
Imagine that we want to update amount of money in user object.
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:29,000 --> 00:03:35,000
|
| 207 |
+
That's why you call Sattar Masset to set amount of money that is less than current amount by the order
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:35,000 --> 00:03:36,000
|
| 211 |
+
price.
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:36,000 --> 00:03:41,000
|
| 215 |
+
But for some reasons there is no user object behind this reference.
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:41,000 --> 00:03:42,000
|
| 219 |
+
How this can happen?
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:43,000 --> 00:03:46,000
|
| 223 |
+
There are dozens of reasons database didn't return.
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:03:46,000 --> 00:03:53,000
|
| 227 |
+
The information about the user or some error happened on database site or in case you want to take information
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:03:53,000 --> 00:03:55,000
|
| 231 |
+
about user from current obsession.
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:03:55,000 --> 00:03:59,000
|
| 235 |
+
But user is locked out in another Web browser tab.
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:03:59,000 --> 00:04:05,000
|
| 239 |
+
I can continue if you want, but I want you to understand that there are always chances that something
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:05,000 --> 00:04:05,000
|
| 243 |
+
will go wrong.
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:06,000 --> 00:04:10,000
|
| 247 |
+
And at the end of the day, user variable will reference to the null.
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:11,000 --> 00:04:12,000
|
| 251 |
+
When will call mascot's on?
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:12,000 --> 00:04:13,000
|
| 255 |
+
No reference.
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:13,000 --> 00:04:15,000
|
| 259 |
+
We are going to have a new pointer exception.
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:16,000 --> 00:04:18,000
|
| 263 |
+
Here's an example and main method.
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:18,000 --> 00:04:22,000
|
| 267 |
+
You can see that I created a user variable that is reference to non-value.
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:23,000 --> 00:04:28,000
|
| 271 |
+
That is just for the sake of example, in real life in this line can be retrieved the user from the
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:28,000 --> 00:04:32,000
|
| 275 |
+
database or from the session for this example.
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:04:32,000 --> 00:04:33,000
|
| 279 |
+
It doesn't matter.
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:04:33,000 --> 00:04:36,000
|
| 283 |
+
And here I have order price.
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:04:36,000 --> 00:04:39,000
|
| 287 |
+
I want to charge my user during the checkout.
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:04:39,000 --> 00:04:41,000
|
| 291 |
+
I passed this variable to the it.
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:04:42,000 --> 00:04:43,000
|
| 295 |
+
Can you guess what will happen?
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:04:44,000 --> 00:04:45,000
|
| 299 |
+
You are right.
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:04:45,000 --> 00:04:48,000
|
| 303 |
+
My program will be terminated because of Northpoint exception.
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:04:49,000 --> 00:04:53,000
|
| 307 |
+
Let me run this program to prove this and here is no point the exception.
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:04:53,000 --> 00:05:01,000
|
| 311 |
+
As I promised, I have it because I tried to call method some behavior on the object that doesn't exist.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:02,000 --> 00:05:05,000
|
| 315 |
+
So there are no methods for new values.
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:05,000 --> 00:05:12,000
|
| 319 |
+
This is also exceptional case and our program program can't understand what it has to do in case there
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:12,000 --> 00:05:13,000
|
| 323 |
+
is no object.
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:14,000 --> 00:05:19,000
|
| 327 |
+
And now, when you understood what an exception is, let's categorize them.
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:20,000 --> 00:05:21,000
|
| 331 |
+
There are two groups.
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:05:21,000 --> 00:05:23,000
|
| 335 |
+
Have exceptions checked and checked.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:05:23,000 --> 00:05:25,000
|
| 339 |
+
What is the difference between them?
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:05:25,000 --> 00:05:28,000
|
| 343 |
+
Let me explain in simple words, no point.
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:05:28,000 --> 00:05:31,000
|
| 347 |
+
The exception that you saw is unchecked exception.
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:05:32,000 --> 00:05:34,000
|
| 351 |
+
It isn't checked during compilation time.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:05:35,000 --> 00:05:38,000
|
| 355 |
+
Moreover, why it should be checked at compile time.
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:05:38,000 --> 00:05:45,000
|
| 359 |
+
If a developer wants to call Masset on some object developer should ensure that the rest of the program
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:05:45,000 --> 00:05:47,000
|
| 363 |
+
is written in the way to pass.
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:05:47,000 --> 00:05:50,000
|
| 367 |
+
Not no value to this method.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:05:50,000 --> 00:05:55,000
|
| 371 |
+
And if there is now there is no error of user interaction with the program.
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:05:55,000 --> 00:05:58,000
|
| 375 |
+
There is a defect in the way how program is written.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:05:59,000 --> 00:06:04,000
|
| 379 |
+
On the other hand, check the exception is an exceptional case that is checked during compilation time.
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:05,000 --> 00:06:11,000
|
| 383 |
+
For example, user pass the filename to read from these kind of errors is checked at compile time.
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:06:12,000 --> 00:06:12,000
|
| 387 |
+
Why?
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:06:13,000 --> 00:06:19,000
|
| 391 |
+
Because in this case there could be case when the user will pass the filename that doesn't exist and
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:06:19,000 --> 00:06:23,000
|
| 395 |
+
this case is obvious and it doesn't depend on developer.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:06:23,000 --> 00:06:29,000
|
| 399 |
+
So check the exceptions exist to predict errors of user interaction with the program and they can be
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:06:29,000 --> 00:06:32,000
|
| 403 |
+
verified at compile time and check.
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:06:32,000 --> 00:06:38,000
|
| 407 |
+
The exceptions usually appear during the runtime and can't be checked beforehand.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:06:38,000 --> 00:06:42,000
|
| 411 |
+
Can you understand now what checked and checked exceptions are?
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:06:43,000 --> 00:06:49,000
|
| 415 |
+
You already saw no pointer exception and understood and checked exceptions before learning of Iraqi
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:06:49,000 --> 00:06:50,000
|
| 419 |
+
exceptions and details.
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:06:50,000 --> 00:06:54,000
|
| 423 |
+
I'm one of you understand example of checked exception.
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:06:54,000 --> 00:07:00,000
|
| 427 |
+
Sheizaf files class that contains Massud to read the content of the files and write content through
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:00,000 --> 00:07:01,000
|
| 431 |
+
the files.
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:01,000 --> 00:07:08,000
|
| 435 |
+
Imagine that we want to read text from file and here instead of this text, it can be that I have some
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:08,000 --> 00:07:11,000
|
| 439 |
+
variables that is passed to my program by user, for example.
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:07:11,000 --> 00:07:19,000
|
| 443 |
+
And you can see that in this case there is a compilation error unhandled exception of Type II or exception.
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:07:19,000 --> 00:07:26,000
|
| 447 |
+
And you can see that compiler checks a potential exception and compiler insists on Hanlon's exception.
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:07:27,000 --> 00:07:32,000
|
| 451 |
+
In other words, Compiler wants us to write the code here that would tell what to do in case the file
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:07:32,000 --> 00:07:33,000
|
| 455 |
+
wasn't found.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:07:34,000 --> 00:07:38,000
|
| 459 |
+
So one of our tasks today also to learn how to handle exceptions in Java.
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:07:38,000 --> 00:07:44,000
|
| 463 |
+
But before that, I want to complete the topic of exceptions in Iraq to make sure you understood it.
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:07:45,000 --> 00:07:51,000
|
| 467 |
+
So you already shown real examples of what is checked and unchecked exceptions and what does that mean?
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:07:51,000 --> 00:07:57,000
|
| 471 |
+
Now, let's look at exceptions, the Iraqis to understand what types of exceptions exist and whether
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:07:57,000 --> 00:07:58,000
|
| 475 |
+
they are checked on, checked.
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:07:59,000 --> 00:08:02,000
|
| 479 |
+
And you already know everything in Java is an object.
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:02,000 --> 00:08:06,000
|
| 483 |
+
That means how exceptions are also objects of specific type.
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:07,000 --> 00:08:15,000
|
| 487 |
+
That's why on this slide, you can see Iraqi of classes that are used to create exception objects on
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:15,000 --> 00:08:16,000
|
| 491 |
+
top of the Iraqi.
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:16,000 --> 00:08:22,000
|
| 495 |
+
We have Straubel class that is basic class for all exceptions and instances of this type.
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:08:22,000 --> 00:08:23,000
|
| 499 |
+
I checked exceptions.
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:08:24,000 --> 00:08:27,000
|
| 503 |
+
Throw will is extended by two Ozeki types.
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:08:27,000 --> 00:08:33,000
|
| 507 |
+
They are error and exception, error type and all the descendants unchecked.
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:08:33,000 --> 00:08:34,000
|
| 511 |
+
Why?
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:08:34,000 --> 00:08:40,000
|
| 515 |
+
Because errors are type of exceptional cases in our program execution when something went completely
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:08:40,000 --> 00:08:43,000
|
| 519 |
+
wrong and there is no chance to fix this already.
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:08:44,000 --> 00:08:50,000
|
| 523 |
+
There is no need to handle this type of exceptional case because you even won't be able to do anything,
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:08:51,000 --> 00:08:53,000
|
| 527 |
+
for example, out of memory error.
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:08:53,000 --> 00:08:59,000
|
| 531 |
+
If you are in the position when you run out of memory, there is even no memory for you to create a
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:08:59,000 --> 00:09:00,000
|
| 535 |
+
new object.
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:09:00,000 --> 00:09:01,000
|
| 539 |
+
This makes sense.
|
| 540 |
+
|
| 541 |
+
136
|
| 542 |
+
00:09:02,000 --> 00:09:04,000
|
| 543 |
+
Another example is stack overflow error.
|
| 544 |
+
|
| 545 |
+
137
|
| 546 |
+
00:09:05,000 --> 00:09:06,000
|
| 547 |
+
It is thrown by GM.
|
| 548 |
+
|
| 549 |
+
138
|
| 550 |
+
00:09:06,000 --> 00:09:10,000
|
| 551 |
+
When Stack memory's finished, Sarat Das error is thrown.
|
| 552 |
+
|
| 553 |
+
139
|
| 554 |
+
00:09:10,000 --> 00:09:15,000
|
| 555 |
+
When you try to invoke a method on the threat of executions, it was already stopped.
|
| 556 |
+
|
| 557 |
+
140
|
| 558 |
+
00:09:15,000 --> 00:09:18,000
|
| 559 |
+
And again, there is nothing you can do about this.
|
| 560 |
+
|
| 561 |
+
141
|
| 562 |
+
00:09:18,000 --> 00:09:26,000
|
| 563 |
+
That's why all errors and checked and another Iraqi is Iraqi of exception types on the sense of exception
|
| 564 |
+
|
| 565 |
+
142
|
| 566 |
+
00:09:26,000 --> 00:09:30,000
|
| 567 |
+
type beside the sentence of runtime exception type.
|
| 568 |
+
|
| 569 |
+
143
|
| 570 |
+
00:09:30,000 --> 00:09:34,000
|
| 571 |
+
I checked and only runtime exception was its descendants is unchecked.
|
| 572 |
+
|
| 573 |
+
144
|
| 574 |
+
00:09:35,000 --> 00:09:37,000
|
| 575 |
+
That is something that we just have to remember.
|
| 576 |
+
|
| 577 |
+
145
|
| 578 |
+
00:09:38,000 --> 00:09:45,000
|
| 579 |
+
I know that this might seem not logical to you, but it is as it is, the most popular checked exceptions
|
| 580 |
+
|
| 581 |
+
146
|
| 582 |
+
00:09:45,000 --> 00:09:51,000
|
| 583 |
+
that extended from exception type a group of I o exceptions, those exceptions that are associated with
|
| 584 |
+
|
| 585 |
+
147
|
| 586 |
+
00:09:51,000 --> 00:09:53,000
|
| 587 |
+
input output streams.
|
| 588 |
+
|
| 589 |
+
148
|
| 590 |
+
00:09:53,000 --> 00:09:56,000
|
| 591 |
+
Also, there are a group of checked Ezekial exceptions.
|
| 592 |
+
|
| 593 |
+
149
|
| 594 |
+
00:09:57,000 --> 00:10:01,000
|
| 595 |
+
Additionally, you can explore Iraqian your source code edit by reviewing.
|
| 596 |
+
|
| 597 |
+
150
|
| 598 |
+
00:10:01,000 --> 00:10:08,000
|
| 599 |
+
Iraq exceptions, if you missed the lesson when I explained how to do that, I will show you this in
|
| 600 |
+
|
| 601 |
+
151
|
| 602 |
+
00:10:08,000 --> 00:10:14,000
|
| 603 |
+
the minute and runtime exceptions, those exceptions that are not checked by the compiler during the
|
| 604 |
+
|
| 605 |
+
152
|
| 606 |
+
00:10:14,000 --> 00:10:20,000
|
| 607 |
+
compilation process, there are such exceptions as no pointer exception as we already sort of the arithmetic
|
| 608 |
+
|
| 609 |
+
153
|
| 610 |
+
00:10:20,000 --> 00:10:21,000
|
| 611 |
+
exception.
|
| 612 |
+
|
| 613 |
+
154
|
| 614 |
+
00:10:21,000 --> 00:10:28,000
|
| 615 |
+
So that's when we divided into zero class cast exceptions at the throne when it is not possible to cast
|
| 616 |
+
|
| 617 |
+
155
|
| 618 |
+
00:10:28,000 --> 00:10:30,000
|
| 619 |
+
types illegal argument exception.
|
| 620 |
+
|
| 621 |
+
156
|
| 622 |
+
00:10:30,000 --> 00:10:34,000
|
| 623 |
+
No such aliment exception array index out of bounds exception.
|
| 624 |
+
|
| 625 |
+
157
|
| 626 |
+
00:10:35,000 --> 00:10:39,000
|
| 627 |
+
Those are all unchecked exceptions that are consequences of development errors.
|
| 628 |
+
|
| 629 |
+
158
|
| 630 |
+
00:10:40,000 --> 00:10:48,000
|
| 631 |
+
Compiler won't be able to check those because those that can be identified only during the runtime.
|
| 632 |
+
|
| 633 |
+
159
|
| 634 |
+
00:10:48,000 --> 00:10:55,000
|
| 635 |
+
Is it clear also now when we learned a hierarchy of exceptions, it is time to start look at examples
|
| 636 |
+
|
| 637 |
+
160
|
| 638 |
+
00:10:55,000 --> 00:10:58,000
|
| 639 |
+
and understand how we can handle exceptions.
|
| 640 |
+
|
| 641 |
+
161
|
| 642 |
+
00:10:58,000 --> 00:11:04,000
|
| 643 |
+
By the way, before we start, I promised to show you how you can explore type hierarchy in idea.
|
| 644 |
+
|
| 645 |
+
162
|
| 646 |
+
00:11:04,000 --> 00:11:10,000
|
| 647 |
+
First of all, I open a type, I press control shift and simultaneously to open exception type.
|
| 648 |
+
|
| 649 |
+
163
|
| 650 |
+
00:11:11,000 --> 00:11:15,000
|
| 651 |
+
And when I open the exception type, I press F for key.
|
| 652 |
+
|
| 653 |
+
164
|
| 654 |
+
00:11:16,000 --> 00:11:22,000
|
| 655 |
+
And here on the left you can see that I opened type Iraqi and I can scroll and navigate here to explore
|
| 656 |
+
|
| 657 |
+
165
|
| 658 |
+
00:11:22,000 --> 00:11:24,000
|
| 659 |
+
hierarchy of type exception.
|
| 660 |
+
|
| 661 |
+
166
|
| 662 |
+
00:11:25,000 --> 00:11:27,000
|
| 663 |
+
Hobbs's will help you during your self application.
|
| 664 |
+
|
| 665 |
+
167
|
| 666 |
+
00:11:28,000 --> 00:11:30,000
|
| 667 |
+
And now let's get back to exceptions handlin.
|
| 668 |
+
|
| 669 |
+
168
|
| 670 |
+
00:11:31,000 --> 00:11:35,000
|
| 671 |
+
As we already discussed, there is not so much sense to handle and exception.
|
| 672 |
+
|
| 673 |
+
169
|
| 674 |
+
00:11:36,000 --> 00:11:39,000
|
| 675 |
+
You still can do that for some specific reasons if you want.
|
| 676 |
+
|
| 677 |
+
170
|
| 678 |
+
00:11:39,000 --> 00:11:45,000
|
| 679 |
+
But in most cases it is better to fix your code, not face with runtime exceptions at all.
|
| 680 |
+
|
| 681 |
+
171
|
| 682 |
+
00:11:45,000 --> 00:11:52,000
|
| 683 |
+
That's why during the next examples, I'm going to use checked exceptions for the purposes the remember
|
| 684 |
+
|
| 685 |
+
172
|
| 686 |
+
00:11:52,000 --> 00:11:55,000
|
| 687 |
+
example with reading files that doesn't exist.
|
| 688 |
+
|
| 689 |
+
173
|
| 690 |
+
00:11:56,000 --> 00:11:59,000
|
| 691 |
+
Let me show you now how we can handle that exception.
|
| 692 |
+
|
| 693 |
+
174
|
| 694 |
+
00:11:59,000 --> 00:12:04,000
|
| 695 |
+
You have to surround the code that potentially can throw an exception with try catch block.
|
| 696 |
+
|
| 697 |
+
175
|
| 698 |
+
00:12:05,000 --> 00:12:06,000
|
| 699 |
+
The syntax is simple.
|
| 700 |
+
|
| 701 |
+
176
|
| 702 |
+
00:12:07,000 --> 00:12:07,000
|
| 703 |
+
You're right.
|
| 704 |
+
|
| 705 |
+
177
|
| 706 |
+
00:12:07,000 --> 00:12:09,000
|
| 707 |
+
Try keyword followed by braze.
|
| 708 |
+
|
| 709 |
+
178
|
| 710 |
+
00:12:10,000 --> 00:12:14,000
|
| 711 |
+
After that goes code that potentially can throw an exception.
|
| 712 |
+
|
| 713 |
+
179
|
| 714 |
+
00:12:14,000 --> 00:12:21,000
|
| 715 |
+
And after that you write catch keyword and declare a local variable of type that you want to catch.
|
| 716 |
+
|
| 717 |
+
180
|
| 718 |
+
00:12:21,000 --> 00:12:29,000
|
| 719 |
+
In our particular case, we want to catch I o exception in case exceptions will be thrown will get into
|
| 720 |
+
|
| 721 |
+
181
|
| 722 |
+
00:12:29,000 --> 00:12:30,000
|
| 723 |
+
this block.
|
| 724 |
+
|
| 725 |
+
182
|
| 726 |
+
00:12:30,000 --> 00:12:39,000
|
| 727 |
+
So here object of I o exception will be created in this local variable will be used to get access to
|
| 728 |
+
|
| 729 |
+
183
|
| 730 |
+
00:12:39,000 --> 00:12:40,000
|
| 731 |
+
the exception object.
|
| 732 |
+
|
| 733 |
+
184
|
| 734 |
+
00:12:41,000 --> 00:12:44,000
|
| 735 |
+
Why do I need this in real life.
|
| 736 |
+
|
| 737 |
+
185
|
| 738 |
+
00:12:44,000 --> 00:12:46,000
|
| 739 |
+
You use reference to the exception.
|
| 740 |
+
|
| 741 |
+
186
|
| 742 |
+
00:12:46,000 --> 00:12:53,000
|
| 743 |
+
Object to look stack trace interviewed later here for the sake of example, I retrieve an array of stack
|
| 744 |
+
|
| 745 |
+
187
|
| 746 |
+
00:12:53,000 --> 00:12:55,000
|
| 747 |
+
trace elements and print it in one line.
|
| 748 |
+
|
| 749 |
+
188
|
| 750 |
+
00:12:56,000 --> 00:12:59,000
|
| 751 |
+
Also you can get the root cause of the error in case there are any.
|
| 752 |
+
|
| 753 |
+
189
|
| 754 |
+
00:13:00,000 --> 00:13:05,000
|
| 755 |
+
I'll get mad if there is any further debugging purposes we can print, stack, trace to console.
|
| 756 |
+
|
| 757 |
+
190
|
| 758 |
+
00:13:06,000 --> 00:13:12,000
|
| 759 |
+
Let me run this program to show you that we enter it catch block and here you can see text that we printed
|
| 760 |
+
|
| 761 |
+
191
|
| 762 |
+
00:13:12,000 --> 00:13:14,000
|
| 763 |
+
to console from our catch block.
|
| 764 |
+
|
| 765 |
+
192
|
| 766 |
+
00:13:15,000 --> 00:13:18,000
|
| 767 |
+
Can I understand now how you can catch exceptions?
|
| 768 |
+
|
| 769 |
+
193
|
| 770 |
+
00:13:18,000 --> 00:13:21,000
|
| 771 |
+
If yes, then let's press it now.
|
| 772 |
+
|
| 773 |
+
194
|
| 774 |
+
00:13:21,000 --> 00:13:23,000
|
| 775 |
+
Let me show you another example.
|
| 776 |
+
|
| 777 |
+
195
|
| 778 |
+
00:13:23,000 --> 00:13:28,000
|
| 779 |
+
There is another syntax that allows you to use multiple exceptions in catch clause.
|
| 780 |
+
|
| 781 |
+
196
|
| 782 |
+
00:13:29,000 --> 00:13:30,000
|
| 783 |
+
Let me open another file.
|
| 784 |
+
|
| 785 |
+
197
|
| 786 |
+
00:13:31,000 --> 00:13:38,000
|
| 787 |
+
Imagine that you wrote code to handle an exception, but now we also have code to get connection to
|
| 788 |
+
|
| 789 |
+
198
|
| 790 |
+
00:13:38,000 --> 00:13:39,000
|
| 791 |
+
the database.
|
| 792 |
+
|
| 793 |
+
199
|
| 794 |
+
00:13:39,000 --> 00:13:43,000
|
| 795 |
+
This Masset get connection also can throw an exception.
|
| 796 |
+
|
| 797 |
+
200
|
| 798 |
+
00:13:44,000 --> 00:13:47,000
|
| 799 |
+
That's why you have to handle potential Ezekial exception.
|
| 800 |
+
|
| 801 |
+
201
|
| 802 |
+
00:13:48,000 --> 00:13:50,000
|
| 803 |
+
There are two options to do that.
|
| 804 |
+
|
| 805 |
+
202
|
| 806 |
+
00:13:50,000 --> 00:13:55,000
|
| 807 |
+
You can add an exception to existing clause like this by using or operator.
|
| 808 |
+
|
| 809 |
+
203
|
| 810 |
+
00:13:56,000 --> 00:14:03,000
|
| 811 |
+
In this case, I tell that this variable E will be either of Type II or exception or Ezekial exception
|
| 812 |
+
|
| 813 |
+
204
|
| 814 |
+
00:14:03,000 --> 00:14:06,000
|
| 815 |
+
because in the case exception will be thrown in.
|
| 816 |
+
|
| 817 |
+
205
|
| 818 |
+
00:14:06,000 --> 00:14:11,000
|
| 819 |
+
This line will instantly get to the cadge block and we will catch I.
|
| 820 |
+
|
| 821 |
+
206
|
| 822 |
+
00:14:11,000 --> 00:14:17,000
|
| 823 |
+
O exception and case exception will happen and this line will get to catch block and will have Ezekial
|
| 824 |
+
|
| 825 |
+
207
|
| 826 |
+
00:14:17,000 --> 00:14:18,000
|
| 827 |
+
exception.
|
| 828 |
+
|
| 829 |
+
208
|
| 830 |
+
00:14:18,000 --> 00:14:25,000
|
| 831 |
+
This syntax works just fine if you want to program the same behavior for multiple errors, for example,
|
| 832 |
+
|
| 833 |
+
209
|
| 834 |
+
00:14:26,000 --> 00:14:28,000
|
| 835 |
+
if have one, just log error and that's it.
|
| 836 |
+
|
| 837 |
+
210
|
| 838 |
+
00:14:29,000 --> 00:14:34,000
|
| 839 |
+
But in case you want to implement different logic, to handle different exceptions, you have to implement
|
| 840 |
+
|
| 841 |
+
211
|
| 842 |
+
00:14:34,000 --> 00:14:35,000
|
| 843 |
+
different cadge block.
|
| 844 |
+
|
| 845 |
+
212
|
| 846 |
+
00:14:36,000 --> 00:14:42,000
|
| 847 |
+
For example, in the first case, let's notify users that this file doesn't exist and ask user to provide
|
| 848 |
+
|
| 849 |
+
213
|
| 850 |
+
00:14:42,000 --> 00:14:44,000
|
| 851 |
+
a path to a new file.
|
| 852 |
+
|
| 853 |
+
214
|
| 854 |
+
00:14:44,000 --> 00:14:50,000
|
| 855 |
+
In either case, let's notify users that there is an error with database and there is nothing.
|
| 856 |
+
|
| 857 |
+
215
|
| 858 |
+
00:14:50,000 --> 00:14:53,000
|
| 859 |
+
What user can do about this doesn't make sense.
|
| 860 |
+
|
| 861 |
+
216
|
| 862 |
+
00:14:53,000 --> 00:14:59,000
|
| 863 |
+
Can you understand now when to use sketchbook with multiple exception types and when to use multiple
|
| 864 |
+
|
| 865 |
+
217
|
| 866 |
+
00:14:59,000 --> 00:15:01,000
|
| 867 |
+
catch blocks also?
|
| 868 |
+
|
| 869 |
+
218
|
| 870 |
+
00:15:01,000 --> 00:15:02,000
|
| 871 |
+
Let's move on.
|
| 872 |
+
|
| 873 |
+
219
|
| 874 |
+
00:15:03,000 --> 00:15:08,000
|
| 875 |
+
There is one more rule for multiple catch blocks in case there are potentially two types of exceptions
|
| 876 |
+
|
| 877 |
+
220
|
| 878 |
+
00:15:08,000 --> 00:15:15,000
|
| 879 |
+
that are from the same Iraqi, you have to specify the more specific type first and only after that
|
| 880 |
+
|
| 881 |
+
221
|
| 882 |
+
00:15:15,000 --> 00:15:17,000
|
| 883 |
+
specified the most generic time.
|
| 884 |
+
|
| 885 |
+
222
|
| 886 |
+
00:15:17,000 --> 00:15:19,000
|
| 887 |
+
Let me show you this one example.
|
| 888 |
+
|
| 889 |
+
223
|
| 890 |
+
00:15:19,000 --> 00:15:25,000
|
| 891 |
+
Imagine that this line can throw an exception and constructor of a file reader can throw a file not
|
| 892 |
+
|
| 893 |
+
224
|
| 894 |
+
00:15:25,000 --> 00:15:28,000
|
| 895 |
+
found exception, and we can write multiple catch blocks.
|
| 896 |
+
|
| 897 |
+
225
|
| 898 |
+
00:15:29,000 --> 00:15:35,000
|
| 899 |
+
But important thing here is that Philmont found exception is a shell type of IO exception.
|
| 900 |
+
|
| 901 |
+
226
|
| 902 |
+
00:15:36,000 --> 00:15:40,000
|
| 903 |
+
When exceptions will be thrown, each catch close will be checked.
|
| 904 |
+
|
| 905 |
+
227
|
| 906 |
+
00:15:40,000 --> 00:15:47,000
|
| 907 |
+
That's why you can specify Kedge Block with all exceptions, before Kedge Block, which Philmont found
|
| 908 |
+
|
| 909 |
+
228
|
| 910 |
+
00:15:47,000 --> 00:15:47,000
|
| 911 |
+
exception.
|
| 912 |
+
|
| 913 |
+
229
|
| 914 |
+
00:15:48,000 --> 00:15:54,000
|
| 915 |
+
In this case, you're going to have compilation error unreachable catch block because exceptions will
|
| 916 |
+
|
| 917 |
+
230
|
| 918 |
+
00:15:54,000 --> 00:15:58,000
|
| 919 |
+
be handled by the first KEDGE block with generic exception.
|
| 920 |
+
|
| 921 |
+
231
|
| 922 |
+
00:15:58,000 --> 00:16:02,000
|
| 923 |
+
Type Lekman common this code to show you this compilation error.
|
| 924 |
+
|
| 925 |
+
232
|
| 926 |
+
00:16:02,000 --> 00:16:06,000
|
| 927 |
+
And here you can see unreachable kedge block and error.
|
| 928 |
+
|
| 929 |
+
233
|
| 930 |
+
00:16:06,000 --> 00:16:12,000
|
| 931 |
+
This example is very popular in tests during the interview, so please remember that.
|
| 932 |
+
|
| 933 |
+
234
|
| 934 |
+
00:16:12,000 --> 00:16:17,000
|
| 935 |
+
OK, if you understood how to work with multiple kedge blocks, let's look at the next example.
|
| 936 |
+
|
| 937 |
+
235
|
| 938 |
+
00:16:18,000 --> 00:16:22,000
|
| 939 |
+
Before the lesson, I also created another file to them and use the next case.
|
| 940 |
+
|
| 941 |
+
236
|
| 942 |
+
00:16:23,000 --> 00:16:28,000
|
| 943 |
+
Now I want to review as you try Keje finally construction by default.
|
| 944 |
+
|
| 945 |
+
237
|
| 946 |
+
00:16:28,000 --> 00:16:31,000
|
| 947 |
+
Finally Blac will be executed with and without exception.
|
| 948 |
+
|
| 949 |
+
238
|
| 950 |
+
00:16:32,000 --> 00:16:33,000
|
| 951 |
+
Here you can see the same case.
|
| 952 |
+
|
| 953 |
+
239
|
| 954 |
+
00:16:33,000 --> 00:16:35,000
|
| 955 |
+
But with Finally Block.
|
| 956 |
+
|
| 957 |
+
240
|
| 958 |
+
00:16:35,000 --> 00:16:39,000
|
| 959 |
+
Let me around this program again and here and console.
|
| 960 |
+
|
| 961 |
+
241
|
| 962 |
+
00:16:39,000 --> 00:16:44,000
|
| 963 |
+
You can see the text that we printed from our final block right after the stack trace.
|
| 964 |
+
|
| 965 |
+
242
|
| 966 |
+
00:16:44,000 --> 00:16:47,000
|
| 967 |
+
In some particular case you can use try finally block.
|
| 968 |
+
|
| 969 |
+
243
|
| 970 |
+
00:16:48,000 --> 00:16:52,000
|
| 971 |
+
Let me comment these lines and you can see there is no compilation error.
|
| 972 |
+
|
| 973 |
+
244
|
| 974 |
+
00:16:53,000 --> 00:16:59,000
|
| 975 |
+
Usually we use final blog to perform operations that should be executed no matter what happened.
|
| 976 |
+
|
| 977 |
+
245
|
| 978 |
+
00:17:00,000 --> 00:17:02,000
|
| 979 |
+
Is the exception happened or not?
|
| 980 |
+
|
| 981 |
+
246
|
| 982 |
+
00:17:02,000 --> 00:17:04,000
|
| 983 |
+
The code from Final Lock should be executed.
|
| 984 |
+
|
| 985 |
+
247
|
| 986 |
+
00:17:05,000 --> 00:17:09,000
|
| 987 |
+
For example, in the past, final block used to close input output streams.
|
| 988 |
+
|
| 989 |
+
248
|
| 990 |
+
00:17:10,000 --> 00:17:14,000
|
| 991 |
+
Now Thrivers Resources Block is used to close resources automatically.
|
| 992 |
+
|
| 993 |
+
249
|
| 994 |
+
00:17:14,000 --> 00:17:20,000
|
| 995 |
+
I'll show you that during the lesson about input output streams today, you can use final block to release
|
| 996 |
+
|
| 997 |
+
250
|
| 998 |
+
00:17:20,000 --> 00:17:22,000
|
| 999 |
+
some critical resources.
|
| 1000 |
+
|
| 1001 |
+
251
|
| 1002 |
+
00:17:23,000 --> 00:17:29,000
|
| 1003 |
+
Finally, Block will be executed all the times, but there are some exceptions that can prevent you
|
| 1004 |
+
|
| 1005 |
+
252
|
| 1006 |
+
00:17:29,000 --> 00:17:29,000
|
| 1007 |
+
from executing.
|
| 1008 |
+
|
| 1009 |
+
253
|
| 1010 |
+
00:17:29,000 --> 00:17:31,000
|
| 1011 |
+
Finally, block till the end.
|
| 1012 |
+
|
| 1013 |
+
254
|
| 1014 |
+
00:17:31,000 --> 00:17:34,000
|
| 1015 |
+
Let's quickly review these cases.
|
| 1016 |
+
|
| 1017 |
+
255
|
| 1018 |
+
00:17:34,000 --> 00:17:40,000
|
| 1019 |
+
The first case finally block won't be executed in case program is stopped and finally block.
|
| 1020 |
+
|
| 1021 |
+
256
|
| 1022 |
+
00:17:41,000 --> 00:17:43,000
|
| 1023 |
+
That is the case when we stopped giving.
|
| 1024 |
+
|
| 1025 |
+
257
|
| 1026 |
+
00:17:43,000 --> 00:17:50,000
|
| 1027 |
+
Our final block won't be executed till the end in case some exception will happen inside the final block.
|
| 1028 |
+
|
| 1029 |
+
258
|
| 1030 |
+
00:17:51,000 --> 00:17:57,000
|
| 1031 |
+
Also, in case you have noticed, writing the program final block will be executed till the end in case
|
| 1032 |
+
|
| 1033 |
+
259
|
| 1034 |
+
00:17:57,000 --> 00:17:58,000
|
| 1035 |
+
Read will be terminated.
|
| 1036 |
+
|
| 1037 |
+
260
|
| 1038 |
+
00:17:59,000 --> 00:18:02,000
|
| 1039 |
+
Now, I believe you know everything about final blocks.
|
| 1040 |
+
|
| 1041 |
+
261
|
| 1042 |
+
00:18:02,000 --> 00:18:03,000
|
| 1043 |
+
Let's move on.
|
| 1044 |
+
|
| 1045 |
+
262
|
| 1046 |
+
00:18:03,000 --> 00:18:07,000
|
| 1047 |
+
I want to tell you now about Suros Keever, for example.
|
| 1048 |
+
|
| 1049 |
+
263
|
| 1050 |
+
00:18:07,000 --> 00:18:12,000
|
| 1051 |
+
Let me open the source code of Red Alliance Macit here you can see Suros Keevers.
|
| 1052 |
+
|
| 1053 |
+
264
|
| 1054 |
+
00:18:13,000 --> 00:18:14,000
|
| 1055 |
+
What does that mean?
|
| 1056 |
+
|
| 1057 |
+
265
|
| 1058 |
+
00:18:14,000 --> 00:18:20,000
|
| 1059 |
+
That means that this Masset potentially can throw an exception in their custom matters.
|
| 1060 |
+
|
| 1061 |
+
266
|
| 1062 |
+
00:18:20,000 --> 00:18:27,000
|
| 1063 |
+
You would also like to specify that some suros exception if you want to warn all clients of your code
|
| 1064 |
+
|
| 1065 |
+
267
|
| 1066 |
+
00:18:27,000 --> 00:18:29,000
|
| 1067 |
+
to handle some specific cases.
|
| 1068 |
+
|
| 1069 |
+
268
|
| 1070 |
+
00:18:30,000 --> 00:18:33,000
|
| 1071 |
+
In this case it is specified that I have to handle I o exception.
|
| 1072 |
+
|
| 1073 |
+
269
|
| 1074 |
+
00:18:34,000 --> 00:18:39,000
|
| 1075 |
+
Now let's create custom method and declare Tetsuro exception.
|
| 1076 |
+
|
| 1077 |
+
270
|
| 1078 |
+
00:18:39,000 --> 00:18:43,000
|
| 1079 |
+
I open another demo files that I prepared before this lesson.
|
| 1080 |
+
|
| 1081 |
+
271
|
| 1082 |
+
00:18:43,000 --> 00:18:48,000
|
| 1083 |
+
You will be able to find reference to all files from the lesson in the lesson attachments.
|
| 1084 |
+
|
| 1085 |
+
272
|
| 1086 |
+
00:18:49,000 --> 00:18:51,000
|
| 1087 |
+
In this example in class throws Damos.
|
| 1088 |
+
|
| 1089 |
+
273
|
| 1090 |
+
00:18:51,000 --> 00:18:55,000
|
| 1091 |
+
I have some methods that throws file not found exception.
|
| 1092 |
+
|
| 1093 |
+
274
|
| 1094 |
+
00:18:55,000 --> 00:19:02,000
|
| 1095 |
+
After that I create an object of throws them a class and call some Macit Letterman.
|
| 1096 |
+
|
| 1097 |
+
275
|
| 1098 |
+
00:19:02,000 --> 00:19:09,000
|
| 1099 |
+
Command this line and you can see that there is a compilation error because I have to handle potential
|
| 1100 |
+
|
| 1101 |
+
276
|
| 1102 |
+
00:19:09,000 --> 00:19:15,000
|
| 1103 |
+
error and I have to do that even in case I don't have any code in this matter at all.
|
| 1104 |
+
|
| 1105 |
+
277
|
| 1106 |
+
00:19:15,000 --> 00:19:21,000
|
| 1107 |
+
So this declaration is like a warning for everyone who is going to use this method.
|
| 1108 |
+
|
| 1109 |
+
278
|
| 1110 |
+
00:19:22,000 --> 00:19:27,000
|
| 1111 |
+
There is some rule that we all have to know while overwriting methods that throw exception.
|
| 1112 |
+
|
| 1113 |
+
279
|
| 1114 |
+
00:19:28,000 --> 00:19:31,000
|
| 1115 |
+
Let me show it to you on the example in this file.
|
| 1116 |
+
|
| 1117 |
+
280
|
| 1118 |
+
00:19:31,000 --> 00:19:36,000
|
| 1119 |
+
For the sake of the demo, I created one more class that extends through them a class.
|
| 1120 |
+
|
| 1121 |
+
281
|
| 1122 |
+
00:19:37,000 --> 00:19:39,000
|
| 1123 |
+
And I want to write some method.
|
| 1124 |
+
|
| 1125 |
+
282
|
| 1126 |
+
00:19:39,000 --> 00:19:45,000
|
| 1127 |
+
And you can see that I don't necessarily have to add Suros declaration here, and that is fine.
|
| 1128 |
+
|
| 1129 |
+
283
|
| 1130 |
+
00:19:45,000 --> 00:19:49,000
|
| 1131 |
+
I can Atheros declaration if I want one second.
|
| 1132 |
+
|
| 1133 |
+
284
|
| 1134 |
+
00:19:49,000 --> 00:19:50,000
|
| 1135 |
+
Let me add it here.
|
| 1136 |
+
|
| 1137 |
+
285
|
| 1138 |
+
00:19:51,000 --> 00:19:57,000
|
| 1139 |
+
Now, this method also suros file and found exception Massaro as an exception.
|
| 1140 |
+
|
| 1141 |
+
286
|
| 1142 |
+
00:19:58,000 --> 00:19:59,000
|
| 1143 |
+
What about I o exception.
|
| 1144 |
+
|
| 1145 |
+
287
|
| 1146 |
+
00:20:00,000 --> 00:20:00,000
|
| 1147 |
+
Let me try.
|
| 1148 |
+
|
| 1149 |
+
288
|
| 1150 |
+
00:20:01,000 --> 00:20:07,000
|
| 1151 |
+
And now we can see compilation error, exception, IO exception is not compatible with throws clothes
|
| 1152 |
+
|
| 1153 |
+
289
|
| 1154 |
+
00:20:07,000 --> 00:20:09,000
|
| 1155 |
+
and throws them as a method.
|
| 1156 |
+
|
| 1157 |
+
290
|
| 1158 |
+
00:20:09,000 --> 00:20:11,000
|
| 1159 |
+
Now, you know the rule.
|
| 1160 |
+
|
| 1161 |
+
291
|
| 1162 |
+
00:20:11,000 --> 00:20:17,000
|
| 1163 |
+
If you want to declare that some method throws exception and one of the rules for overridden Macit,
|
| 1164 |
+
|
| 1165 |
+
292
|
| 1166 |
+
00:20:18,000 --> 00:20:23,000
|
| 1167 |
+
you have to specify compatible type of exception was the one from original master.
|
| 1168 |
+
|
| 1169 |
+
293
|
| 1170 |
+
00:20:23,000 --> 00:20:31,000
|
| 1171 |
+
So in this case we can specify is a file not found exception or some child of violence found exception.
|
| 1172 |
+
|
| 1173 |
+
294
|
| 1174 |
+
00:20:32,000 --> 00:20:38,000
|
| 1175 |
+
This type of exception doesn't have any child types, but we can create if we want to remove this rose
|
| 1176 |
+
|
| 1177 |
+
295
|
| 1178 |
+
00:20:38,000 --> 00:20:39,000
|
| 1179 |
+
declaration.
|
| 1180 |
+
|
| 1181 |
+
296
|
| 1182 |
+
00:20:40,000 --> 00:20:46,000
|
| 1183 |
+
Now, you know what Sarah's key word means, what to do in case you want to start program execution,
|
| 1184 |
+
|
| 1185 |
+
297
|
| 1186 |
+
00:20:46,000 --> 00:20:51,000
|
| 1187 |
+
in case there is some error, you have to throw an exception how to do that.
|
| 1188 |
+
|
| 1189 |
+
298
|
| 1190 |
+
00:20:52,000 --> 00:20:56,000
|
| 1191 |
+
Let me show it to you and navigate to file was the new example.
|
| 1192 |
+
|
| 1193 |
+
299
|
| 1194 |
+
00:20:56,000 --> 00:21:01,000
|
| 1195 |
+
Imagine that we have mastered that can transfer money from one account to another.
|
| 1196 |
+
|
| 1197 |
+
300
|
| 1198 |
+
00:21:01,000 --> 00:21:03,000
|
| 1199 |
+
It is called transfer money.
|
| 1200 |
+
|
| 1201 |
+
301
|
| 1202 |
+
00:21:04,000 --> 00:21:09,000
|
| 1203 |
+
It gets account from account to and money to transfer amount.
|
| 1204 |
+
|
| 1205 |
+
302
|
| 1206 |
+
00:21:09,000 --> 00:21:14,000
|
| 1207 |
+
By the way, for the sake of the drama, I created account class here in the same file.
|
| 1208 |
+
|
| 1209 |
+
303
|
| 1210 |
+
00:21:14,000 --> 00:21:21,000
|
| 1211 |
+
And the rule of thumb is to validate that all arguments are valid and we can work with them here.
|
| 1212 |
+
|
| 1213 |
+
304
|
| 1214 |
+
00:21:21,000 --> 00:21:25,000
|
| 1215 |
+
You can see if close where I check that from.
|
| 1216 |
+
|
| 1217 |
+
305
|
| 1218 |
+
00:21:25,000 --> 00:21:32,000
|
| 1219 |
+
And two accounts are not you and that from account has enough money to perform a transaction in case
|
| 1220 |
+
|
| 1221 |
+
306
|
| 1222 |
+
00:21:32,000 --> 00:21:34,000
|
| 1223 |
+
is in one of these statements is true.
|
| 1224 |
+
|
| 1225 |
+
307
|
| 1226 |
+
00:21:34,000 --> 00:21:41,000
|
| 1227 |
+
That means that one of the argument is invalid and we can't proceed with this mass execution.
|
| 1228 |
+
|
| 1229 |
+
308
|
| 1230 |
+
00:21:41,000 --> 00:21:46,000
|
| 1231 |
+
That's why I want to stop program execution with illegal argument exception.
|
| 1232 |
+
|
| 1233 |
+
309
|
| 1234 |
+
00:21:46,000 --> 00:21:50,000
|
| 1235 |
+
I read through keyword and create an instance of a legal argument exception.
|
| 1236 |
+
|
| 1237 |
+
310
|
| 1238 |
+
00:21:51,000 --> 00:21:56,000
|
| 1239 |
+
I can use any instance of any type that extends through class after a keyword.
|
| 1240 |
+
|
| 1241 |
+
311
|
| 1242 |
+
00:21:56,000 --> 00:22:00,000
|
| 1243 |
+
In this particular case, I use already predefined type of exception.
|
| 1244 |
+
|
| 1245 |
+
312
|
| 1246 |
+
00:22:01,000 --> 00:22:05,000
|
| 1247 |
+
Let me execute program and call this method with no accounts.
|
| 1248 |
+
|
| 1249 |
+
313
|
| 1250 |
+
00:22:05,000 --> 00:22:08,000
|
| 1251 |
+
And I can see here a legal argument exception.
|
| 1252 |
+
|
| 1253 |
+
314
|
| 1254 |
+
00:22:09,000 --> 00:22:11,000
|
| 1255 |
+
That is how you can throw an exception.
|
| 1256 |
+
|
| 1257 |
+
315
|
| 1258 |
+
00:22:11,000 --> 00:22:13,000
|
| 1259 |
+
Your wish is that clear.
|
| 1260 |
+
|
| 1261 |
+
316
|
| 1262 |
+
00:22:14,000 --> 00:22:19,000
|
| 1263 |
+
Take pause and think for a second about this construction if you understood it.
|
| 1264 |
+
|
| 1265 |
+
317
|
| 1266 |
+
00:22:19,000 --> 00:22:26,000
|
| 1267 |
+
Let me explain this and next thing, each type of stromal has constructor that takes string as an argument.
|
| 1268 |
+
|
| 1269 |
+
318
|
| 1270 |
+
00:22:26,000 --> 00:22:29,000
|
| 1271 |
+
This string is used as a message to our exception.
|
| 1272 |
+
|
| 1273 |
+
319
|
| 1274 |
+
00:22:30,000 --> 00:22:37,000
|
| 1275 |
+
Let me add here in constructor, same message, for example, invalid arguments and let me execute this
|
| 1276 |
+
|
| 1277 |
+
320
|
| 1278 |
+
00:22:37,000 --> 00:22:38,000
|
| 1279 |
+
program again.
|
| 1280 |
+
|
| 1281 |
+
321
|
| 1282 |
+
00:22:38,000 --> 00:22:42,000
|
| 1283 |
+
And here in the sector race, you can see explanatory message.
|
| 1284 |
+
|
| 1285 |
+
322
|
| 1286 |
+
00:22:42,000 --> 00:22:49,000
|
| 1287 |
+
Moreover, in case someone would like to catch this exception, each will has mastered get message.
|
| 1288 |
+
|
| 1289 |
+
323
|
| 1290 |
+
00:22:49,000 --> 00:22:51,000
|
| 1291 |
+
This can return the string.
|
| 1292 |
+
|
| 1293 |
+
324
|
| 1294 |
+
00:22:51,000 --> 00:22:54,000
|
| 1295 |
+
But this is only in case you want to retrieve this message.
|
| 1296 |
+
|
| 1297 |
+
325
|
| 1298 |
+
00:22:55,000 --> 00:22:56,000
|
| 1299 |
+
What else we can do?
|
| 1300 |
+
|
| 1301 |
+
326
|
| 1302 |
+
00:22:57,000 --> 00:23:01,000
|
| 1303 |
+
Sometimes developers drop checked exception with and checked.
|
| 1304 |
+
|
| 1305 |
+
327
|
| 1306 |
+
00:23:01,000 --> 00:23:08,000
|
| 1307 |
+
When we have to do this, we have to do this in case when we have to throw exceptions during the implementation
|
| 1308 |
+
|
| 1309 |
+
328
|
| 1310 |
+
00:23:08,000 --> 00:23:11,000
|
| 1311 |
+
of the method that does not allow us to throw exceptions.
|
| 1312 |
+
|
| 1313 |
+
329
|
| 1314 |
+
00:23:12,000 --> 00:23:12,000
|
| 1315 |
+
But we should.
|
| 1316 |
+
|
| 1317 |
+
330
|
| 1318 |
+
00:23:13,000 --> 00:23:19,000
|
| 1319 |
+
This is really a specific case, but will face with it the first time when we will learn the same topic.
|
| 1320 |
+
|
| 1321 |
+
331
|
| 1322 |
+
00:23:20,000 --> 00:23:20,000
|
| 1323 |
+
I will explain.
|
| 1324 |
+
|
| 1325 |
+
332
|
| 1326 |
+
00:23:20,000 --> 00:23:21,000
|
| 1327 |
+
Is it run?
|
| 1328 |
+
|
| 1329 |
+
333
|
| 1330 |
+
00:23:21,000 --> 00:23:26,000
|
| 1331 |
+
Masset in Runnable interface doesn't throw exceptions, but sometimes we have to.
|
| 1332 |
+
|
| 1333 |
+
334
|
| 1334 |
+
00:23:27,000 --> 00:23:29,000
|
| 1335 |
+
There are also some other cases.
|
| 1336 |
+
|
| 1337 |
+
335
|
| 1338 |
+
00:23:30,000 --> 00:23:33,000
|
| 1339 |
+
I want you to learn this trick and use it when it is needed.
|
| 1340 |
+
|
| 1341 |
+
336
|
| 1342 |
+
00:23:34,000 --> 00:23:37,000
|
| 1343 |
+
Let me come on this line and explain how it works.
|
| 1344 |
+
|
| 1345 |
+
337
|
| 1346 |
+
00:23:38,000 --> 00:23:42,000
|
| 1347 |
+
Each Wrobel type has a constructor that takes us as Wrobel as an argument.
|
| 1348 |
+
|
| 1349 |
+
338
|
| 1350 |
+
00:23:43,000 --> 00:23:50,000
|
| 1351 |
+
This is used when we want to set an original course for the exception here I a runtime exception and
|
| 1352 |
+
|
| 1353 |
+
339
|
| 1354 |
+
00:23:50,000 --> 00:23:53,000
|
| 1355 |
+
posta is constructor a regional exception.
|
| 1356 |
+
|
| 1357 |
+
340
|
| 1358 |
+
00:23:54,000 --> 00:23:57,000
|
| 1359 |
+
Let me run the program now and here and council.
|
| 1360 |
+
|
| 1361 |
+
341
|
| 1362 |
+
00:23:57,000 --> 00:24:03,000
|
| 1363 |
+
You can see that runtime exception was caused by file not found exception.
|
| 1364 |
+
|
| 1365 |
+
342
|
| 1366 |
+
00:24:03,000 --> 00:24:08,000
|
| 1367 |
+
In case somebody would catch this error, he can extract course.
|
| 1368 |
+
|
| 1369 |
+
343
|
| 1370 |
+
00:24:08,000 --> 00:24:15,000
|
| 1371 |
+
Every type of Wrobel has a method yet cause that can return the reference to a regional exception.
|
| 1372 |
+
|
| 1373 |
+
344
|
| 1374 |
+
00:24:15,000 --> 00:24:19,000
|
| 1375 |
+
So that's how you can rub checked exception with and checked exception.
|
| 1376 |
+
|
| 1377 |
+
345
|
| 1378 |
+
00:24:20,000 --> 00:24:27,000
|
| 1379 |
+
And the last but not least for today, I want to teach you how to create your custom exceptions in case
|
| 1380 |
+
|
| 1381 |
+
346
|
| 1382 |
+
00:24:27,000 --> 00:24:33,000
|
| 1383 |
+
you want to express some specific case and business logic with your custom type of exception, you have
|
| 1384 |
+
|
| 1385 |
+
347
|
| 1386 |
+
00:24:33,000 --> 00:24:34,000
|
| 1387 |
+
to decide first.
|
| 1388 |
+
|
| 1389 |
+
348
|
| 1390 |
+
00:24:34,000 --> 00:24:37,000
|
| 1391 |
+
You want to create checks or inject exception.
|
| 1392 |
+
|
| 1393 |
+
349
|
| 1394 |
+
00:24:38,000 --> 00:24:44,000
|
| 1395 |
+
To create an unchecked exception, we have to declare our class that extends runtime exception in case
|
| 1396 |
+
|
| 1397 |
+
350
|
| 1398 |
+
00:24:44,000 --> 00:24:46,000
|
| 1399 |
+
we want to implement and checked exception.
|
| 1400 |
+
|
| 1401 |
+
351
|
| 1402 |
+
00:24:46,000 --> 00:24:52,000
|
| 1403 |
+
As I said, let me open a class with declaration of customer exception here we have not enough money
|
| 1404 |
+
|
| 1405 |
+
352
|
| 1406 |
+
00:24:52,000 --> 00:24:53,000
|
| 1407 |
+
exception.
|
| 1408 |
+
|
| 1409 |
+
353
|
| 1410 |
+
00:24:53,000 --> 00:24:57,000
|
| 1411 |
+
It is unchecked because it extends runtime exception.
|
| 1412 |
+
|
| 1413 |
+
354
|
| 1414 |
+
00:24:57,000 --> 00:25:03,000
|
| 1415 |
+
In case you want to implement checked exception, you have to just extend your custom class from exception
|
| 1416 |
+
|
| 1417 |
+
355
|
| 1418 |
+
00:25:03,000 --> 00:25:04,000
|
| 1419 |
+
type.
|
| 1420 |
+
|
| 1421 |
+
356
|
| 1422 |
+
00:25:04,000 --> 00:25:07,000
|
| 1423 |
+
That's all easy, don't you think?
|
| 1424 |
+
|
| 1425 |
+
357
|
| 1426 |
+
00:25:07,000 --> 00:25:12,000
|
| 1427 |
+
So for the sake of our Demmer, I'm going to keep not enough money exception unchecked.
|
| 1428 |
+
|
| 1429 |
+
358
|
| 1430 |
+
00:25:13,000 --> 00:25:18,000
|
| 1431 |
+
And now when we have our custom exception, let me look at another version of the transfer money.
|
| 1432 |
+
|
| 1433 |
+
359
|
| 1434 |
+
00:25:19,000 --> 00:25:24,000
|
| 1435 |
+
And this version was throw a legal argument, exceptional case from and to accounts.
|
| 1436 |
+
|
| 1437 |
+
360
|
| 1438 |
+
00:25:24,000 --> 00:25:30,000
|
| 1439 |
+
And now and in case there is not enough money on the account from any transaction, we throw our custom
|
| 1440 |
+
|
| 1441 |
+
361
|
| 1442 |
+
00:25:30,000 --> 00:25:32,000
|
| 1443 |
+
exception, not enough money exception.
|
| 1444 |
+
|
| 1445 |
+
362
|
| 1446 |
+
00:25:32,000 --> 00:25:38,000
|
| 1447 |
+
Hobe, this example helps you understand when we might want to use custom exceptions and how we can
|
| 1448 |
+
|
| 1449 |
+
363
|
| 1450 |
+
00:25:38,000 --> 00:25:39,000
|
| 1451 |
+
do that.
|
| 1452 |
+
|
| 1453 |
+
364
|
| 1454 |
+
00:25:40,000 --> 00:25:42,000
|
| 1455 |
+
Now, let's review what we have learned today.
|
| 1456 |
+
|
| 1457 |
+
365
|
| 1458 |
+
00:25:43,000 --> 00:25:44,000
|
| 1459 |
+
Today, we learned a lot of things.
|
| 1460 |
+
|
| 1461 |
+
366
|
| 1462 |
+
00:25:45,000 --> 00:25:48,000
|
| 1463 |
+
Now, you know, what exceptions are we learned in Iraq?
|
| 1464 |
+
|
| 1465 |
+
367
|
| 1466 |
+
00:25:48,000 --> 00:25:54,000
|
| 1467 |
+
Have exceptions also, you learned what checked and checked exceptions are one examples.
|
| 1468 |
+
|
| 1469 |
+
368
|
| 1470 |
+
00:25:54,000 --> 00:25:56,000
|
| 1471 |
+
We learned how to handle exceptions.
|
| 1472 |
+
|
| 1473 |
+
369
|
| 1474 |
+
00:25:56,000 --> 00:26:02,000
|
| 1475 |
+
You saw how we can use try to catch blogs and try catch finally blogs to handle exceptions.
|
| 1476 |
+
|
| 1477 |
+
370
|
| 1478 |
+
00:26:02,000 --> 00:26:07,000
|
| 1479 |
+
In this lesson, you learned what Suros keywords is and how we can use it.
|
| 1480 |
+
|
| 1481 |
+
371
|
| 1482 |
+
00:26:07,000 --> 00:26:13,000
|
| 1483 |
+
We learned how to throw exceptions when we need, and at the end of the lesson we learned how to create
|
| 1484 |
+
|
| 1485 |
+
372
|
| 1486 |
+
00:26:13,000 --> 00:26:16,000
|
| 1487 |
+
our custom checked or unchecked exception.
|
| 1488 |
+
|
| 1489 |
+
373
|
| 1490 |
+
00:26:16,000 --> 00:26:19,000
|
| 1491 |
+
Hope you found this lesson useful for you.
|
| 1492 |
+
|
| 1493 |
+
374
|
| 1494 |
+
00:26:19,000 --> 00:26:21,000
|
| 1495 |
+
Thanks a lot for your attention.
|
| 1496 |
+
|
| 1497 |
+
375
|
| 1498 |
+
00:26:21,000 --> 00:26:23,000
|
| 1499 |
+
See you in the next lesson.
|
| 1500 |
+
|
18 - Excpetion Handling/001 Source-code-of-all-examples-from-the-lesson.url
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[InternetShortcut]
|
| 2 |
+
URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/exceptions
|
18 - Excpetion Handling/external-links.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
001 Source-code-of-all-examples-from-the-lesson
|
| 3 |
+
https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/exceptions
|
19 - Java Collections Framework/001 Java Collections Framework Overview_en.srt
ADDED
|
@@ -0,0 +1,508 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1
|
| 2 |
+
00:00:06,000 --> 00:00:06,000
|
| 3 |
+
Hello.
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:06,000 --> 00:00:10,000
|
| 7 |
+
Students in this region, I'm going to make overview of Java collections framework.
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:10,000 --> 00:00:15,000
|
| 11 |
+
I want you to understand general structure of Java collections framework before we start going deeper
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:15,000 --> 00:00:16,000
|
| 15 |
+
in the details.
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:16,000 --> 00:00:18,000
|
| 19 |
+
And here's our agenda for the day.
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:18,000 --> 00:00:21,000
|
| 23 |
+
We'll talk about what GSF includes in this lesson.
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:21,000 --> 00:00:24,000
|
| 27 |
+
You are going to learn the difference between collections and the rates.
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:24,000 --> 00:00:28,000
|
| 31 |
+
We are going to discuss what advantages collections have over their rates.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:28,000 --> 00:00:34,000
|
| 35 |
+
Also, during the lesson, we are going to talk about two separate Iraqis in Java collections framework
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:34,000 --> 00:00:37,000
|
| 39 |
+
that Zeta's Iraqi of collections and hierarchy of maps.
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:37,000 --> 00:00:39,000
|
| 43 |
+
And what are the difference between them?
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:39,000 --> 00:00:44,000
|
| 47 |
+
I believe this is going to help you significantly to understand the core structure and the next lessons
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:44,000 --> 00:00:45,000
|
| 51 |
+
in general.
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:00:45,000 --> 00:00:50,000
|
| 55 |
+
So let's start and to start with let's answer the question.
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:00:50,000 --> 00:00:54,000
|
| 59 |
+
What does you see, if I will shut and Java collections framework, if you don't mind.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:00:54,000 --> 00:00:56,000
|
| 63 |
+
What does it consist of?
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:00:56,000 --> 00:01:02,000
|
| 67 |
+
GCF is a unified name for the group of the types and algorithms that are developed to store elements
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:02,000 --> 00:01:05,000
|
| 71 |
+
in them and perform manipulations on the group of the objects.
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:06,000 --> 00:01:10,000
|
| 75 |
+
GCF includes next things, collection interfaces.
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:10,000 --> 00:01:16,000
|
| 79 |
+
These are abstract data types that describes the type that my group, multiple elements in the single
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:16,000 --> 00:01:21,000
|
| 83 |
+
unit as a software engineer, are going to use collections all the times to perform operations with
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:21,000 --> 00:01:26,000
|
| 87 |
+
the group of objects, for example, product list in our Web application.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:26,000 --> 00:01:32,000
|
| 91 |
+
This might be a collection of products in the language of Java, and we could perform operations on
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:32,000 --> 00:01:37,000
|
| 95 |
+
the group of the products, for example, search products, or filter them to keep only products that
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:37,000 --> 00:01:43,000
|
| 99 |
+
has priced more than ten dollars or split all the group of products on the equal chance to show products
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:43,000 --> 00:01:45,000
|
| 103 |
+
page by page and a lot of other things.
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:46,000 --> 00:01:49,000
|
| 107 |
+
Can you understand now why we might need collections?
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:50,000 --> 00:01:51,000
|
| 111 |
+
You might think.
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:01:51,000 --> 00:01:56,000
|
| 115 |
+
Isn't that the same what we have arrays for take into account you used to raise already?
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:01:56,000 --> 00:02:02,000
|
| 119 |
+
You might think that for the same purposes you would use arrays a bit later when we would talk about
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:02,000 --> 00:02:04,000
|
| 123 |
+
advantages of collections of arrays.
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:04,000 --> 00:02:10,000
|
| 127 |
+
You would understand why arrays and collections are two different things implementations of collection
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:10,000 --> 00:02:16,000
|
| 131 |
+
interfaces, even despite the fact that abstractions for collections looks the same, the implementation
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:16,000 --> 00:02:20,000
|
| 135 |
+
of this interface at different and fits for different goals.
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:20,000 --> 00:02:26,000
|
| 139 |
+
For example, some collections work the best for adding new elements since the end of the collection,
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:26,000 --> 00:02:31,000
|
| 143 |
+
and developers like that collections because of the constant time of retrieving element from them.
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:31,000 --> 00:02:36,000
|
| 147 |
+
Are the collections work better when you need to add elements in the middle or at the beginning of the
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:36,000 --> 00:02:37,000
|
| 151 |
+
collection?
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:38,000 --> 00:02:41,000
|
| 155 |
+
Other collections work the best in the current environment.
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:41,000 --> 00:02:46,000
|
| 159 |
+
We are going to learn all of these collections and to understand the difference when to use each collection
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:46,000 --> 00:02:47,000
|
| 163 |
+
type.
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:02:48,000 --> 00:02:55,000
|
| 167 |
+
Map interfaces, map interface at different from collections in one important think map is a container
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:02:55,000 --> 00:02:58,000
|
| 171 |
+
that contains pairs of key and value.
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:02:59,000 --> 00:03:05,000
|
| 175 |
+
For example, you may the name of the product category, for example, doors and collections of all
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:05,000 --> 00:03:07,000
|
| 179 |
+
doors associated with it.
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:07,000 --> 00:03:12,000
|
| 183 |
+
You might have goods category and collection of booths associated with that key.
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:13,000 --> 00:03:19,000
|
| 187 |
+
And in case you need to get all doors, you just make a request to the map button on the key to it to
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:19,000 --> 00:03:21,000
|
| 191 |
+
retrieve all doors.
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:21,000 --> 00:03:22,000
|
| 195 |
+
Does it make sense?
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:23,000 --> 00:03:29,000
|
| 199 |
+
Maps are also considered a part of the collections framework because even if they don't have the same
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:29,000 --> 00:03:35,000
|
| 203 |
+
interface as collections, they have operations that allow us to view and interact with them the same
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:35,000 --> 00:03:36,000
|
| 207 |
+
way as with collections.
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:37,000 --> 00:03:43,000
|
| 211 |
+
Implementation of MAP interfaces unions, of course, we are going to discuss different implementations
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:43,000 --> 00:03:48,000
|
| 215 |
+
of the map and we are going to understand when we will use each implementation of the map interface.
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:49,000 --> 00:03:55,000
|
| 219 |
+
Deprecated collections, deprecated collections are also part of the Java collections framework, despite
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:55,000 --> 00:04:00,000
|
| 223 |
+
the fact that it is recommended not to use specific collections sometimes on the Java project.
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:04:00,000 --> 00:04:02,000
|
| 227 |
+
You still going to work with them?
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:04:03,000 --> 00:04:09,000
|
| 231 |
+
Because even nowadays there are a lot of old projects written on Java that require support and maintenance,
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:04:10,000 --> 00:04:11,000
|
| 235 |
+
synchronized collections.
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:04:12,000 --> 00:04:17,000
|
| 239 |
+
There are also special set of collections that are developed to be used in the multithreaded environment.
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:17,000 --> 00:04:19,000
|
| 243 |
+
Let me tell you the example to make you understand.
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:20,000 --> 00:04:25,000
|
| 247 |
+
Imagine that you have collections of users and one administrator of the website removes the user from
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:25,000 --> 00:04:31,000
|
| 251 |
+
the collection and another administrator of the website is iterating over each user in the same collection
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:31,000 --> 00:04:33,000
|
| 255 |
+
to update the state of the total.
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:33,000 --> 00:04:39,000
|
| 259 |
+
Orders about the conflict might appear when two administrators in the two separate threats of execution
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:40,000 --> 00:04:41,000
|
| 263 |
+
would obtain the same collection.
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:42,000 --> 00:04:47,000
|
| 267 |
+
In this course, I'm going to tell you how centralized collections work and how to use them.
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:48,000 --> 00:04:50,000
|
| 271 |
+
Algorithms also.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:50,000 --> 00:04:56,000
|
| 275 |
+
GCF includes algorithms that are the methods that perform useful computations, such as searching and
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:04:56,000 --> 00:05:03,000
|
| 279 |
+
sorting on objects that implement collection interfaces that algorithms are said to be polymorphic.
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:05:03,000 --> 00:05:08,000
|
| 283 |
+
That is, the same method can be used on many different implementations of the appropriate collection
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:05:08,000 --> 00:05:09,000
|
| 287 |
+
interface.
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:05:10,000 --> 00:05:17,000
|
| 291 |
+
Robbers GCF contains a special wrapper that can turn your regular collection into non modifiable collection
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:05:18,000 --> 00:05:23,000
|
| 295 |
+
or wrapper, that can turn your regular collection into synchronized collection that you can use and
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:05:23,000 --> 00:05:24,000
|
| 299 |
+
will just write an environment.
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:25,000 --> 00:05:31,000
|
| 303 |
+
Now, when you know what a collection framework consists of, let's discuss what advantages does it
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:31,000 --> 00:05:32,000
|
| 307 |
+
have over race?
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:33,000 --> 00:05:36,000
|
| 311 |
+
Let's go over this table to compare collections and race.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:37,000 --> 00:05:41,000
|
| 315 |
+
This table will help you to understand what advantage collections have over race.
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:42,000 --> 00:05:48,000
|
| 319 |
+
First of all, you already know that our racing driver have fixed size collections in Java can be extended
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:48,000 --> 00:05:49,000
|
| 323 |
+
dynamically.
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:49,000 --> 00:05:54,000
|
| 327 |
+
So using collections, there is no need to create new collection and copy the state of the previous
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:54,000 --> 00:05:59,000
|
| 331 |
+
collection into the new one when you run out of space in this old collection.
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:05:59,000 --> 00:06:02,000
|
| 335 |
+
There's a significant benefit for the development process.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:06:03,000 --> 00:06:10,000
|
| 339 |
+
Secondly, our race itself does not have any behavior and algorithms to work with them, for example,
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:06:10,000 --> 00:06:18,000
|
| 343 |
+
a race can't filter themselves or find the first index of appearance of element or keep all elements
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:06:18,000 --> 00:06:25,000
|
| 347 |
+
sorted automatically or have only unique elements and do not add elements that already exist in collection
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:06:25,000 --> 00:06:26,000
|
| 351 |
+
and a lot of other things.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:06:27,000 --> 00:06:33,000
|
| 355 |
+
If you remember a race class, you may say that some of the algorithms are present in a race class to
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:06:33,000 --> 00:06:34,000
|
| 359 |
+
work with the race.
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:34,000 --> 00:06:40,000
|
| 363 |
+
But the amount of operations that you can do with our race class is significantly lower than a number
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:40,000 --> 00:06:43,000
|
| 367 |
+
of algorithms that Java collections framework has.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:43,000 --> 00:06:50,000
|
| 371 |
+
And moreover, we mentioned separate class and static methods in a race class that is not the same as
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:50,000 --> 00:06:53,000
|
| 375 |
+
behavior of the object like we have in collections.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:54,000 --> 00:07:00,000
|
| 379 |
+
Certainly collections have single API and no matter what is the specifics of each particular implementation
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:07:00,000 --> 00:07:06,000
|
| 383 |
+
of the collection, whether it's stauss only unique elements or supports region of elements during the
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:07:06,000 --> 00:07:08,000
|
| 387 |
+
constant amount of time, it doesn't matter.
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:07:09,000 --> 00:07:11,000
|
| 391 |
+
All collections have common API.
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:07:11,000 --> 00:07:15,000
|
| 395 |
+
What significantly simplifies usage of collections and running them.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:07:16,000 --> 00:07:21,000
|
| 399 |
+
On the other hand, working with arrays e.g. developer may implement his own application programming
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:07:21,000 --> 00:07:23,000
|
| 403 |
+
interface to interact with a rate.
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:07:23,000 --> 00:07:29,000
|
| 407 |
+
For example, the developer may come up with a method to add a new element in array and extend it in
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:07:29,000 --> 00:07:31,000
|
| 411 |
+
case there is no more Plaisance.
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:07:31,000 --> 00:07:35,000
|
| 415 |
+
Every developer may come up with a specific algorithm.
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:35,000 --> 00:07:37,000
|
| 419 |
+
How to clear all elements in array.
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:37,000 --> 00:07:42,000
|
| 423 |
+
One developer will just create a new array with the default array size and as a developer would just
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:42,000 --> 00:07:48,000
|
| 427 |
+
turn into new values or current elements in array and the already might use a problem and such approach.
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:48,000 --> 00:07:52,000
|
| 431 |
+
There is no single API when you are working with arrays.
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:53,000 --> 00:07:58,000
|
| 435 |
+
By having such data structures and algorithms as collections, developers may concentrate on the important
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:58,000 --> 00:08:03,000
|
| 439 |
+
parts of the program rather than on the low level work and inventions of your.
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:08:04,000 --> 00:08:10,000
|
| 443 |
+
Forcedly, what you need to remember, collections can store only reference types of data collections
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:08:10,000 --> 00:08:12,000
|
| 447 |
+
doesn't work with primitive types of data.
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:08:13,000 --> 00:08:17,000
|
| 451 |
+
If you want to store primitive types of data because of the performance reasons, you still have to
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:08:17,000 --> 00:08:18,000
|
| 455 |
+
use arrays.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:08:19,000 --> 00:08:21,000
|
| 459 |
+
And last but not the least performance.
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:08:22,000 --> 00:08:26,000
|
| 463 |
+
Usually it is considered the performance of arrays is higher than performance of collections.
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:08:27,000 --> 00:08:32,000
|
| 467 |
+
While this can be true in the modern world, in the most of business cases we are talking about milliseconds
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:08:32,000 --> 00:08:38,000
|
| 471 |
+
difference for standard operations and for standard number of elements in either collection or array.
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:08:38,000 --> 00:08:44,000
|
| 475 |
+
But you have to know about this and now you have the vision of what we are going to learn and what Java
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:08:44,000 --> 00:08:45,000
|
| 479 |
+
collections framework is.
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:46,000 --> 00:08:49,000
|
| 483 |
+
As you can see, there are really a lot of things to learn.
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:50,000 --> 00:08:52,000
|
| 487 |
+
Right now, let's recap what we have learned today.
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:53,000 --> 00:08:57,000
|
| 491 |
+
In this lesson, we learned what Java collections framework contains on the high level.
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:57,000 --> 00:09:03,000
|
| 495 |
+
We understand what collections are and how they are different from maps during the last very of the
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:09:03,000 --> 00:09:09,000
|
| 499 |
+
main advantages of collections of arrays and also discussed what advantages arrays have over collections.
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:09:10,000 --> 00:09:11,000
|
| 503 |
+
That's all for now.
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:09:12,000 --> 00:09:15,000
|
| 507 |
+
Thanks a lot for your attention and to you in the next lesson.
|
| 508 |
+
|
19 - Java Collections Framework/002 Collection Interface_en.srt
ADDED
|
@@ -0,0 +1,596 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1
|
| 2 |
+
00:00:06,000 --> 00:00:06,000
|
| 3 |
+
Hello.
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:06,000 --> 00:00:09,000
|
| 7 |
+
Students, in this lesson, we are going to learn what connections are.
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:10,000 --> 00:00:15,000
|
| 11 |
+
This is very important topic because connection interface is implemented by all connections implementations
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:15,000 --> 00:00:16,000
|
| 15 |
+
in Java.
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:16,000 --> 00:00:23,000
|
| 19 |
+
That's why understanding of collection interface is a key for understanding of all other collections
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:23,000 --> 00:00:23,000
|
| 23 |
+
in Java.
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:24,000 --> 00:00:28,000
|
| 27 |
+
So today our primary focus is learning of collection interface.
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:28,000 --> 00:00:35,000
|
| 31 |
+
I'm going to show you your middle class diagram, will understand what it is and how we can use it in
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:35,000 --> 00:00:36,000
|
| 35 |
+
the future.
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:36,000 --> 00:00:42,000
|
| 39 |
+
To understand a type structure during the lesson will understand what methods collection interface has
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:42,000 --> 00:00:43,000
|
| 43 |
+
and why do we need them.
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:44,000 --> 00:00:50,000
|
| 47 |
+
We will review abstract and default methods of collection interface and at the end of the lesson, we'll
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:50,000 --> 00:00:52,000
|
| 51 |
+
look at the collection source code.
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:00:52,000 --> 00:00:53,000
|
| 55 |
+
Let's start.
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:00:53,000 --> 00:00:59,000
|
| 59 |
+
I suggest that our lesson from this slide on this slide, you may see visualization of what the collection
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:00:59,000 --> 00:01:02,000
|
| 63 |
+
is to understand collection.
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:02,000 --> 00:01:07,000
|
| 67 |
+
Imagine the back, the big back where you may put all your stuff.
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:07,000 --> 00:01:15,000
|
| 71 |
+
You might put your product, user card and all other objects, and you can retrieve exactly user or
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:15,000 --> 00:01:19,000
|
| 75 |
+
product or cards by its index like you did in array.
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:20,000 --> 00:01:25,000
|
| 79 |
+
What you can do is to put all things from your back on the floor and go over them one by one.
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:26,000 --> 00:01:31,000
|
| 83 |
+
We're also going to learn in the separate lessons, the specific type that is developed to go over each
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:31,000 --> 00:01:32,000
|
| 87 |
+
element.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:32,000 --> 00:01:34,000
|
| 91 |
+
What else we can do with these?
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:34,000 --> 00:01:40,000
|
| 95 |
+
Back to answer this question, let's take a look at collection interface and we'll learn what else we
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:40,000 --> 00:01:42,000
|
| 99 |
+
can do with our bag of elements.
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:43,000 --> 00:01:49,000
|
| 103 |
+
Here is a class diagram we are going to learn with your UML language that is unified model and language
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:49,000 --> 00:01:50,000
|
| 107 |
+
in detail a bit later.
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:51,000 --> 00:01:54,000
|
| 111 |
+
But this is what is used to call class diagram.
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:01:54,000 --> 00:01:59,000
|
| 115 |
+
And while being a software engineer, you are going to see such diagrams very often.
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:02:00,000 --> 00:02:01,000
|
| 119 |
+
What do we have here?
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:01,000 --> 00:02:06,000
|
| 123 |
+
We can see that collection interface extends a terrible interface, a terrible interface.
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:06,000 --> 00:02:10,000
|
| 127 |
+
We are going to learn in a separate lesson, the same as Iterator.
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:10,000 --> 00:02:17,000
|
| 131 |
+
But in short, this is an interface that stands on top of all collections interfaces to make sure that
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:17,000 --> 00:02:23,000
|
| 135 |
+
it will be possible to iterate over each element in each implementation of collection interface.
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:24,000 --> 00:02:29,000
|
| 139 |
+
Today we are going to focus on collection interface and we will start learning it from this class diagram.
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:30,000 --> 00:02:32,000
|
| 143 |
+
Let me give you a quick introduction regarding symbols here.
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:33,000 --> 00:02:40,000
|
| 147 |
+
You can find indication whether this type interface or no, that is our interface text right above the
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:40,000 --> 00:02:41,000
|
| 151 |
+
interface name.
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:41,000 --> 00:02:46,000
|
| 155 |
+
We can see that it's Arabel and collections, both interfaces here.
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:46,000 --> 00:02:52,000
|
| 159 |
+
We can see list of methods that each specific type has, plus some means that this method is public.
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:53,000 --> 00:02:55,000
|
| 163 |
+
After that goes method signature.
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:02:55,000 --> 00:02:59,000
|
| 167 |
+
That is method, name and method parameters followed by colon.
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:02:59,000 --> 00:03:03,000
|
| 171 |
+
And we can find return type right after the column.
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:03:03,000 --> 00:03:09,000
|
| 175 |
+
For example, the first method in the list in collection interface is this method without parameters
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:09,000 --> 00:03:11,000
|
| 179 |
+
that returns in value.
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:11,000 --> 00:03:12,000
|
| 183 |
+
Does it make sense now?
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:13,000 --> 00:03:18,000
|
| 187 |
+
This knowledge will help you to understand class diagrams written down on human language.
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:19,000 --> 00:03:21,000
|
| 191 |
+
And let's answer our original question.
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:21,000 --> 00:03:23,000
|
| 195 |
+
What else we can do with this back?
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:24,000 --> 00:03:26,000
|
| 199 |
+
We can check a number of elements in it.
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:26,000 --> 00:03:28,000
|
| 203 |
+
That is what size method does.
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:28,000 --> 00:03:31,000
|
| 207 |
+
We can check if this bag is empty or no.
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:31,000 --> 00:03:34,000
|
| 211 |
+
We can check if this bag is empty or no.
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:34,000 --> 00:03:41,000
|
| 215 |
+
That's why when it is empty, we can ask our back elements, does it contain some specific element or
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:41,000 --> 00:03:45,000
|
| 219 |
+
no contains measures that will help us with this task.
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:45,000 --> 00:03:51,000
|
| 223 |
+
We have also matters that control collection of elements, interior objects and methods that can turn
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:03:51,000 --> 00:03:54,000
|
| 227 |
+
collection of elements into the array of specific types.
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:03:54,000 --> 00:04:00,000
|
| 231 |
+
For example, if your collection contains only elements of product type, we can convert our collection
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:04:00,000 --> 00:04:04,000
|
| 235 |
+
into of product elements, but not in the array of objects.
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:04:04,000 --> 00:04:07,000
|
| 239 |
+
If you don't want, can you feel the difference?
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:08,000 --> 00:04:08,000
|
| 243 |
+
After that?
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:08,000 --> 00:04:11,000
|
| 247 |
+
We can see methods that we already kind of discuss.
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:11,000 --> 00:04:12,000
|
| 251 |
+
Let us add methods.
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:13,000 --> 00:04:15,000
|
| 255 |
+
I can add elements to the collection.
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:15,000 --> 00:04:21,000
|
| 259 |
+
I can also remove elements from the collection and to remove elements from the collection, I have to
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:21,000 --> 00:04:23,000
|
| 263 |
+
pass this exact element.
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:24,000 --> 00:04:30,000
|
| 267 |
+
Another important behavior, we can check whether this collection contains all elements that other collection
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:30,000 --> 00:04:30,000
|
| 271 |
+
has.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:30,000 --> 00:04:32,000
|
| 275 |
+
That is our contains all method.
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:04:33,000 --> 00:04:36,000
|
| 279 |
+
We can add all elements from one collection to another.
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:04:36,000 --> 00:04:43,000
|
| 283 |
+
To do this, we have to use at all method and we can remove all elements from the current collections
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:04:43,000 --> 00:04:50,000
|
| 287 |
+
and other collection has that is our remove all method and believe you can see on the slide that message
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:04:50,000 --> 00:04:51,000
|
| 291 |
+
that we have just discussed.
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:04:51,000 --> 00:04:54,000
|
| 295 |
+
Take out the collection as my argument.
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:04:54,000 --> 00:04:58,000
|
| 299 |
+
If you want, you can keep only elements that are present in both collections.
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:04:58,000 --> 00:05:04,000
|
| 303 |
+
To do this, we have to invoke retain all methods and positive reference to another collection into
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:04,000 --> 00:05:04,000
|
| 307 |
+
it.
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:05,000 --> 00:05:11,000
|
| 311 |
+
In other words, this message removes from the current collection all elements that are not present
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:11,000 --> 00:05:17,000
|
| 315 |
+
in the collection that we passed as a method augment the methods that are left here are also describing
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:18,000 --> 00:05:23,000
|
| 319 |
+
claims method will remove all elements from the collection and as you already know, equals and harsh
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:23,000 --> 00:05:26,000
|
| 323 |
+
methods that are the methods that each object should have.
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:27,000 --> 00:05:33,000
|
| 327 |
+
But the idea of specifying equals and Haskett methods in the collection interface is to put stress on
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:33,000 --> 00:05:39,000
|
| 331 |
+
the fact that these methods should be implemented in an implementation of collection interface and that
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:05:39,000 --> 00:05:43,000
|
| 335 |
+
these methods should override default behavior from object class.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:05:43,000 --> 00:05:48,000
|
| 339 |
+
And the last but not the least, massive collection interface is an iterator.
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:05:48,000 --> 00:05:51,000
|
| 343 |
+
Pay attention to the iterable interface description now.
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:05:52,000 --> 00:05:57,000
|
| 347 |
+
It is also the collection interface because it implements a terrible interface.
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:05:57,000 --> 00:06:03,000
|
| 351 |
+
As you can see, Iterator method returns object of iterator type insert.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:06:03,000 --> 00:06:07,000
|
| 355 |
+
This object will help you to iterate over each element in your collection.
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:06:07,000 --> 00:06:13,000
|
| 359 |
+
We are going to learn what Iterator is in the separate class and that is how our collection interface
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:13,000 --> 00:06:14,000
|
| 363 |
+
that is something.
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:14,000 --> 00:06:15,000
|
| 367 |
+
What do you have to remember?
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:16,000 --> 00:06:21,000
|
| 371 |
+
We just have such interface and what we can do is just to remember it just as an alphabet.
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:21,000 --> 00:06:26,000
|
| 375 |
+
We don't ask why a letter is written exactly in this way.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:26,000 --> 00:06:30,000
|
| 379 |
+
We just learned that this is a letter and how it sounds.
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:30,000 --> 00:06:36,000
|
| 383 |
+
And when we know that we start building words with this letter, the same as here, we just have to
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:06:36,000 --> 00:06:38,000
|
| 387 |
+
learn collection, interface and learn how to use it.
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:06:39,000 --> 00:06:45,000
|
| 391 |
+
So here on the screen, you may see only abstract methods that should be implemented in each collection,
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:06:45,000 --> 00:06:49,000
|
| 395 |
+
but there are a few more other default methods in the collection interface.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:06:49,000 --> 00:06:55,000
|
| 399 |
+
What are they to answer this question and to give you otherwise how constantly learn new things and
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:06:55,000 --> 00:07:00,000
|
| 403 |
+
check information that you get not only on this lesson but in any tutorial?
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:07:00,000 --> 00:07:03,000
|
| 407 |
+
Always investigate the source code of your conversion.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:07:04,000 --> 00:07:09,000
|
| 411 |
+
I believe you remember how to add source code, your code editor and where you might find it.
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:07:09,000 --> 00:07:14,000
|
| 415 |
+
Let's open collection type to investigate the source code and find methods that we didn't learn yet.
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:15,000 --> 00:07:20,000
|
| 419 |
+
I press control shift and simultaneously I have to type collection.
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:21,000 --> 00:07:27,000
|
| 423 |
+
I need collection from Java with your package and here this and here on the right, we might see a list
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:27,000 --> 00:07:30,000
|
| 427 |
+
of all methods that are present in this interface.
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:30,000 --> 00:07:34,000
|
| 431 |
+
It looks like we went over all abstract methods.
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:34,000 --> 00:07:40,000
|
| 435 |
+
How I learned which method is abstract and it's is a small a letter that stands for abstract.
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:41,000 --> 00:07:45,000
|
| 439 |
+
But we didn't cover in our presentation methods that have Glitnir.
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:07:45,000 --> 00:07:46,000
|
| 443 |
+
What are they?
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:07:47,000 --> 00:07:50,000
|
| 447 |
+
Here's the overloaded method to array it.
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:07:50,000 --> 00:07:57,000
|
| 451 |
+
Just take specific functions that will describe how to convert collection to a right to be able to apply
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:07:57,000 --> 00:07:57,000
|
| 455 |
+
this method.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:07:57,000 --> 00:08:03,000
|
| 459 |
+
We have to know how to write in the functional style in Java and understand what functional interface
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:08:03,000 --> 00:08:03,000
|
| 463 |
+
is.
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:08:04,000 --> 00:08:05,000
|
| 467 |
+
Don't worry.
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:08:05,000 --> 00:08:08,000
|
| 471 |
+
This topic also will be discussed in the separate lesson.
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:08:08,000 --> 00:08:13,000
|
| 475 |
+
I just want you to understand, at least on the high level, what these default methods are about.
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:08:13,000 --> 00:08:21,000
|
| 479 |
+
Remove method, this method takes predicate, predicate is a specific type that can return true or false
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:22,000 --> 00:08:26,000
|
| 483 |
+
based on the specific function that you will pass as a method argument to this method.
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:26,000 --> 00:08:29,000
|
| 487 |
+
It will identify which element should be removed.
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:29,000 --> 00:08:32,000
|
| 491 |
+
For example, you may describe functions that will return.
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:32,000 --> 00:08:38,000
|
| 495 |
+
True in a case product price is more than one hundred dollars, and in case this function will be applied
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:08:38,000 --> 00:08:44,000
|
| 499 |
+
to this specific product and collection, it will be removed and this function will be applied to each
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:08:44,000 --> 00:08:50,000
|
| 503 |
+
element in the collection you might find while loop here and see that Iterator is used to go over the
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:08:50,000 --> 00:08:56,000
|
| 507 |
+
collection as a condition for each element in the collection and remove it in case it satisfies the
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:08:56,000 --> 00:08:57,000
|
| 511 |
+
condition.
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:08:57,000 --> 00:09:01,000
|
| 515 |
+
Also, there is a default method that creates iterator.
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:09:01,000 --> 00:09:07,000
|
| 519 |
+
Split Iterator is a specific type that can traverse and make parts of elements of the source collection.
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:09:08,000 --> 00:09:11,000
|
| 523 |
+
And here is a method that exists in all implementations of collection.
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:09:11,000 --> 00:09:18,000
|
| 527 |
+
Interface Stream Method joins the collection into stream of elements or in other words, sequential
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:09:18,000 --> 00:09:19,000
|
| 531 |
+
stream of elements.
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:09:20,000 --> 00:09:26,000
|
| 535 |
+
String Mapei was introduced in Java version eight and it was a breakthrough in this course in separate
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:09:26,000 --> 00:09:31,000
|
| 539 |
+
lesson will be on stream API and we'll learn how to use it as a practical exercise.
|
| 540 |
+
|
| 541 |
+
136
|
| 542 |
+
00:09:31,000 --> 00:09:35,000
|
| 543 |
+
Will even rewrite our home tasks with the help of the Stream API.
|
| 544 |
+
|
| 545 |
+
137
|
| 546 |
+
00:09:36,000 --> 00:09:38,000
|
| 547 |
+
And here is a massive, transparent stream.
|
| 548 |
+
|
| 549 |
+
138
|
| 550 |
+
00:09:39,000 --> 00:09:44,000
|
| 551 |
+
According to documentation, it returns possible parallel stream with the current collection at its
|
| 552 |
+
|
| 553 |
+
139
|
| 554 |
+
00:09:44,000 --> 00:09:44,000
|
| 555 |
+
source.
|
| 556 |
+
|
| 557 |
+
140
|
| 558 |
+
00:09:46,000 --> 00:09:51,000
|
| 559 |
+
Now, let's recap what we have learned today, so they've learned what the connection is, we try to
|
| 560 |
+
|
| 561 |
+
141
|
| 562 |
+
00:09:51,000 --> 00:09:54,000
|
| 563 |
+
imagine collection is a back for our understanding.
|
| 564 |
+
|
| 565 |
+
142
|
| 566 |
+
00:09:55,000 --> 00:09:59,000
|
| 567 |
+
The day you saw your first UML diagram, class diagram.
|
| 568 |
+
|
| 569 |
+
143
|
| 570 |
+
00:09:59,000 --> 00:10:05,000
|
| 571 |
+
Now you know how to read class diagrams to understand the type of description we reviewed all abstract
|
| 572 |
+
|
| 573 |
+
144
|
| 574 |
+
00:10:05,000 --> 00:10:07,000
|
| 575 |
+
methods in collection interface.
|
| 576 |
+
|
| 577 |
+
145
|
| 578 |
+
00:10:07,000 --> 00:10:10,000
|
| 579 |
+
And after that, we reviewed the collection before methods.
|
| 580 |
+
|
| 581 |
+
146
|
| 582 |
+
00:10:10,000 --> 00:10:14,000
|
| 583 |
+
Also during the lesson we investigated source code of collection interface.
|
| 584 |
+
|
| 585 |
+
147
|
| 586 |
+
00:10:15,000 --> 00:10:17,000
|
| 587 |
+
That's all what I have for you for today.
|
| 588 |
+
|
| 589 |
+
148
|
| 590 |
+
00:10:17,000 --> 00:10:18,000
|
| 591 |
+
Thanks a lot for your attention.
|
| 592 |
+
|
| 593 |
+
149
|
| 594 |
+
00:10:18,000 --> 00:10:20,000
|
| 595 |
+
See you in the next lesson.
|
| 596 |
+
|
19 - Java Collections Framework/003 Interfaces List, Set and Queue Overview_en.srt
ADDED
|
@@ -0,0 +1,472 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1
|
| 2 |
+
00:00:06,000 --> 00:00:06,000
|
| 3 |
+
Hello, Jim.
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:06,000 --> 00:00:12,000
|
| 7 |
+
In this lesson, I'll go to understand the main descendants of collection interface before going deep,
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:12,000 --> 00:00:18,000
|
| 11 |
+
I believe it is very important to understand the big picture and learn three main interfaces in collections.
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:18,000 --> 00:00:23,000
|
| 15 |
+
Iraqi today will hold a high level overview of such interfaces likely set.
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:23,000 --> 00:00:29,000
|
| 19 |
+
And Q According to our agenda, we are going to start from the overview of the class diagram of collection
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:29,000 --> 00:00:32,000
|
| 23 |
+
interface with its main descendants.
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:32,000 --> 00:00:37,000
|
| 27 |
+
After that, I'm going to explain in simple words what a key difference is between three interfaces
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:37,000 --> 00:00:38,000
|
| 31 |
+
and why we need them.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:39,000 --> 00:00:44,000
|
| 35 |
+
I will explain you what list is said and Q You use the explanation of the cube.
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:44,000 --> 00:00:48,000
|
| 39 |
+
We are going to learn what f i f o principle is.
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:48,000 --> 00:00:54,000
|
| 43 |
+
This lesson will help you to understand the first structure of our lessons and understand the core hierarchy
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:54,000 --> 00:00:55,000
|
| 47 |
+
of collections.
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:55,000 --> 00:00:58,000
|
| 51 |
+
Let's start here is our class diagram.
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:00:59,000 --> 00:01:02,000
|
| 55 |
+
This one is the extended version of the one you saw in the previous lesson.
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:01:03,000 --> 00:01:06,000
|
| 59 |
+
I believe you are already familiar with the collection interface.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:01:06,000 --> 00:01:12,000
|
| 63 |
+
Now let's look at the most popular child interfaces of collection interface that we are going to learn.
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:12,000 --> 00:01:18,000
|
| 67 |
+
There are three interfaces that extends collection interface and that implemented by all the collection
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:18,000 --> 00:01:25,000
|
| 71 |
+
implementations in GDP, Zaya least set and Q They're all collections.
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:25,000 --> 00:01:32,000
|
| 75 |
+
But each interface is introduced in behavior on the quality of implementation of collection interface
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:32,000 --> 00:01:33,000
|
| 79 |
+
by extending it.
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:33,000 --> 00:01:35,000
|
| 83 |
+
Why do we need this interfaces?
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:36,000 --> 00:01:38,000
|
| 87 |
+
Let me briefly go over each one.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:39,000 --> 00:01:40,000
|
| 91 |
+
Let's start from the least interface.
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:41,000 --> 00:01:45,000
|
| 95 |
+
You already know that collection is just a back where you can put all your elements.
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:46,000 --> 00:01:47,000
|
| 99 |
+
The list interface.
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:47,000 --> 00:01:52,000
|
| 103 |
+
Introduce an ordered collection with the possibility to manage your elements by the index.
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:53,000 --> 00:01:56,000
|
| 107 |
+
In the more simple words list is an order.
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:56,000 --> 00:01:58,000
|
| 111 |
+
A collection of elements was all benefit.
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:01:58,000 --> 00:02:00,000
|
| 115 |
+
That follows from that statement.
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:02:01,000 --> 00:02:04,000
|
| 119 |
+
We can add element to the specific index and the collection.
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:04,000 --> 00:02:11,000
|
| 123 |
+
We can get element by its index and we can replace existing element as a specific position to set the
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:11,000 --> 00:02:14,000
|
| 127 |
+
new element in the specific position we have to use, said Mass.
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:15,000 --> 00:02:17,000
|
| 131 |
+
With a specific index and element.
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:18,000 --> 00:02:22,000
|
| 135 |
+
If we want, we can remove the element from the specific position in our list.
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:22,000 --> 00:02:28,000
|
| 139 |
+
We can get the index of the first occurrence of the element in the specific collection and index of
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:28,000 --> 00:02:32,000
|
| 143 |
+
the last occurrence of the specific element to perform these tasks.
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:32,000 --> 00:02:41,000
|
| 147 |
+
Mass index of and last index should help us at least also allows us to get list iterator list iterator
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:41,000 --> 00:02:46,000
|
| 151 |
+
that this extended version of the regular iterator in the separate class in about iterators.
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:46,000 --> 00:02:47,000
|
| 155 |
+
And we'll explain the difference.
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:48,000 --> 00:02:54,000
|
| 159 |
+
Sometimes we may want to create some lists, for example, to process back amount of data.
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:54,000 --> 00:03:00,000
|
| 163 |
+
We may split our list into four equal chunks and perform any operations we need in four separate sets
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:03:00,000 --> 00:03:01,000
|
| 167 |
+
of execution.
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:03:02,000 --> 00:03:07,000
|
| 171 |
+
I believe you are aware that Java supports MultiThreaded and a bit later in the course, I'm also going
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:03:07,000 --> 00:03:08,000
|
| 175 |
+
to teach you that.
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:09,000 --> 00:03:14,000
|
| 179 |
+
Besides new absurd methods that were introduced, there are also to default matters that are absent
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:14,000 --> 00:03:17,000
|
| 183 |
+
in connection interface and that are present in the list interface.
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:18,000 --> 00:03:20,000
|
| 187 |
+
Zaya, replace all MassArt.
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:20,000 --> 00:03:26,000
|
| 191 |
+
This method will take a function that can transform an element of one type to the element of the same
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:26,000 --> 00:03:26,000
|
| 195 |
+
type.
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:27,000 --> 00:03:32,000
|
| 199 |
+
We may want to use this method when we want, for example, transform all string objects in the list
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:32,000 --> 00:03:35,000
|
| 203 |
+
to the string objects in the lowercase.
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:36,000 --> 00:03:42,000
|
| 207 |
+
Sort method allows us to set the algorithm and to tell exactly how we want to certain elements in the
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:42,000 --> 00:03:47,000
|
| 211 |
+
list, a bit later we're going to run such a functional interface as comparator.
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:48,000 --> 00:03:50,000
|
| 215 |
+
Now, let's proceed with the collections Iraqi.
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:50,000 --> 00:03:52,000
|
| 219 |
+
Let's talk about set interface.
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:53,000 --> 00:03:54,000
|
| 223 |
+
What do you think?
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:03:54,000 --> 00:03:59,000
|
| 227 |
+
What new methods are introduced in the set interface in comparison with collection interface?
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:04:00,000 --> 00:04:04,000
|
| 231 |
+
No one is a set interface, doesn't introduce new methods.
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:04:05,000 --> 00:04:06,000
|
| 235 |
+
Then why do we need it at all?
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:04:07,000 --> 00:04:10,000
|
| 239 |
+
Let's recall what a set is from the mathematics.
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:10,000 --> 00:04:13,000
|
| 243 |
+
The set is a well defined collection of discrete.
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:14,000 --> 00:04:17,000
|
| 247 |
+
The set is a well defined collection of distinct objects.
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:18,000 --> 00:04:22,000
|
| 251 |
+
The set interface is a main interface for the Iraqi of containers.
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:22,000 --> 00:04:25,000
|
| 255 |
+
By the way, collections are often called containers.
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:26,000 --> 00:04:33,000
|
| 259 |
+
So set is the main interface for the hierarchy of containers that contains only unique elements that
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:33,000 --> 00:04:40,000
|
| 263 |
+
different implementations of the set interface during the development of JDK engineers come up with
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:40,000 --> 00:04:45,000
|
| 267 |
+
the decisions that they need to distinguish a collection of elements and the set of elements.
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:45,000 --> 00:04:49,000
|
| 271 |
+
Somehow the best decision was to introduce new interface.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:49,000 --> 00:04:51,000
|
| 275 |
+
So you're of development.
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:04:51,000 --> 00:04:57,000
|
| 279 |
+
Engineers may declare variable of type set that would give us new methods to manipulate with elements
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:04:57,000 --> 00:04:58,000
|
| 283 |
+
in the container.
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:04:59,000 --> 00:05:04,000
|
| 287 |
+
But this instantly will give us the vision that this container contains only unique elements.
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:05:05,000 --> 00:05:10,000
|
| 291 |
+
To understand how implementations of the set interface work, we need to learn map interfaces first.
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:05:11,000 --> 00:05:13,000
|
| 295 |
+
We are going to understand later why.
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:05:14,000 --> 00:05:18,000
|
| 299 |
+
And now let's review one more interface Hirschi interface.
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:18,000 --> 00:05:22,000
|
| 303 |
+
There are a few new abstract methods were introduced here to manage the queue.
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:23,000 --> 00:05:31,000
|
| 307 |
+
They are offer to insert an element into the queue, remove this method to retrieve and remove the head
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:31,000 --> 00:05:32,000
|
| 311 |
+
of the queue.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:32,000 --> 00:05:36,000
|
| 315 |
+
But in case there is an empty queue, the method throws exception.
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:36,000 --> 00:05:37,000
|
| 319 |
+
What is an exception?
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:38,000 --> 00:05:43,000
|
| 323 |
+
And a bit later we are going to learn how Java programs may handle exceptional situations of program
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:43,000 --> 00:05:44,000
|
| 327 |
+
execution.
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:44,000 --> 00:05:50,000
|
| 331 |
+
Right now you can understand exception like something what is not an expected way of program execution
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:05:50,000 --> 00:05:56,000
|
| 335 |
+
and what may potentially interrupt the program in case there is no code written that handles the exception
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:05:57,000 --> 00:06:03,000
|
| 339 |
+
for this method also retrieves and removes the head of the queue the same as remove method, but with
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:06:03,000 --> 00:06:09,000
|
| 343 |
+
only one difference in case queue is empty, there is no exception, no value is returned instead.
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:06:10,000 --> 00:06:17,000
|
| 347 |
+
Element this MassArt retrieves but doesn't remove elements from the Q the same as remove method, it
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:06:17,000 --> 00:06:19,000
|
| 351 |
+
throws exception in the case.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:06:19,000 --> 00:06:19,000
|
| 355 |
+
Q is empty.
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:06:20,000 --> 00:06:27,000
|
| 359 |
+
Take Macit also retrieved but doesn't remove elements from the cube, with only one exception, that
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:27,000 --> 00:06:30,000
|
| 363 |
+
in case there is an empty cube, no value is returned.
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:31,000 --> 00:06:36,000
|
| 367 |
+
That's all new methods that were introduced in Q interface, no other default methods were introduced,
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:37,000 --> 00:06:44,000
|
| 371 |
+
cues needed when you need to implement first in, first out principle, so-called f i f o principle,
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:45,000 --> 00:06:51,000
|
| 375 |
+
imagine that you process support requests and you need to process them in the specific priority.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:51,000 --> 00:06:57,000
|
| 379 |
+
And according to the date, when you receive them the support you get that you received the earliest.
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:58,000 --> 00:06:58,000
|
| 383 |
+
Exactly.
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:06:58,000 --> 00:07:01,000
|
| 387 |
+
These tickets should be processed first.
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:07:02,000 --> 00:07:04,000
|
| 391 |
+
And here you can understand what the queue is.
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:07:05,000 --> 00:07:11,000
|
| 395 |
+
The first support that was received by Q The first left in the queue.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:07:11,000 --> 00:07:12,000
|
| 399 |
+
I feel really prepared.
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:07:12,000 --> 00:07:18,000
|
| 403 |
+
Super interesting home task for you to improve our online store and to practice your skills in writing
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:07:18,000 --> 00:07:20,000
|
| 407 |
+
use, but that will be later.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:07:21,000 --> 00:07:27,000
|
| 411 |
+
So right now I believe you understood the three main sub Iraqis that goes right after collection interface.
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:07:27,000 --> 00:07:33,000
|
| 415 |
+
And also the structure of the next lesson should be clearer for you now during the next lesson.
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:33,000 --> 00:07:39,000
|
| 419 |
+
So we are going to learn each interface in detail with all methods and to learn the most popular implementation
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:39,000 --> 00:07:40,000
|
| 423 |
+
of each interface.
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:41,000 --> 00:07:44,000
|
| 427 |
+
I want you to understand, Siiri, first before we start calling.
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:44,000 --> 00:07:46,000
|
| 431 |
+
Believe me, this is very important.
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:47,000 --> 00:07:51,000
|
| 435 |
+
But very soon you would beg me to stop quoting examples, I promise you.
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:52,000 --> 00:07:54,000
|
| 439 |
+
Now, let's review what we have learned today.
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:07:55,000 --> 00:07:58,000
|
| 443 |
+
Today we have learned what has remained descendants of collection interface.
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:07:59,000 --> 00:08:03,000
|
| 447 |
+
Now you know why we need at least set new interfaces.
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:08:03,000 --> 00:08:09,000
|
| 451 |
+
Moreover, after this lesson, you may understand the difference between them while explaining what
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:08:09,000 --> 00:08:09,000
|
| 455 |
+
A is.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:08:09,000 --> 00:08:12,000
|
| 459 |
+
We learned f o principle.
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:08:12,000 --> 00:08:14,000
|
| 463 |
+
Now you are ready for the next lesson.
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:08:15,000 --> 00:08:16,000
|
| 467 |
+
Thanks a lot for your attention.
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:08:16,000 --> 00:08:18,000
|
| 471 |
+
See you in the next lesson.
|
| 472 |
+
|
19 - Java Collections Framework/004 List implementations - ArrayList, Vector, CopyOnWriteArrayList & Stack_en.srt
ADDED
|
@@ -0,0 +1,1152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
| 1 |
+
1
|
| 2 |
+
00:00:06,000 --> 00:00:06,000
|
| 3 |
+
Hello.
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:06,000 --> 00:00:11,000
|
| 7 |
+
Yes, students, today we are going to talk about implementations of the list interface, we are going
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:11,000 --> 00:00:17,000
|
| 11 |
+
to discuss such implementations as our list vector question right away, list and stack.
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:17,000 --> 00:00:23,000
|
| 15 |
+
You have a lot of things to learn in this lesson besides the learning of the specific classes.
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:23,000 --> 00:00:28,000
|
| 19 |
+
We are going to answer the question when you have to use each particular implementation of list interface.
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:28,000 --> 00:00:34,000
|
| 23 |
+
I'm going to share with you real life examples where we will use list implementations today during the
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:34,000 --> 00:00:39,000
|
| 27 |
+
lesson I'm going to show you is a tool that will allow you to investigate the interaction of classes
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:39,000 --> 00:00:40,000
|
| 31 |
+
in the clips.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:40,000 --> 00:00:45,000
|
| 35 |
+
During the lesson, we are going to compare different implementations of the list interface so that
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:45,000 --> 00:00:50,000
|
| 39 |
+
you could understand what pros and cons of each implementations are in this lesson.
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:50,000 --> 00:00:56,000
|
| 43 |
+
We are going to compare on the array vector Copan right away and Stack also.
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:56,000 --> 00:01:01,000
|
| 47 |
+
We're going to learn what mocker interfaces are and what is random access interface.
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:01:01,000 --> 00:01:04,000
|
| 51 |
+
So as you can see, we have a huge agenda for today.
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:01:05,000 --> 00:01:07,000
|
| 55 |
+
Let's don't waste our time and start our lesson.
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:01:08,000 --> 00:01:09,000
|
| 59 |
+
Brunious lessons.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:01:09,000 --> 00:01:14,000
|
| 63 |
+
You already learned what list is, but let's try to answer the question when we have to use list.
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:15,000 --> 00:01:20,000
|
| 67 |
+
In my opinion, list implementations can cover the requirements of the widest range of business cases.
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:21,000 --> 00:01:21,000
|
| 71 |
+
Why?
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:22,000 --> 00:01:23,000
|
| 75 |
+
Because of the next reasons.
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:24,000 --> 00:01:26,000
|
| 79 |
+
Support of data manipulation by Elements Index.
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:27,000 --> 00:01:33,000
|
| 83 |
+
You may want to retrieve product from specific index in your list of products, or you may want to put
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:33,000 --> 00:01:36,000
|
| 87 |
+
user in the list of users in the middle of the list by its index.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:37,000 --> 00:01:42,000
|
| 91 |
+
Or probably you always want to add the new user since the beginning of the list, but not at the end.
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:42,000 --> 00:01:48,000
|
| 95 |
+
The possibility to use index to manage element positions gives you a lot of options for data manipulations
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:48,000 --> 00:01:50,000
|
| 99 |
+
that will help you in different business cases.
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:51,000 --> 00:01:55,000
|
| 103 |
+
And another reason list implementations may contain duplicates.
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:55,000 --> 00:02:01,000
|
| 107 |
+
Sometimes you just need to have container that will store all your products, for example, and you
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:02:01,000 --> 00:02:03,000
|
| 111 |
+
don't care about duplicate there.
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:02:03,000 --> 00:02:07,000
|
| 115 |
+
You just need to have a list of all products here.
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:02:08,000 --> 00:02:14,000
|
| 119 |
+
That's why, which is at least overset sometimes one more reason usability to create subleased.
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:14,000 --> 00:02:16,000
|
| 123 |
+
This feature is really attractive.
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:16,000 --> 00:02:18,000
|
| 127 |
+
One for some specific business cases.
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:18,000 --> 00:02:21,000
|
| 131 |
+
Let me share with you one example from the real life.
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:21,000 --> 00:02:25,000
|
| 135 |
+
We implemented mobile app for the betting tips in this app.
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:25,000 --> 00:02:27,000
|
| 139 |
+
We received data from the server.
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:27,000 --> 00:02:29,000
|
| 143 |
+
We store the data in the list.
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:30,000 --> 00:02:33,000
|
| 147 |
+
There was such the main type asport prediction data.
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:33,000 --> 00:02:39,000
|
| 151 |
+
eSport prediction was done for the specific sports event that may happen either today or yesterday or
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:39,000 --> 00:02:40,000
|
| 155 |
+
tomorrow.
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:40,000 --> 00:02:46,000
|
| 159 |
+
So developers created sub lists of the sport prediction for yesterday, today and tomorrow.
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:46,000 --> 00:02:50,000
|
| 163 |
+
We created three lists instead of one by splitting the original one.
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:02:51,000 --> 00:02:57,000
|
| 167 |
+
Why we could pass the one list to each widget to draw the list on the UI interface only for specific
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:02:57,000 --> 00:02:58,000
|
| 171 |
+
date.
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:02:58,000 --> 00:03:00,000
|
| 175 |
+
That's it, by the way.
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:00,000 --> 00:03:03,000
|
| 179 |
+
Here is the UI of the sports app, Anderson.
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:04,000 --> 00:03:07,000
|
| 183 |
+
You will be able to create similar apps, so don't worry.
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:07,000 --> 00:03:12,000
|
| 187 |
+
To implement such application, you have to know implementations of the list interface.
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:12,000 --> 00:03:15,000
|
| 191 |
+
Let's move further certain.
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:15,000 --> 00:03:19,000
|
| 195 |
+
And again, one more features a collection interface doesn't have.
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:19,000 --> 00:03:25,000
|
| 199 |
+
We may sort our button Tepes based on the level of probability that really improves interaction with
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:25,000 --> 00:03:26,000
|
| 203 |
+
the app.
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:26,000 --> 00:03:29,000
|
| 207 |
+
Moreover, I can offer user to source support.
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:29,000 --> 00:03:37,000
|
| 211 |
+
Prediction is a high probability score or by keep also rating or by anything else, wide range of use.
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:37,000 --> 00:03:43,000
|
| 215 |
+
And one more important reason to opt for these implementations, and this reason probably is the most
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:43,000 --> 00:03:46,000
|
| 219 |
+
important one that is not written in any book that you read.
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:46,000 --> 00:03:52,000
|
| 223 |
+
Engineers use list implementations and most of the times because they just don't use a set.
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:03:52,000 --> 00:03:59,000
|
| 227 |
+
Documentation's developers just need some container to store multiple elements in there and treat them
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:03:59,000 --> 00:04:02,000
|
| 231 |
+
as a single unit without any extra features.
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:04:02,000 --> 00:04:07,000
|
| 235 |
+
OK, now we want to know when and why we opt for liste implementations.
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:04:07,000 --> 00:04:13,000
|
| 239 |
+
Let's investigate list Iraqi on this slide you may use at least the interface is implemented by absoluteness
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:13,000 --> 00:04:14,000
|
| 243 |
+
class.
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:14,000 --> 00:04:15,000
|
| 247 |
+
Absolutely.
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:15,000 --> 00:04:20,000
|
| 251 |
+
Tintern extends APSA collection and is extended by Absol sequential sequentially.
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:21,000 --> 00:04:27,000
|
| 255 |
+
From this diagram you may see that our own list is extended directly from the absolute list, the same
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:27,000 --> 00:04:33,000
|
| 259 |
+
as vector and copy and write and released and linked list is extended from absolute sequential list
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:33,000 --> 00:04:37,000
|
| 263 |
+
stack class extends vector engineers.
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:37,000 --> 00:04:41,000
|
| 267 |
+
Doesn't like Stack for that because that is not the least by its essence.
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:42,000 --> 00:04:43,000
|
| 271 |
+
It is closer to the reverse.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:43,000 --> 00:04:45,000
|
| 275 |
+
CU does a deck interface.
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:04:46,000 --> 00:04:52,000
|
| 279 |
+
We're going to run it later, but because of the backward compatibility creator subject didn't change
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:04:52,000 --> 00:04:53,000
|
| 283 |
+
anything here.
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:04:54,000 --> 00:04:54,000
|
| 287 |
+
Is it clear?
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:04:55,000 --> 00:05:02,000
|
| 291 |
+
Because Stack in its essence implement last in, first out principle, but it extends least interface,
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:05:02,000 --> 00:05:02,000
|
| 295 |
+
but not that.
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:05:03,000 --> 00:05:09,000
|
| 299 |
+
Even despite this, glass will not be used very often by a during the development, you might be asked
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:09,000 --> 00:05:11,000
|
| 303 |
+
about it during the interview.
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:11,000 --> 00:05:13,000
|
| 307 |
+
That's why I decided to mention it here.
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:14,000 --> 00:05:19,000
|
| 311 |
+
What is also worth to mention is the implementation of random access interface.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:19,000 --> 00:05:25,000
|
| 315 |
+
Today during the demo, I'm going to show you what random access interface is and what mocker interfaces
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:25,000 --> 00:05:31,000
|
| 319 |
+
are to protect our lesson today as I just jump into the eclipse to investigate the source code that
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:31,000 --> 00:05:35,000
|
| 323 |
+
will help us to learn the topic better understand them.
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:35,000 --> 00:05:39,000
|
| 327 |
+
I'd like to share with you the trick that will also help you in the future during the development.
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:39,000 --> 00:05:45,000
|
| 331 |
+
Namely, I'd like to show you how you can easily find implementations of each interface and reviews
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:05:45,000 --> 00:05:48,000
|
| 335 |
+
a whole Iraqian, for example.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:05:48,000 --> 00:05:50,000
|
| 339 |
+
Here is a list interface.
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:05:50,000 --> 00:05:54,000
|
| 343 |
+
I should put the cursor into the editor error and press efore button.
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:05:55,000 --> 00:05:57,000
|
| 347 |
+
Or you can also make mouse right.
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:05:57,000 --> 00:06:02,000
|
| 351 |
+
Click and select open type Iraqi here and we can see that the separate widget is open.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:06:02,000 --> 00:06:07,000
|
| 355 |
+
Here, here I see items that extends or implements the interface.
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:06:07,000 --> 00:06:09,000
|
| 359 |
+
For example, here's our list.
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:10,000 --> 00:06:16,000
|
| 363 |
+
We can make a left mouse click to open it and here we may find our array list.
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:16,000 --> 00:06:20,000
|
| 367 |
+
As you can see, there are really a lot of classes over here will not run.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:20,000 --> 00:06:25,000
|
| 371 |
+
Each of them instead will focus only on those that you will use during your work.
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:26,000 --> 00:06:32,000
|
| 375 |
+
Let's start from the most popular implementation of this interface that you will use in 98 percent of
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:32,000 --> 00:06:32,000
|
| 379 |
+
cases.
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:33,000 --> 00:06:34,000
|
| 383 |
+
That is just my assumption.
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:06:34,000 --> 00:06:42,000
|
| 387 |
+
But you will tell me that if I was right, here's a release class when people are released because it's
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:06:42,000 --> 00:06:47,000
|
| 391 |
+
really fast and most simple words released is array with dynamic size.
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:06:48,000 --> 00:06:50,000
|
| 395 |
+
But this is in very, very simple words.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:06:51,000 --> 00:06:55,000
|
| 399 |
+
I only use regular arrays inside to store elements here.
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:06:55,000 --> 00:07:00,000
|
| 403 |
+
This is a variable is called element data in my store array of objects.
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:07:00,000 --> 00:07:07,000
|
| 407 |
+
That means that technically we can put everything in this array, but we can't because this field has
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:07:07,000 --> 00:07:09,000
|
| 411 |
+
packaged private modifier.
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:07:09,000 --> 00:07:15,000
|
| 415 |
+
OK, then you might be wondering if I only use this regular array to store elements, then it should
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:15,000 --> 00:07:18,000
|
| 419 |
+
have fixed size, is that correct?
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:18,000 --> 00:07:19,000
|
| 423 |
+
That is correct.
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:20,000 --> 00:07:23,000
|
| 427 |
+
Arrays in Java have fixed size, but not the array.
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:23,000 --> 00:07:27,000
|
| 431 |
+
Least let me show is a code that adds element to the collection.
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:28,000 --> 00:07:33,000
|
| 435 |
+
Here is an element method in today's modification count variable first.
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:33,000 --> 00:07:35,000
|
| 439 |
+
Don't pay attention to that right now.
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:07:35,000 --> 00:07:38,000
|
| 443 |
+
After that it calls another add method.
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:07:38,000 --> 00:07:41,000
|
| 447 |
+
I hold control key and press mouse left click.
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:07:41,000 --> 00:07:50,000
|
| 451 |
+
OK, here is a private matter and you see the first line we have if statement here we check if s equals
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:07:50,000 --> 00:07:55,000
|
| 455 |
+
to the length of the array, then we initialize our element data array with the new array.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:07:56,000 --> 00:08:00,000
|
| 459 |
+
Before we go further, let's look what this s variable is.
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:08:00,000 --> 00:08:06,000
|
| 463 |
+
I hold all key and press our left key to move back to the previous position where I was.
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:08:06,000 --> 00:08:13,000
|
| 467 |
+
And we see that the argument in this method is a size variable size is also one of the fields in a release
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:08:13,000 --> 00:08:14,000
|
| 471 |
+
class.
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:08:14,000 --> 00:08:15,000
|
| 475 |
+
Now let's get back.
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:08:16,000 --> 00:08:22,000
|
| 479 |
+
I keep all key press and also press arrow right key to get back to the place in the source code where
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:22,000 --> 00:08:23,000
|
| 483 |
+
I was before.
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:23,000 --> 00:08:26,000
|
| 487 |
+
Now, you know, that s is a size.
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:27,000 --> 00:08:28,000
|
| 491 |
+
What does Groom method do?
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:29,000 --> 00:08:30,000
|
| 495 |
+
Let me answer that question.
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:08:31,000 --> 00:08:32,000
|
| 499 |
+
OK.
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:08:32,000 --> 00:08:37,000
|
| 503 |
+
This method calls another group method within argument and person size plus one there.
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:08:38,000 --> 00:08:39,000
|
| 507 |
+
And what do we have here?
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:08:40,000 --> 00:08:46,000
|
| 511 |
+
We see that in arguments that we passed to this method is used to define desired minimum capacity.
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:08:47,000 --> 00:08:54,000
|
| 515 |
+
You may see has that old capacity is equal to arrest lengths and in case old capacity is more than zero.
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:08:54,000 --> 00:08:57,000
|
| 519 |
+
We calculate new capacity, how it is calculated.
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:08:57,000 --> 00:09:02,000
|
| 523 |
+
I suggest you to investigate by itself by going deeper and method and location change.
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:09:03,000 --> 00:09:05,000
|
| 527 |
+
By the way, you might see here bitwise shift.
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:09:06,000 --> 00:09:09,000
|
| 531 |
+
And it is great that by this lesson you already know how it works.
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:09:10,000 --> 00:09:15,000
|
| 535 |
+
If you don't know, please review my lesson from the Java course about operators.
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:09:15,000 --> 00:09:23,000
|
| 539 |
+
And after that we use a race class to copy our current theory to the one with the new capacity and we
|
| 540 |
+
|
| 541 |
+
136
|
| 542 |
+
00:09:23,000 --> 00:09:24,000
|
| 543 |
+
return the reference to this array.
|
| 544 |
+
|
| 545 |
+
137
|
| 546 |
+
00:09:25,000 --> 00:09:31,000
|
| 547 |
+
So now you can understand that when there is no space for new element Ansary, the values from the old
|
| 548 |
+
|
| 549 |
+
138
|
| 550 |
+
00:09:31,000 --> 00:09:34,000
|
| 551 |
+
are a cockpit to the new array was the new size.
|
| 552 |
+
|
| 553 |
+
139
|
| 554 |
+
00:09:35,000 --> 00:09:40,000
|
| 555 |
+
OK, but what happens if we have just created the of our type and it's empty?
|
| 556 |
+
|
| 557 |
+
140
|
| 558 |
+
00:09:41,000 --> 00:09:43,000
|
| 559 |
+
Let's check the default constructor.
|
| 560 |
+
|
| 561 |
+
141
|
| 562 |
+
00:09:44,000 --> 00:09:47,000
|
| 563 |
+
We can see that element data is initialized with the empty array.
|
| 564 |
+
|
| 565 |
+
142
|
| 566 |
+
00:09:48,000 --> 00:09:50,000
|
| 567 |
+
This is constant empty array.
|
| 568 |
+
|
| 569 |
+
143
|
| 570 |
+
00:09:50,000 --> 00:09:53,000
|
| 571 |
+
But why do we need this default capacity constant?
|
| 572 |
+
|
| 573 |
+
144
|
| 574 |
+
00:09:54,000 --> 00:09:57,000
|
| 575 |
+
To answer this, let's get back to zero method.
|
| 576 |
+
|
| 577 |
+
145
|
| 578 |
+
00:09:57,000 --> 00:09:59,000
|
| 579 |
+
Pay attention to the if clause here.
|
| 580 |
+
|
| 581 |
+
146
|
| 582 |
+
00:10:00,000 --> 00:10:02,000
|
| 583 |
+
If old capacity more than zero.
|
| 584 |
+
|
| 585 |
+
147
|
| 586 |
+
00:10:02,000 --> 00:10:06,000
|
| 587 |
+
And we know that when our only has been just created, its size is zero.
|
| 588 |
+
|
| 589 |
+
148
|
| 590 |
+
00:10:07,000 --> 00:10:12,000
|
| 591 |
+
And the second clause is if Elliman data is not equal to the full capacity MHRA.
|
| 592 |
+
|
| 593 |
+
149
|
| 594 |
+
00:10:12,000 --> 00:10:17,000
|
| 595 |
+
We know that this statement is also false because we initialized our rate with this constant.
|
| 596 |
+
|
| 597 |
+
150
|
| 598 |
+
00:10:18,000 --> 00:10:25,000
|
| 599 |
+
So that's why our full program execution goes to the else block where we initialize our element data
|
| 600 |
+
|
| 601 |
+
151
|
| 602 |
+
00:10:25,000 --> 00:10:32,000
|
| 603 |
+
array with the rate of the Langston Wighton because it will take Maximilien between ten and one during
|
| 604 |
+
|
| 605 |
+
152
|
| 606 |
+
00:10:32,000 --> 00:10:33,000
|
| 607 |
+
the creation of three.
|
| 608 |
+
|
| 609 |
+
153
|
| 610 |
+
00:10:34,000 --> 00:10:37,000
|
| 611 |
+
Does it make sense now as a part of your homework?
|
| 612 |
+
|
| 613 |
+
154
|
| 614 |
+
00:10:37,000 --> 00:10:43,000
|
| 615 |
+
I would encourage you to go over each method in a release like we did with Add Method to understand
|
| 616 |
+
|
| 617 |
+
155
|
| 618 |
+
00:10:43,000 --> 00:10:46,000
|
| 619 |
+
how Array Works program.
|
| 620 |
+
|
| 621 |
+
156
|
| 622 |
+
00:10:46,000 --> 00:10:50,000
|
| 623 |
+
You might be wondered whether you can create an array list with a specific capacity.
|
| 624 |
+
|
| 625 |
+
157
|
| 626 |
+
00:10:51,000 --> 00:10:52,000
|
| 627 |
+
Yes, you can arrange.
|
| 628 |
+
|
| 629 |
+
158
|
| 630 |
+
00:10:52,000 --> 00:10:59,000
|
| 631 |
+
This has special constructor for that here it why you may need to create array list of different capacity.
|
| 632 |
+
|
| 633 |
+
159
|
| 634 |
+
00:11:00,000 --> 00:11:01,000
|
| 635 |
+
Let me explain.
|
| 636 |
+
|
| 637 |
+
160
|
| 638 |
+
00:11:01,000 --> 00:11:05,000
|
| 639 |
+
You imagine that you created array list with capacity of 10 elements.
|
| 640 |
+
|
| 641 |
+
161
|
| 642 |
+
00:11:05,000 --> 00:11:12,000
|
| 643 |
+
That means when you will add 11 element and after that sextants element and so forth, each time I should
|
| 644 |
+
|
| 645 |
+
162
|
| 646 |
+
00:11:12,000 --> 00:11:18,000
|
| 647 |
+
copies of values from the previous array and add them to the new array that will cause some spikes in
|
| 648 |
+
|
| 649 |
+
163
|
| 650 |
+
00:11:18,000 --> 00:11:19,000
|
| 651 |
+
our performance.
|
| 652 |
+
|
| 653 |
+
164
|
| 654 |
+
00:11:20,000 --> 00:11:26,000
|
| 655 |
+
Then if you know that you're going to add to your rate around one million elements right after creation
|
| 656 |
+
|
| 657 |
+
165
|
| 658 |
+
00:11:26,000 --> 00:11:31,000
|
| 659 |
+
of the array, at least it is better to set capacity at the beginning to avoid some spikes in the performance.
|
| 660 |
+
|
| 661 |
+
166
|
| 662 |
+
00:11:32,000 --> 00:11:38,000
|
| 663 |
+
If we specify capacity for one million elements, we will avoid case when we constantly copying arrays
|
| 664 |
+
|
| 665 |
+
167
|
| 666 |
+
00:11:38,000 --> 00:11:45,000
|
| 667 |
+
and creating new objects of arrays, keeping the old arrays in our memory until garbage collector will
|
| 668 |
+
|
| 669 |
+
168
|
| 670 |
+
00:11:45,000 --> 00:11:45,000
|
| 671 |
+
remove them.
|
| 672 |
+
|
| 673 |
+
169
|
| 674 |
+
00:11:46,000 --> 00:11:50,000
|
| 675 |
+
Is it clear now why you might want to create an array with the initial capacity?
|
| 676 |
+
|
| 677 |
+
170
|
| 678 |
+
00:11:51,000 --> 00:11:51,000
|
| 679 |
+
Great.
|
| 680 |
+
|
| 681 |
+
171
|
| 682 |
+
00:11:51,000 --> 00:11:52,000
|
| 683 |
+
Let's move on.
|
| 684 |
+
|
| 685 |
+
172
|
| 686 |
+
00:11:53,000 --> 00:11:55,000
|
| 687 |
+
There is also one more interesting use case.
|
| 688 |
+
|
| 689 |
+
173
|
| 690 |
+
00:11:55,000 --> 00:12:02,000
|
| 691 |
+
Imagine that you added new elements to your array list and after that you removed nine thousand one
|
| 692 |
+
|
| 693 |
+
174
|
| 694 |
+
00:12:02,000 --> 00:12:03,000
|
| 695 |
+
hundred elements.
|
| 696 |
+
|
| 697 |
+
175
|
| 698 |
+
00:12:03,000 --> 00:12:07,000
|
| 699 |
+
OK, there is a one thousand hundred elements in your list.
|
| 700 |
+
|
| 701 |
+
176
|
| 702 |
+
00:12:08,000 --> 00:12:16,000
|
| 703 |
+
But what its capacity, its capacity is still one million to remove new elements from our array.
|
| 704 |
+
|
| 705 |
+
177
|
| 706 |
+
00:12:16,000 --> 00:12:19,000
|
| 707 |
+
Inside our list we may call stream to size method.
|
| 708 |
+
|
| 709 |
+
178
|
| 710 |
+
00:12:20,000 --> 00:12:24,000
|
| 711 |
+
This method streams the capacity of the relist instance to the list.
|
| 712 |
+
|
| 713 |
+
179
|
| 714 |
+
00:12:24,000 --> 00:12:24,000
|
| 715 |
+
Current size.
|
| 716 |
+
|
| 717 |
+
180
|
| 718 |
+
00:12:25,000 --> 00:12:32,000
|
| 719 |
+
OK, now you know how the dynamic extension happens in Frailest, I also promised you to explain what
|
| 720 |
+
|
| 721 |
+
181
|
| 722 |
+
00:12:32,000 --> 00:12:34,000
|
| 723 |
+
random access is.
|
| 724 |
+
|
| 725 |
+
182
|
| 726 |
+
00:12:34,000 --> 00:12:37,000
|
| 727 |
+
Can you see that array list implements random access?
|
| 728 |
+
|
| 729 |
+
183
|
| 730 |
+
00:12:38,000 --> 00:12:40,000
|
| 731 |
+
Let's take a look at this interface.
|
| 732 |
+
|
| 733 |
+
184
|
| 734 |
+
00:12:40,000 --> 00:12:43,000
|
| 735 |
+
Can you see that this is the empty interface?
|
| 736 |
+
|
| 737 |
+
185
|
| 738 |
+
00:12:43,000 --> 00:12:46,000
|
| 739 |
+
It doesn't declare any contract for any behavior.
|
| 740 |
+
|
| 741 |
+
186
|
| 742 |
+
00:12:47,000 --> 00:12:48,000
|
| 743 |
+
Then why do we need it at all?
|
| 744 |
+
|
| 745 |
+
187
|
| 746 |
+
00:12:49,000 --> 00:12:52,000
|
| 747 |
+
Random access interface is a marker interface.
|
| 748 |
+
|
| 749 |
+
188
|
| 750 |
+
00:12:52,000 --> 00:12:57,000
|
| 751 |
+
Sometimes in you would see so-called marker interfaces.
|
| 752 |
+
|
| 753 |
+
189
|
| 754 |
+
00:12:57,000 --> 00:13:00,000
|
| 755 |
+
Why is called so xcode so?
|
| 756 |
+
|
| 757 |
+
190
|
| 758 |
+
00:13:00,000 --> 00:13:06,000
|
| 759 |
+
Because the only reason why they exist is to mark interface with a specific type to use this information
|
| 760 |
+
|
| 761 |
+
191
|
| 762 |
+
00:13:06,000 --> 00:13:07,000
|
| 763 |
+
in the future.
|
| 764 |
+
|
| 765 |
+
192
|
| 766 |
+
00:13:08,000 --> 00:13:10,000
|
| 767 |
+
Probably it is still not clear for you.
|
| 768 |
+
|
| 769 |
+
193
|
| 770 |
+
00:13:11,000 --> 00:13:13,000
|
| 771 |
+
But let me show you on the example.
|
| 772 |
+
|
| 773 |
+
194
|
| 774 |
+
00:13:13,000 --> 00:13:20,000
|
| 775 |
+
Here is a random access interface which is used to mark any class that supports retrieval of elements
|
| 776 |
+
|
| 777 |
+
195
|
| 778 |
+
00:13:20,000 --> 00:13:21,000
|
| 779 |
+
for the constant amount of time.
|
| 780 |
+
|
| 781 |
+
196
|
| 782 |
+
00:13:22,000 --> 00:13:29,000
|
| 783 |
+
That's actually one of the key features of our list is a constant amount of time for reading an element
|
| 784 |
+
|
| 785 |
+
197
|
| 786 |
+
00:13:29,000 --> 00:13:33,000
|
| 787 |
+
is because of the nature of a release and how it works under the hood.
|
| 788 |
+
|
| 789 |
+
198
|
| 790 |
+
00:13:33,000 --> 00:13:38,000
|
| 791 |
+
To read an element, you just need to get it from array by specific index.
|
| 792 |
+
|
| 793 |
+
199
|
| 794 |
+
00:13:38,000 --> 00:13:40,000
|
| 795 |
+
And this time is usually constant.
|
| 796 |
+
|
| 797 |
+
200
|
| 798 |
+
00:13:41,000 --> 00:13:45,000
|
| 799 |
+
That's why our list is marked as implementation of random access.
|
| 800 |
+
|
| 801 |
+
201
|
| 802 |
+
00:13:46,000 --> 00:13:48,000
|
| 803 |
+
Now let's see where this information is used.
|
| 804 |
+
|
| 805 |
+
202
|
| 806 |
+
00:13:49,000 --> 00:13:55,000
|
| 807 |
+
If we would open collection class, this is class with utility methods nonwar, it will run it in the
|
| 808 |
+
|
| 809 |
+
203
|
| 810 |
+
00:13:55,000 --> 00:13:56,000
|
| 811 |
+
separate question.
|
| 812 |
+
|
| 813 |
+
204
|
| 814 |
+
00:13:57,000 --> 00:14:02,000
|
| 815 |
+
Right now, I just want to show you how information about market interfaces used I press control and
|
| 816 |
+
|
| 817 |
+
205
|
| 818 |
+
00:14:03,000 --> 00:14:09,000
|
| 819 |
+
you simultaneously to search through this file and I want to search for random access words and I have
|
| 820 |
+
|
| 821 |
+
206
|
| 822 |
+
00:14:09,000 --> 00:14:11,000
|
| 823 |
+
around fifty eight mentions.
|
| 824 |
+
|
| 825 |
+
207
|
| 826 |
+
00:14:11,000 --> 00:14:18,000
|
| 827 |
+
You can see that random access is used with instance of operator and if closes to select specific algorithms
|
| 828 |
+
|
| 829 |
+
208
|
| 830 |
+
00:14:18,000 --> 00:14:22,000
|
| 831 |
+
that will work the best here in binary search method.
|
| 832 |
+
|
| 833 |
+
209
|
| 834 |
+
00:14:22,000 --> 00:14:28,000
|
| 835 |
+
You may see that in case that were passed as parameter to the mass that is compatible with random access
|
| 836 |
+
|
| 837 |
+
210
|
| 838 |
+
00:14:28,000 --> 00:14:31,000
|
| 839 |
+
type then indexed binary search algorithm will be applied.
|
| 840 |
+
|
| 841 |
+
211
|
| 842 |
+
00:14:32,000 --> 00:14:35,000
|
| 843 |
+
If no, then iterate a binary search method will be called.
|
| 844 |
+
|
| 845 |
+
212
|
| 846 |
+
00:14:36,000 --> 00:14:41,000
|
| 847 |
+
And similarly, in the other method, check for compatibility with random access interface is used to
|
| 848 |
+
|
| 849 |
+
213
|
| 850 |
+
00:14:41,000 --> 00:14:43,000
|
| 851 |
+
select the best algorithm.
|
| 852 |
+
|
| 853 |
+
214
|
| 854 |
+
00:14:44,000 --> 00:14:49,000
|
| 855 |
+
Right now, I believe you understood the use case and how much the interface may be used.
|
| 856 |
+
|
| 857 |
+
215
|
| 858 |
+
00:14:49,000 --> 00:14:50,000
|
| 859 |
+
That's great.
|
| 860 |
+
|
| 861 |
+
216
|
| 862 |
+
00:14:51,000 --> 00:14:52,000
|
| 863 |
+
According to the agenda.
|
| 864 |
+
|
| 865 |
+
217
|
| 866 |
+
00:14:52,000 --> 00:14:55,000
|
| 867 |
+
Also, we're going to cover today a few more classes.
|
| 868 |
+
|
| 869 |
+
218
|
| 870 |
+
00:14:55,000 --> 00:14:59,000
|
| 871 |
+
Zaya Vector, Cooperton writer released and Stack.
|
| 872 |
+
|
| 873 |
+
219
|
| 874 |
+
00:14:59,000 --> 00:15:06,000
|
| 875 |
+
While covering those, I will be super fast because they are mostly the same as I released, so I would
|
| 876 |
+
|
| 877 |
+
220
|
| 878 |
+
00:15:06,000 --> 00:15:11,000
|
| 879 |
+
draw your attention only to the things that are different from the released here of Extra Vector.
|
| 880 |
+
|
| 881 |
+
221
|
| 882 |
+
00:15:12,000 --> 00:15:18,000
|
| 883 |
+
It is almost the same as it released the same mechanism of storing data.
|
| 884 |
+
|
| 885 |
+
222
|
| 886 |
+
00:15:18,000 --> 00:15:21,000
|
| 887 |
+
Here is the element data array to store elements.
|
| 888 |
+
|
| 889 |
+
223
|
| 890 |
+
00:15:22,000 --> 00:15:28,000
|
| 891 |
+
There's only one big difference between a release and vector on assets and vector a synchronized.
|
| 892 |
+
|
| 893 |
+
224
|
| 894 |
+
00:15:28,000 --> 00:15:29,000
|
| 895 |
+
What does that mean?
|
| 896 |
+
|
| 897 |
+
225
|
| 898 |
+
00:15:30,000 --> 00:15:32,000
|
| 899 |
+
Let's take a look at the ad method.
|
| 900 |
+
|
| 901 |
+
226
|
| 902 |
+
00:15:32,000 --> 00:15:33,000
|
| 903 |
+
For example.
|
| 904 |
+
|
| 905 |
+
227
|
| 906 |
+
00:15:33,000 --> 00:15:36,000
|
| 907 |
+
Can you see the key words synchronized in the method definition?
|
| 908 |
+
|
| 909 |
+
228
|
| 910 |
+
00:15:37,000 --> 00:15:43,000
|
| 911 |
+
We didn't learn yet this keyword in detail, but we will we will run it in the details durians and we'll
|
| 912 |
+
|
| 913 |
+
229
|
| 914 |
+
00:15:43,000 --> 00:15:44,000
|
| 915 |
+
just write in top it.
|
| 916 |
+
|
| 917 |
+
230
|
| 918 |
+
00:15:45,000 --> 00:15:50,000
|
| 919 |
+
But right now you can understand this keyword as a restriction for multiple threats of execution and
|
| 920 |
+
|
| 921 |
+
231
|
| 922 |
+
00:15:50,000 --> 00:15:52,000
|
| 923 |
+
the method, but body simultaneously.
|
| 924 |
+
|
| 925 |
+
232
|
| 926 |
+
00:15:53,000 --> 00:15:59,000
|
| 927 |
+
That means if two threats of execution want to add element, remove element or replace element of a
|
| 928 |
+
|
| 929 |
+
233
|
| 930 |
+
00:15:59,000 --> 00:16:03,000
|
| 931 |
+
specific index, they won't be able to do this simultaneously.
|
| 932 |
+
|
| 933 |
+
234
|
| 934 |
+
00:16:04,000 --> 00:16:07,000
|
| 935 |
+
All these operations will be performed one after another.
|
| 936 |
+
|
| 937 |
+
235
|
| 938 |
+
00:16:07,000 --> 00:16:11,000
|
| 939 |
+
That would save you from the data inconsistency inside the vector.
|
| 940 |
+
|
| 941 |
+
236
|
| 942 |
+
00:16:11,000 --> 00:16:14,000
|
| 943 |
+
That's why Vector is called safe container.
|
| 944 |
+
|
| 945 |
+
237
|
| 946 |
+
00:16:15,000 --> 00:16:16,000
|
| 947 |
+
Does it make sense?
|
| 948 |
+
|
| 949 |
+
238
|
| 950 |
+
00:16:16,000 --> 00:16:18,000
|
| 951 |
+
OK, let's go further.
|
| 952 |
+
|
| 953 |
+
239
|
| 954 |
+
00:16:18,000 --> 00:16:20,000
|
| 955 |
+
Let me open a copy right away.
|
| 956 |
+
|
| 957 |
+
240
|
| 958 |
+
00:16:20,000 --> 00:16:22,000
|
| 959 |
+
List the same stories here.
|
| 960 |
+
|
| 961 |
+
241
|
| 962 |
+
00:16:23,000 --> 00:16:23,000
|
| 963 |
+
Right.
|
| 964 |
+
|
| 965 |
+
242
|
| 966 |
+
00:16:23,000 --> 00:16:26,000
|
| 967 |
+
Or at least is a safe version of the array list.
|
| 968 |
+
|
| 969 |
+
243
|
| 970 |
+
00:16:27,000 --> 00:16:30,000
|
| 971 |
+
Then what is the difference between vector and copywriter?
|
| 972 |
+
|
| 973 |
+
244
|
| 974 |
+
00:16:30,000 --> 00:16:31,000
|
| 975 |
+
At least Corporan.
|
| 976 |
+
|
| 977 |
+
245
|
| 978 |
+
00:16:31,000 --> 00:16:32,000
|
| 979 |
+
Right.
|
| 980 |
+
|
| 981 |
+
246
|
| 982 |
+
00:16:32,000 --> 00:16:34,000
|
| 983 |
+
The list was introduced in Java version five.
|
| 984 |
+
|
| 985 |
+
247
|
| 986 |
+
00:16:35,000 --> 00:16:39,000
|
| 987 |
+
Well, Vector was introduced in the version first in version five.
|
| 988 |
+
|
| 989 |
+
248
|
| 990 |
+
00:16:39,000 --> 00:16:44,000
|
| 991 |
+
Engineers come up with improvements in performance for this, let's say, version of a release.
|
| 992 |
+
|
| 993 |
+
249
|
| 994 |
+
00:16:45,000 --> 00:16:49,000
|
| 995 |
+
And we can say that right writer released is more efficient from the performance standpoint.
|
| 996 |
+
|
| 997 |
+
250
|
| 998 |
+
00:16:49,000 --> 00:16:54,000
|
| 999 |
+
In comparison with Vector, for example, let me open add method.
|
| 1000 |
+
|
| 1001 |
+
251
|
| 1002 |
+
00:16:54,000 --> 00:16:55,000
|
| 1003 |
+
Can you see this?
|
| 1004 |
+
|
| 1005 |
+
252
|
| 1006 |
+
00:16:56,000 --> 00:16:59,000
|
| 1007 |
+
There is no synchronized word here, but synchronized block instead.
|
| 1008 |
+
|
| 1009 |
+
253
|
| 1010 |
+
00:17:00,000 --> 00:17:06,000
|
| 1011 |
+
The White House improvisation is implemented in this class is different from the way it is implemented
|
| 1012 |
+
|
| 1013 |
+
254
|
| 1014 |
+
00:17:06,000 --> 00:17:06,000
|
| 1015 |
+
in Vector.
|
| 1016 |
+
|
| 1017 |
+
255
|
| 1018 |
+
00:17:07,000 --> 00:17:10,000
|
| 1019 |
+
That is the difference between vector unreleased and Copan.
|
| 1020 |
+
|
| 1021 |
+
256
|
| 1022 |
+
00:17:10,000 --> 00:17:11,000
|
| 1023 |
+
Right?
|
| 1024 |
+
|
| 1025 |
+
257
|
| 1026 |
+
00:17:11,000 --> 00:17:11,000
|
| 1027 |
+
Frailest.
|
| 1028 |
+
|
| 1029 |
+
258
|
| 1030 |
+
00:17:12,000 --> 00:17:18,000
|
| 1031 |
+
And now let's open this attack was, as you remember from the beginning of the lesson, Stack extends
|
| 1032 |
+
|
| 1033 |
+
259
|
| 1034 |
+
00:17:18,000 --> 00:17:19,000
|
| 1035 |
+
factor.
|
| 1036 |
+
|
| 1037 |
+
260
|
| 1038 |
+
00:17:19,000 --> 00:17:22,000
|
| 1039 |
+
But take a look at the map that introduced instead.
|
| 1040 |
+
|
| 1041 |
+
261
|
| 1042 |
+
00:17:23,000 --> 00:17:29,000
|
| 1043 |
+
What does this remind you of your right that is almost interface of the cube.
|
| 1044 |
+
|
| 1045 |
+
262
|
| 1046 |
+
00:17:29,000 --> 00:17:32,000
|
| 1047 |
+
The names of the masses are almost the same.
|
| 1048 |
+
|
| 1049 |
+
263
|
| 1050 |
+
00:17:32,000 --> 00:17:36,000
|
| 1051 |
+
Engineers don't like Stack because this is concrete glass.
|
| 1052 |
+
|
| 1053 |
+
264
|
| 1054 |
+
00:17:36,000 --> 00:17:41,000
|
| 1055 |
+
That means there is no flexibility in using different implementation of the same API.
|
| 1056 |
+
|
| 1057 |
+
265
|
| 1058 |
+
00:17:42,000 --> 00:17:44,000
|
| 1059 |
+
It implements LIFO principle.
|
| 1060 |
+
|
| 1061 |
+
266
|
| 1062 |
+
00:17:45,000 --> 00:17:46,000
|
| 1063 |
+
Last in, first out.
|
| 1064 |
+
|
| 1065 |
+
267
|
| 1066 |
+
00:17:47,000 --> 00:17:52,000
|
| 1067 |
+
We are going to review this principle in the details when we get closer to the interface.
|
| 1068 |
+
|
| 1069 |
+
268
|
| 1070 |
+
00:17:52,000 --> 00:17:54,000
|
| 1071 |
+
So don't worry.
|
| 1072 |
+
|
| 1073 |
+
269
|
| 1074 |
+
00:17:54,000 --> 00:18:01,000
|
| 1075 |
+
Years for now, the LIFO principle is implemented in DEC interface and in different implementation of
|
| 1076 |
+
|
| 1077 |
+
270
|
| 1078 |
+
00:18:01,000 --> 00:18:02,000
|
| 1079 |
+
that interface.
|
| 1080 |
+
|
| 1081 |
+
271
|
| 1082 |
+
00:18:02,000 --> 00:18:08,000
|
| 1083 |
+
But Stack was introduced in Java version one and keep the promise of backwards compatibility and to
|
| 1084 |
+
|
| 1085 |
+
272
|
| 1086 |
+
00:18:08,000 --> 00:18:13,000
|
| 1087 |
+
make sure that programs that are written on Java version first will be successfully executed on the
|
| 1088 |
+
|
| 1089 |
+
273
|
| 1090 |
+
00:18:13,000 --> 00:18:14,000
|
| 1091 |
+
Java version fifteens.
|
| 1092 |
+
|
| 1093 |
+
274
|
| 1094 |
+
00:18:14,000 --> 00:18:17,000
|
| 1095 |
+
And later this class is still here.
|
| 1096 |
+
|
| 1097 |
+
275
|
| 1098 |
+
00:18:18,000 --> 00:18:18,000
|
| 1099 |
+
That's it.
|
| 1100 |
+
|
| 1101 |
+
276
|
| 1102 |
+
00:18:19,000 --> 00:18:23,000
|
| 1103 |
+
Now, you know, also the difference between a release vector, right.
|
| 1104 |
+
|
| 1105 |
+
277
|
| 1106 |
+
00:18:23,000 --> 00:18:24,000
|
| 1107 |
+
And released instead.
|
| 1108 |
+
|
| 1109 |
+
278
|
| 1110 |
+
00:18:25,000 --> 00:18:27,000
|
| 1111 |
+
Now let's recap what we have learned today.
|
| 1112 |
+
|
| 1113 |
+
279
|
| 1114 |
+
00:18:28,000 --> 00:18:31,000
|
| 1115 |
+
Today, we investigated the Iraqi of least interface.
|
| 1116 |
+
|
| 1117 |
+
280
|
| 1118 |
+
00:18:31,000 --> 00:18:36,000
|
| 1119 |
+
You saw how you may investigate source code and you Iraqi of any interface in eclipse.
|
| 1120 |
+
|
| 1121 |
+
281
|
| 1122 |
+
00:18:37,000 --> 00:18:42,000
|
| 1123 |
+
Also in this lesson, we learned when we have to use implementation of the interface, such as every
|
| 1124 |
+
|
| 1125 |
+
282
|
| 1126 |
+
00:18:43,000 --> 00:18:50,000
|
| 1127 |
+
vector writer relist, and so that we learned in detail how size of the array maybe dynamically increased
|
| 1128 |
+
|
| 1129 |
+
283
|
| 1130 |
+
00:18:50,000 --> 00:18:50,000
|
| 1131 |
+
in there.
|
| 1132 |
+
|
| 1133 |
+
284
|
| 1134 |
+
00:18:50,000 --> 00:18:56,000
|
| 1135 |
+
At least now you know the difference between a real E vector right at released and stack.
|
| 1136 |
+
|
| 1137 |
+
285
|
| 1138 |
+
00:18:57,000 --> 00:19:00,000
|
| 1139 |
+
During the lesson we learned what Mark interfaces are.
|
| 1140 |
+
|
| 1141 |
+
286
|
| 1142 |
+
00:19:00,000 --> 00:19:05,000
|
| 1143 |
+
On the example of random access interface, we learned how market interface might be used.
|
| 1144 |
+
|
| 1145 |
+
287
|
| 1146 |
+
00:19:06,000 --> 00:19:08,000
|
| 1147 |
+
That's what we have for today.
|
| 1148 |
+
|
| 1149 |
+
288
|
| 1150 |
+
00:19:08,000 --> 00:19:11,000
|
| 1151 |
+
Thanks a lot for your attention and see you in the next lesson.
|
| 1152 |
+
|
19 - Java Collections Framework/005 Homework.url
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[InternetShortcut]
|
| 2 |
+
URL=https://docs.google.com/document/d/1g5GRLOU4XRDCIp50n_-Dmnok-2EdoDTlAQdVm6XyBLo/edit?usp=sharing
|
19 - Java Collections Framework/005 LinkedList VS ArrayList, Big O Notation & Homework_en.srt
ADDED
|
@@ -0,0 +1,1388 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1
|
| 2 |
+
00:00:06,000 --> 00:00:06,000
|
| 3 |
+
Hello, Jim.
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:06,000 --> 00:00:10,000
|
| 7 |
+
Today we are going to discuss one more implementation of list interface.
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:10,000 --> 00:00:12,000
|
| 11 |
+
I'm talking about linked list.
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:12,000 --> 00:00:15,000
|
| 15 |
+
In this lesson we are going to learn how Linked List works.
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:15,000 --> 00:00:20,000
|
| 19 |
+
We are going to review the source code and understand when we are going to use it.
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:20,000 --> 00:00:25,000
|
| 23 |
+
Also, we'll compare linked list and array list to provide you with the answer what list implementation
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:25,000 --> 00:00:28,000
|
| 27 |
+
you are going to use most of the times.
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:28,000 --> 00:00:33,000
|
| 31 |
+
Besides that, today in lesson we are going to have a lot of practice and I will share with you home
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:33,000 --> 00:00:36,000
|
| 35 |
+
tasks that will help you to practice your knowledge in lists.
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:36,000 --> 00:00:37,000
|
| 39 |
+
Let's start.
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:38,000 --> 00:00:42,000
|
| 43 |
+
And first of all, let's understand how Linked List works and why it is called.
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:42,000 --> 00:00:45,000
|
| 47 |
+
So this is double linked list.
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:45,000 --> 00:00:47,000
|
| 51 |
+
Why it double linked.
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:00:47,000 --> 00:00:48,000
|
| 55 |
+
Let's look at the slide.
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:00:48,000 --> 00:00:54,000
|
| 59 |
+
This container consists of multiple objects of node type that connected between each other.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:00:54,000 --> 00:00:59,000
|
| 63 |
+
Each node contains some data linked to the previous node and linked to the next node.
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:00:59,000 --> 00:01:02,000
|
| 67 |
+
That's why each node has two links.
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:02,000 --> 00:01:05,000
|
| 71 |
+
That's where a name of the container comes from.
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:05,000 --> 00:01:06,000
|
| 75 |
+
Linked list.
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:06,000 --> 00:01:11,000
|
| 79 |
+
It is double linked because each node has the links to the next and previous element.
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:11,000 --> 00:01:12,000
|
| 83 |
+
Does it make sense?
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:12,000 --> 00:01:16,000
|
| 87 |
+
Now let's review the real example of linked list.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:16,000 --> 00:01:17,000
|
| 91 |
+
Take a look at the slide please.
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:17,000 --> 00:01:21,000
|
| 95 |
+
For example, we have our first node a node.
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:21,000 --> 00:01:23,000
|
| 99 |
+
It contains value 1000.
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:23,000 --> 00:01:26,000
|
| 103 |
+
Taking into account this is the first element.
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:26,000 --> 00:01:32,000
|
| 107 |
+
The link to previous element is null, but link to the next element is linked to the b node.
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:32,000 --> 00:01:36,000
|
| 111 |
+
B node also contains value that is 2000.
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:01:36,000 --> 00:01:41,000
|
| 115 |
+
Link to the previous node that is a node and link to the next node.
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:01:41,000 --> 00:01:44,000
|
| 119 |
+
C node C node is the last one.
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:01:44,000 --> 00:01:48,000
|
| 123 |
+
That's why link to the next node has no value.
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:01:48,000 --> 00:01:54,000
|
| 127 |
+
And on the slide you can see that link list always stores the reference to the first and the last node.
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:01:54,000 --> 00:01:57,000
|
| 131 |
+
It is clear now how linked list is built.
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:01:57,000 --> 00:02:03,000
|
| 135 |
+
Understanding of this will help you a lot in understanding where and when you might want to use Linked
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:03,000 --> 00:02:05,000
|
| 139 |
+
List to proceed.
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:05,000 --> 00:02:09,000
|
| 143 |
+
Our lesson today, I suggest investigating the source code of the linked list.
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:09,000 --> 00:02:12,000
|
| 147 |
+
Here is the source code of the linked list class.
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:12,000 --> 00:02:18,000
|
| 151 |
+
As you remember from the previous lesson, it extends abstract sequential list that contains implementation
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:18,000 --> 00:02:20,000
|
| 155 |
+
of some list methods.
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:20,000 --> 00:02:23,000
|
| 159 |
+
Here you may see two fields of node type.
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:23,000 --> 00:02:28,000
|
| 163 |
+
I believe from their names it is clear where they are referencing to the linked list.
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:02:28,000 --> 00:02:32,000
|
| 167 |
+
Always stores the reference to the first and the last element.
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:02:32,000 --> 00:02:36,000
|
| 171 |
+
Let's investigate how adding new element to the collection works.
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:02:36,000 --> 00:02:38,000
|
| 175 |
+
I want to open add method.
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:02:38,000 --> 00:02:40,000
|
| 179 |
+
Here it is.
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:02:40,000 --> 00:02:43,000
|
| 183 |
+
We can see that link class method is invoked here.
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:02:44,000 --> 00:02:50,000
|
| 187 |
+
Okay, let me investigate that one new variable of the node type is created and initialized with the
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:02:50,000 --> 00:02:53,000
|
| 191 |
+
last node in the linked list.
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:02:53,000 --> 00:02:58,000
|
| 195 |
+
After that new node object is created, special constructor is called.
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:02:58,000 --> 00:03:05,000
|
| 199 |
+
We are passing reference to the last node elements that we want to add and new value.
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:05,000 --> 00:03:09,000
|
| 203 |
+
Let me open this constructor to investigate what is happening there.
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:09,000 --> 00:03:12,000
|
| 207 |
+
And now we may receive two answers.
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:12,000 --> 00:03:16,000
|
| 211 |
+
The first answer is on the question what is node class?
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:16,000 --> 00:03:21,000
|
| 215 |
+
As you can see, node is a static nested class and it's private.
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:21,000 --> 00:03:26,000
|
| 219 |
+
That means that instances of the node class can be created only from the linked list class.
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:26,000 --> 00:03:33,000
|
| 223 |
+
You also may notice that it is not so big and it doesn't have any behavior, only state.
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:03:33,000 --> 00:03:36,000
|
| 227 |
+
The state of the node class is described in three fields.
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:03:36,000 --> 00:03:40,000
|
| 231 |
+
They are item, next, and previous.
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:03:40,000 --> 00:03:44,000
|
| 235 |
+
And the second answer is in this constructor.
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:03:44,000 --> 00:03:48,000
|
| 239 |
+
So the first argument is used to initialize previous variable.
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:03:48,000 --> 00:03:54,000
|
| 243 |
+
The second method argument is used to initialize the value of the current node, and the third method
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:03:54,000 --> 00:03:58,000
|
| 247 |
+
argument is used to initialize the next variable.
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:03:58,000 --> 00:04:05,000
|
| 251 |
+
Now when we know this, let's get back to the add method and when new node is created, last variable
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:05,000 --> 00:04:11,000
|
| 255 |
+
is pointing out to the new node and in case last node was null, that means list was empty.
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:12,000 --> 00:04:15,000
|
| 259 |
+
Thus new node should become the first element in the list.
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:15,000 --> 00:04:19,000
|
| 263 |
+
If no, then we have to change the next reference in the node.
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:19,000 --> 00:04:22,000
|
| 267 |
+
That was the last note so much time ago.
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:22,000 --> 00:04:28,000
|
| 271 |
+
What I want you to understand, I want you to understand that to insert elements in linked list, it
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:28,000 --> 00:04:33,000
|
| 275 |
+
is enough just to change references to the previous and the next element.
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:04:33,000 --> 00:04:34,000
|
| 279 |
+
That's it.
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:04:34,000 --> 00:04:39,000
|
| 283 |
+
If you remember array list that we learned in previous lesson, you should already know that in array
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:04:39,000 --> 00:04:44,000
|
| 287 |
+
list, we always need to copy values from previous array and to create new arrays.
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:04:44,000 --> 00:04:50,000
|
| 291 |
+
If we want to remove elements from the middle or beginning of the list, or to insert elements at the
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:04:50,000 --> 00:04:57,000
|
| 295 |
+
beginning or in the middle of the list in the linked list, these operations may be done much faster
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:04:57,000 --> 00:04:58,000
|
| 299 |
+
and significantly easier.
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:04:59,000 --> 00:05:01,000
|
| 303 |
+
Also, I'd like you to pay attention to the.
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:01,000 --> 00:05:04,000
|
| 307 |
+
The fact that Linked List implements that interface.
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:04,000 --> 00:05:06,000
|
| 311 |
+
Let me open it.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:06,000 --> 00:05:09,000
|
| 315 |
+
Deck interface extends queue.
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:09,000 --> 00:05:13,000
|
| 319 |
+
This is lesson not about queue and deck interface, but it is hard.
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:13,000 --> 00:05:19,000
|
| 323 |
+
Not to mention that linked List is also one of the most popular implementations of the queue interface.
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:19,000 --> 00:05:26,000
|
| 327 |
+
And to be honest, I used link list more often when I needed implementation of the queue, but not implementation
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:26,000 --> 00:05:27,000
|
| 331 |
+
of the list.
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:05:27,000 --> 00:05:28,000
|
| 335 |
+
Why?
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:05:28,000 --> 00:05:30,000
|
| 339 |
+
I'm going to explain you this in a minute.
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:05:31,000 --> 00:05:34,000
|
| 343 |
+
So knowing this fact, don't feel wondered why.
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:05:34,000 --> 00:05:42,000
|
| 347 |
+
Linked list also has such methods as at first, at last remove first, remove last, get first, get
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:05:42,000 --> 00:05:43,000
|
| 351 |
+
lost and others.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:05:43,000 --> 00:05:50,000
|
| 355 |
+
Now you know that linked list must give implementations to these methods since it implements deck interface.
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:05:50,000 --> 00:05:57,000
|
| 359 |
+
We will not review these methods today since this is lesson about implementation of the list interface,
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:05:57,000 --> 00:06:03,000
|
| 363 |
+
but we will discuss the other methods for sure during the lessons about queue, so don't worry.
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:03,000 --> 00:06:09,000
|
| 367 |
+
Now I suggest practicing a bit with using linked list and array list for the sake of the demo.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:09,000 --> 00:06:12,000
|
| 371 |
+
Before the lesson I created this demo file.
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:12,000 --> 00:06:15,000
|
| 375 |
+
I will leave a link to it in the lesson attachments.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:15,000 --> 00:06:21,000
|
| 379 |
+
And if you have all my training project cloned from the GitHub, just pull the latest changes.
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:21,000 --> 00:06:25,000
|
| 383 |
+
Let me also run this program and we will explore console output together.
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:06:26,000 --> 00:06:27,000
|
| 387 |
+
Okay.
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:06:27,000 --> 00:06:34,000
|
| 391 |
+
As I begin here, I created two variables of type list, both of them initialized with array list objects.
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:06:34,000 --> 00:06:36,000
|
| 395 |
+
Do not forget to do imports.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:06:37,000 --> 00:06:40,000
|
| 399 |
+
Eclipse will remind you to do that, so don't worry.
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:06:40,000 --> 00:06:47,000
|
| 403 |
+
You also can see that the first list here is underlined with yellow line, the same as array list here.
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:06:47,000 --> 00:06:51,000
|
| 407 |
+
But in the next line there are no any warnings.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:06:51,000 --> 00:06:54,000
|
| 411 |
+
What is the difference between these two declarations?
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:06:54,000 --> 00:07:00,000
|
| 415 |
+
Probably you already saw in the source code this diamond operator, but you couldn't understand.
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:00,000 --> 00:07:01,000
|
| 419 |
+
What does that mean?
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:01,000 --> 00:07:03,000
|
| 423 |
+
Let me explain you this.
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:03,000 --> 00:07:09,000
|
| 427 |
+
On the next example, I add string object to the list one and I also add integer object to the list
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:09,000 --> 00:07:10,000
|
| 431 |
+
one.
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:10,000 --> 00:07:17,000
|
| 435 |
+
Now my list one contains objects of different types, but all of them are compatible with the one type
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:18,000 --> 00:07:19,000
|
| 439 |
+
object.
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:07:19,000 --> 00:07:26,000
|
| 443 |
+
That's why when we want to get element of this container, we always get object of type object.
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:07:26,000 --> 00:07:28,000
|
| 447 |
+
Can you understand why?
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:07:28,000 --> 00:07:34,000
|
| 451 |
+
Because Java compiler doesn't know what object will be on the first index in the list and what its type.
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:07:35,000 --> 00:07:37,000
|
| 455 |
+
Now let's look at the second list.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:07:37,000 --> 00:07:44,000
|
| 459 |
+
I also can add string in it, but I can't add integer because this would cause compilation error.
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:07:44,000 --> 00:07:48,000
|
| 463 |
+
Why this called generic mechanism.
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:07:48,000 --> 00:07:53,000
|
| 467 |
+
We are going to have separate lesson where I'm going to describe you generics in detail.
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:07:53,000 --> 00:07:58,000
|
| 471 |
+
But right now you have to understand it at least on the high level because this will help you during
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:07:58,000 --> 00:08:00,000
|
| 475 |
+
the homework implementation.
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:08:00,000 --> 00:08:07,000
|
| 479 |
+
Here in Diamond operator, we specify type of elements in this list that is assigned for our Compilator
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:07,000 --> 00:08:11,000
|
| 483 |
+
that in this list we will store only string objects.
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:11,000 --> 00:08:17,000
|
| 487 |
+
We also have to specify diamond operator here next to specific collection implementation before the
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:17,000 --> 00:08:18,000
|
| 491 |
+
Java version seven.
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:18,000 --> 00:08:25,000
|
| 495 |
+
Engineers should also specify type here, but after Java version seven, in case type is the same as
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:08:25,000 --> 00:08:28,000
|
| 499 |
+
it is specified for variable, we can keep it empty.
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:08:28,000 --> 00:08:32,000
|
| 503 |
+
This would be the same as in case we would specify type here.
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:08:33,000 --> 00:08:37,000
|
| 507 |
+
That's why Compilator allows only add string objects there.
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:08:37,000 --> 00:08:40,000
|
| 511 |
+
Pretty cool feature, don't you think so?
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:08:40,000 --> 00:08:42,000
|
| 515 |
+
This saves developer nerves.
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:08:42,000 --> 00:08:48,000
|
| 519 |
+
When we get object from the container, call some method on it and we see some exception and program
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:08:48,000 --> 00:08:55,000
|
| 523 |
+
stops execution because somebody in some other method put in the container object of incompatible type.
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:08:55,000 --> 00:09:02,000
|
| 527 |
+
And when compilator is sure that will store only string objects there, we also can retrieve objects
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:09:02,000 --> 00:09:03,000
|
| 531 |
+
of the string type.
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:09:03,000 --> 00:09:09,000
|
| 535 |
+
For example, here when I get element from zero index, I get object of string type.
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:09:09,000 --> 00:09:13,000
|
| 539 |
+
Hope this brings some clarity on how you may use diamond operator.
|
| 540 |
+
|
| 541 |
+
136
|
| 542 |
+
00:09:13,000 --> 00:09:19,000
|
| 543 |
+
More advanced scenarios and how generics work will be reviewed during the separate lesson.
|
| 544 |
+
|
| 545 |
+
137
|
| 546 |
+
00:09:19,000 --> 00:09:21,000
|
| 547 |
+
Okay, let's move on.
|
| 548 |
+
|
| 549 |
+
138
|
| 550 |
+
00:09:21,000 --> 00:09:28,000
|
| 551 |
+
Here you may see that I initialized my variable of list type with linked list object, and this is one
|
| 552 |
+
|
| 553 |
+
139
|
| 554 |
+
00:09:28,000 --> 00:09:30,000
|
| 555 |
+
of the advantages of Java Collections framework.
|
| 556 |
+
|
| 557 |
+
140
|
| 558 |
+
00:09:30,000 --> 00:09:31,000
|
| 559 |
+
Here it is.
|
| 560 |
+
|
| 561 |
+
141
|
| 562 |
+
00:09:31,000 --> 00:09:37,000
|
| 563 |
+
We may change implementation of the list, but the application programming interface is the same.
|
| 564 |
+
|
| 565 |
+
142
|
| 566 |
+
00:09:37,000 --> 00:09:41,000
|
| 567 |
+
I still may use the same methods and count on the same result.
|
| 568 |
+
|
| 569 |
+
143
|
| 570 |
+
00:09:41,000 --> 00:09:48,000
|
| 571 |
+
That's why all examples that you are going to see in this and in the next lessons will be the same for
|
| 572 |
+
|
| 573 |
+
144
|
| 574 |
+
00:09:48,000 --> 00:09:51,000
|
| 575 |
+
different implementations of the specific interfaces.
|
| 576 |
+
|
| 577 |
+
145
|
| 578 |
+
00:09:51,000 --> 00:09:56,000
|
| 579 |
+
For example, if we are reviewing list interface, you may use different implementations of the list.
|
| 580 |
+
|
| 581 |
+
146
|
| 582 |
+
00:09:56,000 --> 00:10:03,000
|
| 583 |
+
All of them have the same set of methods, but the way how these methods works on site are different
|
| 584 |
+
|
| 585 |
+
147
|
| 586 |
+
00:10:03,000 --> 00:10:07,000
|
| 587 |
+
and that may impact on your decision which list implementation to choose.
|
| 588 |
+
|
| 589 |
+
148
|
| 590 |
+
00:10:07,000 --> 00:10:08,000
|
| 591 |
+
Does it make sense?
|
| 592 |
+
|
| 593 |
+
149
|
| 594 |
+
00:10:09,000 --> 00:10:14,000
|
| 595 |
+
Now let me share with you the tip and the popular way to initialize some lists.
|
| 596 |
+
|
| 597 |
+
150
|
| 598 |
+
00:10:14,000 --> 00:10:19,000
|
| 599 |
+
All lists implementation have constructors that takes collection of elements and initialize new list
|
| 600 |
+
|
| 601 |
+
151
|
| 602 |
+
00:10:19,000 --> 00:10:21,000
|
| 603 |
+
with these elements.
|
| 604 |
+
|
| 605 |
+
152
|
| 606 |
+
00:10:21,000 --> 00:10:27,000
|
| 607 |
+
Arrays class has as list method that takes multiple parameters of the same type and returns the list,
|
| 608 |
+
|
| 609 |
+
153
|
| 610 |
+
00:10:27,000 --> 00:10:32,000
|
| 611 |
+
which in turn we use here to pass it to the constructor of array list.
|
| 612 |
+
|
| 613 |
+
154
|
| 614 |
+
00:10:32,000 --> 00:10:38,000
|
| 615 |
+
So here is the example how you can initialize your list with multiple elements in one line.
|
| 616 |
+
|
| 617 |
+
155
|
| 618 |
+
00:10:38,000 --> 00:10:44,000
|
| 619 |
+
For learning and debugging purposes, you always may pass list implementations to the println method,
|
| 620 |
+
|
| 621 |
+
156
|
| 622 |
+
00:10:44,000 --> 00:10:50,000
|
| 623 |
+
because all list implementations have to string method overridden to display elements in such way as
|
| 624 |
+
|
| 625 |
+
157
|
| 626 |
+
00:10:50,000 --> 00:10:52,000
|
| 627 |
+
you can see here in console.
|
| 628 |
+
|
| 629 |
+
158
|
| 630 |
+
00:10:52,000 --> 00:10:56,000
|
| 631 |
+
Also, another important and practical thing to share with you.
|
| 632 |
+
|
| 633 |
+
159
|
| 634 |
+
00:10:56,000 --> 00:11:00,000
|
| 635 |
+
All collection implementations can be used in for each loop.
|
| 636 |
+
|
| 637 |
+
160
|
| 638 |
+
00:11:00,000 --> 00:11:05,000
|
| 639 |
+
I believe that you remember that collection interface implements a terrible interface.
|
| 640 |
+
|
| 641 |
+
161
|
| 642 |
+
00:11:05,000 --> 00:11:12,000
|
| 643 |
+
This fact guarantees that each implementation of collection should have iterator method that will return
|
| 644 |
+
|
| 645 |
+
162
|
| 646 |
+
00:11:12,000 --> 00:11:17,000
|
| 647 |
+
iterator object that knows how to iterate over the collection of elements.
|
| 648 |
+
|
| 649 |
+
163
|
| 650 |
+
00:11:17,000 --> 00:11:22,000
|
| 651 |
+
That's why all collections can be used in for each loops according to Java syntax.
|
| 652 |
+
|
| 653 |
+
164
|
| 654 |
+
00:11:22,000 --> 00:11:24,000
|
| 655 |
+
And you can see example here.
|
| 656 |
+
|
| 657 |
+
165
|
| 658 |
+
00:11:24,000 --> 00:11:25,000
|
| 659 |
+
So now you.
|
| 660 |
+
|
| 661 |
+
166
|
| 662 |
+
00:11:25,000 --> 00:11:32,000
|
| 663 |
+
Member that all arrays and everything that implements iterable interface, even if this your own custom
|
| 664 |
+
|
| 665 |
+
167
|
| 666 |
+
00:11:32,000 --> 00:11:33,000
|
| 667 |
+
class may be used in.
|
| 668 |
+
|
| 669 |
+
168
|
| 670 |
+
00:11:33,000 --> 00:11:34,000
|
| 671 |
+
For rich loops.
|
| 672 |
+
|
| 673 |
+
169
|
| 674 |
+
00:11:35,000 --> 00:11:38,000
|
| 675 |
+
And here you can see example of clear method.
|
| 676 |
+
|
| 677 |
+
170
|
| 678 |
+
00:11:38,000 --> 00:11:42,000
|
| 679 |
+
What I would recommend is to play with other methods like I do here.
|
| 680 |
+
|
| 681 |
+
171
|
| 682 |
+
00:11:43,000 --> 00:11:47,000
|
| 683 |
+
Call clear method, call other methods and investigate console output.
|
| 684 |
+
|
| 685 |
+
172
|
| 686 |
+
00:11:47,000 --> 00:11:52,000
|
| 687 |
+
Writing code and calling different methods will help you to understand material better.
|
| 688 |
+
|
| 689 |
+
173
|
| 690 |
+
00:11:52,000 --> 00:11:57,000
|
| 691 |
+
And probably that would cause some questions and I will be always happy to answer those.
|
| 692 |
+
|
| 693 |
+
174
|
| 694 |
+
00:11:58,000 --> 00:12:04,000
|
| 695 |
+
Now, when you know how to use list implementations in Java source code, I suggest understanding what
|
| 696 |
+
|
| 697 |
+
175
|
| 698 |
+
00:12:04,000 --> 00:12:09,000
|
| 699 |
+
list implementations you have to use, in which particular case, and to make a choice, I'd like to
|
| 700 |
+
|
| 701 |
+
176
|
| 702 |
+
00:12:09,000 --> 00:12:12,000
|
| 703 |
+
explain you what big O notation is.
|
| 704 |
+
|
| 705 |
+
177
|
| 706 |
+
00:12:12,000 --> 00:12:18,000
|
| 707 |
+
Big O notation is a mathematical notation that describes the limiting behavior of a function when the
|
| 708 |
+
|
| 709 |
+
178
|
| 710 |
+
00:12:18,000 --> 00:12:21,000
|
| 711 |
+
argument tends towards a particular value or infinity.
|
| 712 |
+
|
| 713 |
+
179
|
| 714 |
+
00:12:21,000 --> 00:12:27,000
|
| 715 |
+
We are not going to do math in this course, but we need to understand big O notation while working
|
| 716 |
+
|
| 717 |
+
180
|
| 718 |
+
00:12:27,000 --> 00:12:31,000
|
| 719 |
+
with different implementations of collections in computer science.
|
| 720 |
+
|
| 721 |
+
181
|
| 722 |
+
00:12:31,000 --> 00:12:38,000
|
| 723 |
+
Big O notation is used to classify algorithms according to how they run time or space requirements grow
|
| 724 |
+
|
| 725 |
+
182
|
| 726 |
+
00:12:38,000 --> 00:12:40,000
|
| 727 |
+
as the input size grows.
|
| 728 |
+
|
| 729 |
+
183
|
| 730 |
+
00:12:40,000 --> 00:12:47,000
|
| 731 |
+
In very simple words, big O notation can tell us how efficient algorithm as number of elements that
|
| 732 |
+
|
| 733 |
+
184
|
| 734 |
+
00:12:47,000 --> 00:12:49,000
|
| 735 |
+
algorithm work with increases.
|
| 736 |
+
|
| 737 |
+
185
|
| 738 |
+
00:12:49,000 --> 00:12:52,000
|
| 739 |
+
We are going to use only few classes of functions.
|
| 740 |
+
|
| 741 |
+
186
|
| 742 |
+
00:12:53,000 --> 00:12:55,000
|
| 743 |
+
Let me explain you what they mean.
|
| 744 |
+
|
| 745 |
+
187
|
| 746 |
+
00:12:55,000 --> 00:12:58,000
|
| 747 |
+
Oh one that is constant.
|
| 748 |
+
|
| 749 |
+
188
|
| 750 |
+
00:12:58,000 --> 00:13:00,000
|
| 751 |
+
For example, get an element from array by.
|
| 752 |
+
|
| 753 |
+
189
|
| 754 |
+
00:13:00,000 --> 00:13:03,000
|
| 755 |
+
Its index is always constant.
|
| 756 |
+
|
| 757 |
+
190
|
| 758 |
+
00:13:04,000 --> 00:13:06,000
|
| 759 |
+
Oh n let us linear clause.
|
| 760 |
+
|
| 761 |
+
191
|
| 762 |
+
00:13:06,000 --> 00:13:12,000
|
| 763 |
+
That means that performance of the function directly depends on the number of elements.
|
| 764 |
+
|
| 765 |
+
192
|
| 766 |
+
00:13:12,000 --> 00:13:20,000
|
| 767 |
+
For example, function of finding element in unsorted array has o n notation because you have to check
|
| 768 |
+
|
| 769 |
+
193
|
| 770 |
+
00:13:20,000 --> 00:13:24,000
|
| 771 |
+
each element one by one to find the exactly one you need.
|
| 772 |
+
|
| 773 |
+
194
|
| 774 |
+
00:13:25,000 --> 00:13:30,000
|
| 775 |
+
This operation takes time, and the time will depend on the number of elements.
|
| 776 |
+
|
| 777 |
+
195
|
| 778 |
+
00:13:30,000 --> 00:13:32,000
|
| 779 |
+
Does it make sense now?
|
| 780 |
+
|
| 781 |
+
196
|
| 782 |
+
00:13:33,000 --> 00:13:33,000
|
| 783 |
+
Oh.
|
| 784 |
+
|
| 785 |
+
197
|
| 786 |
+
00:13:33,000 --> 00:13:34,000
|
| 787 |
+
Logarithm.
|
| 788 |
+
|
| 789 |
+
198
|
| 790 |
+
00:13:34,000 --> 00:13:41,000
|
| 791 |
+
N that is, logarithmic class function of finding element in binary tree has all log n notation.
|
| 792 |
+
|
| 793 |
+
199
|
| 794 |
+
00:13:42,000 --> 00:13:45,000
|
| 795 |
+
For example, imagine that you have sorted array of elements.
|
| 796 |
+
|
| 797 |
+
200
|
| 798 |
+
00:13:45,000 --> 00:13:51,000
|
| 799 |
+
If you are looking for specific value, you can predict in which part of the array it is most likely
|
| 800 |
+
|
| 801 |
+
201
|
| 802 |
+
00:13:51,000 --> 00:13:55,000
|
| 803 |
+
stored, and you shouldn't iterate exactly over each element.
|
| 804 |
+
|
| 805 |
+
202
|
| 806 |
+
00:13:55,000 --> 00:13:59,000
|
| 807 |
+
We are going to learn what binary trees are in the next lessons.
|
| 808 |
+
|
| 809 |
+
203
|
| 810 |
+
00:13:59,000 --> 00:14:05,000
|
| 811 |
+
Right now you can understand this as something what still depends on the number of elements, but the
|
| 812 |
+
|
| 813 |
+
204
|
| 814 |
+
00:14:05,000 --> 00:14:07,000
|
| 815 |
+
dependency is not linear.
|
| 816 |
+
|
| 817 |
+
205
|
| 818 |
+
00:14:08,000 --> 00:14:12,000
|
| 819 |
+
I try to say this as easy as possible without going deep in mathematic.
|
| 820 |
+
|
| 821 |
+
206
|
| 822 |
+
00:14:12,000 --> 00:14:16,000
|
| 823 |
+
Believe me when you will see this on practice, that would be much easier.
|
| 824 |
+
|
| 825 |
+
207
|
| 826 |
+
00:14:17,000 --> 00:14:22,000
|
| 827 |
+
Now I'd like to answer the question which implementation of list to use and when.
|
| 828 |
+
|
| 829 |
+
208
|
| 830 |
+
00:14:22,000 --> 00:14:27,000
|
| 831 |
+
The first thing you have to answer during the interview, in case you would be asked what would you
|
| 832 |
+
|
| 833 |
+
209
|
| 834 |
+
00:14:27,000 --> 00:14:27,000
|
| 835 |
+
use?
|
| 836 |
+
|
| 837 |
+
210
|
| 838 |
+
00:14:27,000 --> 00:14:29,000
|
| 839 |
+
Linked list or array list?
|
| 840 |
+
|
| 841 |
+
211
|
| 842 |
+
00:14:29,000 --> 00:14:31,000
|
| 843 |
+
You should ask in which environment we plan to use.
|
| 844 |
+
|
| 845 |
+
212
|
| 846 |
+
00:14:31,000 --> 00:14:37,000
|
| 847 |
+
List implementation and regarding amount of data to answer when to use which implementation.
|
| 848 |
+
|
| 849 |
+
213
|
| 850 |
+
00:14:37,000 --> 00:14:43,000
|
| 851 |
+
Let's review performance of each list implementation and based on this we will give an answer.
|
| 852 |
+
|
| 853 |
+
214
|
| 854 |
+
00:14:44,000 --> 00:14:48,000
|
| 855 |
+
Now let's compare big O notation of array list and linked list.
|
| 856 |
+
|
| 857 |
+
215
|
| 858 |
+
00:14:48,000 --> 00:14:53,000
|
| 859 |
+
Here on the slide you can see big O notation for different operations for array and linked lists.
|
| 860 |
+
|
| 861 |
+
216
|
| 862 |
+
00:14:54,000 --> 00:14:56,000
|
| 863 |
+
Let me go over each one.
|
| 864 |
+
|
| 865 |
+
217
|
| 866 |
+
00:14:56,000 --> 00:14:59,000
|
| 867 |
+
Get operation in array list is constant.
|
| 868 |
+
|
| 869 |
+
218
|
| 870 |
+
00:14:59,000 --> 00:15:06,000
|
| 871 |
+
That's why we see here all one notation when on the other hand get element from linked list has linear
|
| 872 |
+
|
| 873 |
+
219
|
| 874 |
+
00:15:06,000 --> 00:15:07,000
|
| 875 |
+
complexity.
|
| 876 |
+
|
| 877 |
+
220
|
| 878 |
+
00:15:07,000 --> 00:15:12,000
|
| 879 |
+
And I want you to not memorize big O notation, but understand it instead.
|
| 880 |
+
|
| 881 |
+
221
|
| 882 |
+
00:15:12,000 --> 00:15:18,000
|
| 883 |
+
Can you understand why retrieving elements from linked list is a linear function class?
|
| 884 |
+
|
| 885 |
+
222
|
| 886 |
+
00:15:18,000 --> 00:15:19,000
|
| 887 |
+
Correct.
|
| 888 |
+
|
| 889 |
+
223
|
| 890 |
+
00:15:19,000 --> 00:15:25,000
|
| 891 |
+
Because we have linked list without indices, and to get any specific element, we should iterate over
|
| 892 |
+
|
| 893 |
+
224
|
| 894 |
+
00:15:25,000 --> 00:15:29,000
|
| 895 |
+
each element unless we would reach exactly the one that we need.
|
| 896 |
+
|
| 897 |
+
225
|
| 898 |
+
00:15:30,000 --> 00:15:33,000
|
| 899 |
+
Linked list also defines from which side of the list to start.
|
| 900 |
+
|
| 901 |
+
226
|
| 902 |
+
00:15:33,000 --> 00:15:39,000
|
| 903 |
+
If index in the second half of the list, then iteration starts from the end of the list.
|
| 904 |
+
|
| 905 |
+
227
|
| 906 |
+
00:15:39,000 --> 00:15:44,000
|
| 907 |
+
In case index is in the first half of the list, then iteration starts from the beginning.
|
| 908 |
+
|
| 909 |
+
228
|
| 910 |
+
00:15:44,000 --> 00:15:45,000
|
| 911 |
+
Does it make sense?
|
| 912 |
+
|
| 913 |
+
229
|
| 914 |
+
00:15:46,000 --> 00:15:48,000
|
| 915 |
+
Okay, then let's move further.
|
| 916 |
+
|
| 917 |
+
230
|
| 918 |
+
00:15:49,000 --> 00:15:50,000
|
| 919 |
+
Add elements to the list.
|
| 920 |
+
|
| 921 |
+
231
|
| 922 |
+
00:15:50,000 --> 00:15:56,000
|
| 923 |
+
Array list adds always for constant amount of time, the same as linked list.
|
| 924 |
+
|
| 925 |
+
232
|
| 926 |
+
00:15:56,000 --> 00:15:58,000
|
| 927 |
+
I'd like to make a note here.
|
| 928 |
+
|
| 929 |
+
233
|
| 930 |
+
00:15:58,000 --> 00:16:02,000
|
| 931 |
+
This notation is from the book Java Generics and Collections by Philip Wadler.
|
| 932 |
+
|
| 933 |
+
234
|
| 934 |
+
00:16:03,000 --> 00:16:09,000
|
| 935 |
+
You may find it on the internet if you wish, and I want to say that this is an average value listed
|
| 936 |
+
|
| 937 |
+
235
|
| 938 |
+
00:16:09,000 --> 00:16:10,000
|
| 939 |
+
here.
|
| 940 |
+
|
| 941 |
+
236
|
| 942 |
+
00:16:10,000 --> 00:16:11,000
|
| 943 |
+
Why?
|
| 944 |
+
|
| 945 |
+
237
|
| 946 |
+
00:16:11,000 --> 00:16:16,000
|
| 947 |
+
Because adding elements to the end would take constant amount of time in both containers.
|
| 948 |
+
|
| 949 |
+
238
|
| 950 |
+
00:16:16,000 --> 00:16:20,000
|
| 951 |
+
But for array list, you already know one exception.
|
| 952 |
+
|
| 953 |
+
239
|
| 954 |
+
00:16:20,000 --> 00:16:26,000
|
| 955 |
+
That is the case when arrays inside the array list is expanded, and additional time is needed to copy
|
| 956 |
+
|
| 957 |
+
240
|
| 958 |
+
00:16:26,000 --> 00:16:28,000
|
| 959 |
+
all elements from all the way to the new array.
|
| 960 |
+
|
| 961 |
+
241
|
| 962 |
+
00:16:29,000 --> 00:16:31,000
|
| 963 |
+
Also, there is another note.
|
| 964 |
+
|
| 965 |
+
242
|
| 966 |
+
00:16:31,000 --> 00:16:36,000
|
| 967 |
+
Adding elements at the beginning or in the middle of a release would also trigger creation of the new
|
| 968 |
+
|
| 969 |
+
243
|
| 970 |
+
00:16:36,000 --> 00:16:39,000
|
| 971 |
+
array, and depends on the actual size of the array.
|
| 972 |
+
|
| 973 |
+
244
|
| 974 |
+
00:16:39,000 --> 00:16:43,000
|
| 975 |
+
This can take some time, even despite native methods written on C plus.
|
| 976 |
+
|
| 977 |
+
245
|
| 978 |
+
00:16:43,000 --> 00:16:50,000
|
| 979 |
+
Plus is used to copy an array and it works really fast on huge amount of data that may cause some performance
|
| 980 |
+
|
| 981 |
+
246
|
| 982 |
+
00:16:50,000 --> 00:16:51,000
|
| 983 |
+
issues.
|
| 984 |
+
|
| 985 |
+
247
|
| 986 |
+
00:16:51,000 --> 00:16:53,000
|
| 987 |
+
That is something what you have to remember.
|
| 988 |
+
|
| 989 |
+
248
|
| 990 |
+
00:16:53,000 --> 00:16:55,000
|
| 991 |
+
Let's move on.
|
| 992 |
+
|
| 993 |
+
249
|
| 994 |
+
00:16:55,000 --> 00:16:56,000
|
| 995 |
+
Remove operation.
|
| 996 |
+
|
| 997 |
+
250
|
| 998 |
+
00:16:56,000 --> 00:17:05,000
|
| 999 |
+
This algorithm in array list is linear, the same as in linked list, but in general it should work
|
| 1000 |
+
|
| 1001 |
+
251
|
| 1002 |
+
00:17:05,000 --> 00:17:13,000
|
| 1003 |
+
faster in linked list on huge amount of data because to remove element from the middle or beginning
|
| 1004 |
+
|
| 1005 |
+
252
|
| 1006 |
+
00:17:13,000 --> 00:17:16,000
|
| 1007 |
+
of the array list, we have to find the element first.
|
| 1008 |
+
|
| 1009 |
+
253
|
| 1010 |
+
00:17:16,000 --> 00:17:20,000
|
| 1011 |
+
And the more elements, the more time it would take to find it.
|
| 1012 |
+
|
| 1013 |
+
254
|
| 1014 |
+
00:17:20,000 --> 00:17:28,000
|
| 1015 |
+
And then after removing it from an array, we need to merge two parts of array to not have empty element
|
| 1016 |
+
|
| 1017 |
+
255
|
| 1018 |
+
00:17:28,000 --> 00:17:30,000
|
| 1019 |
+
inside the array.
|
| 1020 |
+
|
| 1021 |
+
256
|
| 1022 |
+
00:17:30,000 --> 00:17:32,000
|
| 1023 |
+
So we need to copy array.
|
| 1024 |
+
|
| 1025 |
+
257
|
| 1026 |
+
00:17:32,000 --> 00:17:39,000
|
| 1027 |
+
And again, the time that it will take will depend on the number of elements with linked list.
|
| 1028 |
+
|
| 1029 |
+
258
|
| 1030 |
+
00:17:39,000 --> 00:17:42,000
|
| 1031 |
+
We need to spend time to find the element.
|
| 1032 |
+
|
| 1033 |
+
259
|
| 1034 |
+
00:17:42,000 --> 00:17:45,000
|
| 1035 |
+
The more elements, the longer it would take.
|
| 1036 |
+
|
| 1037 |
+
260
|
| 1038 |
+
00:17:45,000 --> 00:17:51,000
|
| 1039 |
+
And when we found the element, we don't need to copy all the data structure to merge it back again.
|
| 1040 |
+
|
| 1041 |
+
261
|
| 1042 |
+
00:17:52,000 --> 00:17:54,000
|
| 1043 |
+
Because this is not an array.
|
| 1044 |
+
|
| 1045 |
+
262
|
| 1046 |
+
00:17:54,000 --> 00:17:55,000
|
| 1047 |
+
This is a linked list.
|
| 1048 |
+
|
| 1049 |
+
263
|
| 1050 |
+
00:17:55,000 --> 00:18:01,000
|
| 1051 |
+
So we have to only change the references to the next and previous elements.
|
| 1052 |
+
|
| 1053 |
+
264
|
| 1054 |
+
00:18:01,000 --> 00:18:07,000
|
| 1055 |
+
Even despite the summary of big O notation between ArrayList and Linkedlist looks similar.
|
| 1056 |
+
|
| 1057 |
+
265
|
| 1058 |
+
00:18:07,000 --> 00:18:11,000
|
| 1059 |
+
They would have different performance on different volumes of data.
|
| 1060 |
+
|
| 1061 |
+
266
|
| 1062 |
+
00:18:11,000 --> 00:18:17,000
|
| 1063 |
+
That's why understanding how they work is essential to understand their performance.
|
| 1064 |
+
|
| 1065 |
+
267
|
| 1066 |
+
00:18:17,000 --> 00:18:23,000
|
| 1067 |
+
You are going to have a homework to find out the difference in performance on different volumes of data.
|
| 1068 |
+
|
| 1069 |
+
268
|
| 1070 |
+
00:18:23,000 --> 00:18:26,000
|
| 1071 |
+
Now let's make a conclusion based on these facts.
|
| 1072 |
+
|
| 1073 |
+
269
|
| 1074 |
+
00:18:26,000 --> 00:18:32,000
|
| 1075 |
+
We have to use linked list when we plan constantly add elements at the beginning or at the end of the
|
| 1076 |
+
|
| 1077 |
+
270
|
| 1078 |
+
00:18:32,000 --> 00:18:32,000
|
| 1079 |
+
list.
|
| 1080 |
+
|
| 1081 |
+
271
|
| 1082 |
+
00:18:33,000 --> 00:18:38,000
|
| 1083 |
+
We also should opt for link list when we want to remove elements constantly from the beginning of the
|
| 1084 |
+
|
| 1085 |
+
272
|
| 1086 |
+
00:18:38,000 --> 00:18:39,000
|
| 1087 |
+
list.
|
| 1088 |
+
|
| 1089 |
+
273
|
| 1090 |
+
00:18:39,000 --> 00:18:45,000
|
| 1091 |
+
If we plan to use container to always add elements to the end and read elements from the list, then
|
| 1092 |
+
|
| 1093 |
+
274
|
| 1094 |
+
00:18:45,000 --> 00:18:47,000
|
| 1095 |
+
array list is our choice.
|
| 1096 |
+
|
| 1097 |
+
275
|
| 1098 |
+
00:18:47,000 --> 00:18:54,000
|
| 1099 |
+
But I told you that algorithm of array copying works really fast, and everything will depend on the
|
| 1100 |
+
|
| 1101 |
+
276
|
| 1102 |
+
00:18:54,000 --> 00:18:56,000
|
| 1103 |
+
amount of data that we are working with.
|
| 1104 |
+
|
| 1105 |
+
277
|
| 1106 |
+
00:18:56,000 --> 00:19:02,000
|
| 1107 |
+
I'm going to give you a home task where you would be able to test whether linked list really has advantage
|
| 1108 |
+
|
| 1109 |
+
278
|
| 1110 |
+
00:19:02,000 --> 00:19:05,000
|
| 1111 |
+
over array list while working with not so big amount of data.
|
| 1112 |
+
|
| 1113 |
+
279
|
| 1114 |
+
00:19:06,000 --> 00:19:09,000
|
| 1115 |
+
But I will give you insights even before you finish that task.
|
| 1116 |
+
|
| 1117 |
+
280
|
| 1118 |
+
00:19:09,000 --> 00:19:15,000
|
| 1119 |
+
In majority of cases, even during the work with 1 million of elements that are relatively small objects.
|
| 1120 |
+
|
| 1121 |
+
281
|
| 1122 |
+
00:19:15,000 --> 00:19:19,000
|
| 1123 |
+
Array list still is going to be faster than linked list.
|
| 1124 |
+
|
| 1125 |
+
282
|
| 1126 |
+
00:19:20,000 --> 00:19:26,000
|
| 1127 |
+
And with regards of the business cases, I would say that array list is your choice almost in 99% of
|
| 1128 |
+
|
| 1129 |
+
283
|
| 1130 |
+
00:19:26,000 --> 00:19:27,000
|
| 1131 |
+
cases.
|
| 1132 |
+
|
| 1133 |
+
284
|
| 1134 |
+
00:19:27,000 --> 00:19:32,000
|
| 1135 |
+
The rest of the cases are when you need either threadsafe container, or you have millions of objects
|
| 1136 |
+
|
| 1137 |
+
285
|
| 1138 |
+
00:19:32,000 --> 00:19:36,000
|
| 1139 |
+
that you need to add in the beginning of the list and constantly remove them.
|
| 1140 |
+
|
| 1141 |
+
286
|
| 1142 |
+
00:19:37,000 --> 00:19:42,000
|
| 1143 |
+
I believe you would agree with me that it is even hard to come up with example here of such case.
|
| 1144 |
+
|
| 1145 |
+
287
|
| 1146 |
+
00:19:42,000 --> 00:19:47,000
|
| 1147 |
+
Time for linked list will come when we will talk about queues, will discover that linked list works
|
| 1148 |
+
|
| 1149 |
+
288
|
| 1150 |
+
00:19:47,000 --> 00:19:51,000
|
| 1151 |
+
the best for us if we need implementation of queue or deck.
|
| 1152 |
+
|
| 1153 |
+
289
|
| 1154 |
+
00:19:52,000 --> 00:19:54,000
|
| 1155 |
+
Now let's recap what we have learned today.
|
| 1156 |
+
|
| 1157 |
+
290
|
| 1158 |
+
00:19:55,000 --> 00:19:57,000
|
| 1159 |
+
Today we learned how linked list works.
|
| 1160 |
+
|
| 1161 |
+
291
|
| 1162 |
+
00:19:57,000 --> 00:20:03,000
|
| 1163 |
+
Now we know what the node type is and how nodes are connected between each other in linked list.
|
| 1164 |
+
|
| 1165 |
+
292
|
| 1166 |
+
00:20:04,000 --> 00:20:07,000
|
| 1167 |
+
We had a practice with link list and array list.
|
| 1168 |
+
|
| 1169 |
+
293
|
| 1170 |
+
00:20:07,000 --> 00:20:10,000
|
| 1171 |
+
Now you even know how to use generics.
|
| 1172 |
+
|
| 1173 |
+
294
|
| 1174 |
+
00:20:10,000 --> 00:20:16,000
|
| 1175 |
+
We learned what big O notation is and using this knowledge we compared link list and array lists.
|
| 1176 |
+
|
| 1177 |
+
295
|
| 1178 |
+
00:20:16,000 --> 00:20:21,000
|
| 1179 |
+
Now you know, in which case you have to opt for either array list or link list.
|
| 1180 |
+
|
| 1181 |
+
296
|
| 1182 |
+
00:20:21,000 --> 00:20:24,000
|
| 1183 |
+
And now I suggest reviewing your homework.
|
| 1184 |
+
|
| 1185 |
+
297
|
| 1186 |
+
00:20:25,000 --> 00:20:27,000
|
| 1187 |
+
I have a lot of tasks for you today.
|
| 1188 |
+
|
| 1189 |
+
298
|
| 1190 |
+
00:20:27,000 --> 00:20:31,000
|
| 1191 |
+
All of them have different level of complexity, but nothing what we didn't discuss.
|
| 1192 |
+
|
| 1193 |
+
299
|
| 1194 |
+
00:20:31,000 --> 00:20:37,000
|
| 1195 |
+
So the first exercise is to test and compare the performance of array list and linked list.
|
| 1196 |
+
|
| 1197 |
+
300
|
| 1198 |
+
00:20:37,000 --> 00:20:42,000
|
| 1199 |
+
It is not complex from the coding standpoint, but it is also good for you to practice with creating
|
| 1200 |
+
|
| 1201 |
+
301
|
| 1202 |
+
00:20:42,000 --> 00:20:48,000
|
| 1203 |
+
objects of different types, declare variables and to remember, in which case you have to use which
|
| 1204 |
+
|
| 1205 |
+
302
|
| 1206 |
+
00:20:48,000 --> 00:20:49,000
|
| 1207 |
+
container.
|
| 1208 |
+
|
| 1209 |
+
303
|
| 1210 |
+
00:20:49,000 --> 00:20:54,000
|
| 1211 |
+
Here is a guidance what methods should be created and methods declarations.
|
| 1212 |
+
|
| 1213 |
+
304
|
| 1214 |
+
00:20:54,000 --> 00:20:57,000
|
| 1215 |
+
And here operations that I'd like you to test.
|
| 1216 |
+
|
| 1217 |
+
305
|
| 1218 |
+
00:20:57,000 --> 00:21:02,000
|
| 1219 |
+
We are going to insert different number of elements into the beginning, middle and at the end of the
|
| 1220 |
+
|
| 1221 |
+
306
|
| 1222 |
+
00:21:02,000 --> 00:21:03,000
|
| 1223 |
+
list.
|
| 1224 |
+
|
| 1225 |
+
307
|
| 1226 |
+
00:21:03,000 --> 00:21:09,000
|
| 1227 |
+
We'll test these operations with 110,000 and 1100 elements.
|
| 1228 |
+
|
| 1229 |
+
308
|
| 1230 |
+
00:21:09,000 --> 00:21:14,000
|
| 1231 |
+
Also, we will test removal of elements from the beginning, middle and the end of the list.
|
| 1232 |
+
|
| 1233 |
+
309
|
| 1234 |
+
00:21:14,000 --> 00:21:18,000
|
| 1235 |
+
We'll perform the same operations with array list and linked list.
|
| 1236 |
+
|
| 1237 |
+
310
|
| 1238 |
+
00:21:18,000 --> 00:21:23,000
|
| 1239 |
+
And we'll measure how much time execution of specific method takes with array list and specific number
|
| 1240 |
+
|
| 1241 |
+
311
|
| 1242 |
+
00:21:23,000 --> 00:21:25,000
|
| 1243 |
+
of elements and linked list.
|
| 1244 |
+
|
| 1245 |
+
312
|
| 1246 |
+
00:21:26,000 --> 00:21:30,000
|
| 1247 |
+
After you're done with coding, I want you to fill out these tables.
|
| 1248 |
+
|
| 1249 |
+
313
|
| 1250 |
+
00:21:30,000 --> 00:21:36,000
|
| 1251 |
+
You may see that these tables have different rows and columns based on which list implementation you
|
| 1252 |
+
|
| 1253 |
+
314
|
| 1254 |
+
00:21:36,000 --> 00:21:38,000
|
| 1255 |
+
used and what operation you did.
|
| 1256 |
+
|
| 1257 |
+
315
|
| 1258 |
+
00:21:38,000 --> 00:21:43,000
|
| 1259 |
+
If you are wondering how you can measure the time of method execution, here is a small hint for you.
|
| 1260 |
+
|
| 1261 |
+
316
|
| 1262 |
+
00:21:43,000 --> 00:21:47,000
|
| 1263 |
+
You can capture time before some method execution.
|
| 1264 |
+
|
| 1265 |
+
317
|
| 1266 |
+
00:21:47,000 --> 00:21:52,000
|
| 1267 |
+
After that call some method and after that calculate delta this value.
|
| 1268 |
+
|
| 1269 |
+
318
|
| 1270 |
+
00:21:52,000 --> 00:21:58,000
|
| 1271 |
+
You can insert into the table after you finished, you may compare your results with my results and
|
| 1272 |
+
|
| 1273 |
+
319
|
| 1274 |
+
00:21:58,000 --> 00:22:00,000
|
| 1275 |
+
to evaluate the trends.
|
| 1276 |
+
|
| 1277 |
+
320
|
| 1278 |
+
00:22:00,000 --> 00:22:06,000
|
| 1279 |
+
I don't want to make any conclusions right now, primarily because some of them were already discussed
|
| 1280 |
+
|
| 1281 |
+
321
|
| 1282 |
+
00:22:06,000 --> 00:22:07,000
|
| 1283 |
+
during the lesson.
|
| 1284 |
+
|
| 1285 |
+
322
|
| 1286 |
+
00:22:07,000 --> 00:22:11,000
|
| 1287 |
+
And the other reason is that I want you to draw your own conclusions.
|
| 1288 |
+
|
| 1289 |
+
323
|
| 1290 |
+
00:22:12,000 --> 00:22:17,000
|
| 1291 |
+
The second exercise here is to update existing backend system for online store.
|
| 1292 |
+
|
| 1293 |
+
324
|
| 1294 |
+
00:22:17,000 --> 00:22:22,000
|
| 1295 |
+
It is a console application and you may find it in this repository in this package.
|
| 1296 |
+
|
| 1297 |
+
325
|
| 1298 |
+
00:22:22,000 --> 00:22:24,000
|
| 1299 |
+
This solution uses arrays.
|
| 1300 |
+
|
| 1301 |
+
326
|
| 1302 |
+
00:22:24,000 --> 00:22:28,000
|
| 1303 |
+
Your task is to substitute arrays with list implementations.
|
| 1304 |
+
|
| 1305 |
+
327
|
| 1306 |
+
00:22:28,000 --> 00:22:30,000
|
| 1307 |
+
You are provided with a sample project.
|
| 1308 |
+
|
| 1309 |
+
328
|
| 1310 |
+
00:22:30,000 --> 00:22:31,000
|
| 1311 |
+
Here.
|
| 1312 |
+
|
| 1313 |
+
329
|
| 1314 |
+
00:22:31,000 --> 00:22:36,000
|
| 1315 |
+
Your goal is not to break anything and to make sure that all scenarios work as expected.
|
| 1316 |
+
|
| 1317 |
+
330
|
| 1318 |
+
00:22:37,000 --> 00:22:42,000
|
| 1319 |
+
This task should give you a clear understanding of how you are going to use list implementations in
|
| 1320 |
+
|
| 1321 |
+
331
|
| 1322 |
+
00:22:42,000 --> 00:22:43,000
|
| 1323 |
+
your applications.
|
| 1324 |
+
|
| 1325 |
+
332
|
| 1326 |
+
00:22:43,000 --> 00:22:49,000
|
| 1327 |
+
And the last but not the least task is to create your own implementation of custom list interface.
|
| 1328 |
+
|
| 1329 |
+
333
|
| 1330 |
+
00:22:49,000 --> 00:22:54,000
|
| 1331 |
+
You have to create interface first with such content, and after that you have to create class.
|
| 1332 |
+
|
| 1333 |
+
334
|
| 1334 |
+
00:22:54,000 --> 00:22:57,000
|
| 1335 |
+
And to implement this interface in it.
|
| 1336 |
+
|
| 1337 |
+
335
|
| 1338 |
+
00:22:57,000 --> 00:22:58,000
|
| 1339 |
+
Team.
|
| 1340 |
+
|
| 1341 |
+
336
|
| 1342 |
+
00:22:58,000 --> 00:23:04,000
|
| 1343 |
+
I promise you in case you would implement these three exercises, you would understand list implementations
|
| 1344 |
+
|
| 1345 |
+
337
|
| 1346 |
+
00:23:04,000 --> 00:23:05,000
|
| 1347 |
+
like nobody else.
|
| 1348 |
+
|
| 1349 |
+
338
|
| 1350 |
+
00:23:05,000 --> 00:23:07,000
|
| 1351 |
+
Remember learning programming?
|
| 1352 |
+
|
| 1353 |
+
339
|
| 1354 |
+
00:23:07,000 --> 00:23:13,000
|
| 1355 |
+
It is about coding and a little bit about reading, but definitely not vice versa.
|
| 1356 |
+
|
| 1357 |
+
340
|
| 1358 |
+
00:23:13,000 --> 00:23:18,000
|
| 1359 |
+
And by the way, you also shouldn't worry in case something is hard for you to implement.
|
| 1360 |
+
|
| 1361 |
+
341
|
| 1362 |
+
00:23:18,000 --> 00:23:20,000
|
| 1363 |
+
We are all learning new things here.
|
| 1364 |
+
|
| 1365 |
+
342
|
| 1366 |
+
00:23:20,000 --> 00:23:24,000
|
| 1367 |
+
I'm going to leave links to the solution in attachments to this video.
|
| 1368 |
+
|
| 1369 |
+
343
|
| 1370 |
+
00:23:24,000 --> 00:23:31,000
|
| 1371 |
+
So even in case you can't complete some of the tasks, feel free to look through my solution and rewrite
|
| 1372 |
+
|
| 1373 |
+
344
|
| 1374 |
+
00:23:31,000 --> 00:23:36,000
|
| 1375 |
+
it very attentively and always ask me questions in case you have any.
|
| 1376 |
+
|
| 1377 |
+
345
|
| 1378 |
+
00:23:36,000 --> 00:23:38,000
|
| 1379 |
+
That's all for today.
|
| 1380 |
+
|
| 1381 |
+
346
|
| 1382 |
+
00:23:38,000 --> 00:23:40,000
|
| 1383 |
+
Thanks a lot for your attention and have a great day.
|
| 1384 |
+
|
| 1385 |
+
347
|
| 1386 |
+
00:23:40,000 --> 00:23:42,000
|
| 1387 |
+
See you in the next lesson.
|
| 1388 |
+
|
19 - Java Collections Framework/005 Solution-for-DefaultMyList-coding-exercise.url
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[InternetShortcut]
|
| 2 |
+
URL=https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/collections/list/hw/DefaultMyList.java
|
19 - Java Collections Framework/005 Solution-of-the-homework-Backend-system-for-online-store-with-list.url
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[InternetShortcut]
|
| 2 |
+
URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/hw/onlinestore/withlist
|
19 - Java Collections Framework/005 Solution-of-the-homework-DefaultList-and-Performance-of-ArrayList-vs-LinkedList.url
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[InternetShortcut]
|
| 2 |
+
URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/collections/list/hw
|
19 - Java Collections Framework/005 Source-code-of-the-example-used-in-the-lesso.url
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[InternetShortcut]
|
| 2 |
+
URL=https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/collections/list/ListDemo.java
|
19 - Java Collections Framework/005 Template-project-for-your-homework.url
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[InternetShortcut]
|
| 2 |
+
URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/hw/onlinestore/withoutlist
|
19 - Java Collections Framework/008 Comparator and Comparable_en.srt
ADDED
|
@@ -0,0 +1,912 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1
|
| 2 |
+
00:00:06,000 --> 00:00:11,000
|
| 3 |
+
Hello, dear students and this class, and we are going to learn what comparator Uncomparable is, we'll
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:11,000 --> 00:00:17,000
|
| 7 |
+
review these two interfaces and we'll answer when we have to use them after the lesson and you'll understand
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:17,000 --> 00:00:21,000
|
| 11 |
+
the difference between them and will never confuse these two interfaces.
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:22,000 --> 00:00:27,000
|
| 15 |
+
Today on Real Example, I'm going to show you how you can search your collection of elements.
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:27,000 --> 00:00:31,000
|
| 19 |
+
We're also going to learn what the quicksort algorithm is.
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:31,000 --> 00:00:32,000
|
| 23 |
+
Let's start.
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:32,000 --> 00:00:38,000
|
| 27 |
+
And today, the best way to learn the topic is to jump directly to the eclipse and investigate the source
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:38,000 --> 00:00:38,000
|
| 31 |
+
code.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:39,000 --> 00:00:44,000
|
| 35 |
+
We are going to start our lesson today from the interface over you compare.
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:44,000 --> 00:00:49,000
|
| 39 |
+
The interface has only one abstract method that you have to implement in your own implementation.
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:50,000 --> 00:00:52,000
|
| 43 |
+
The method name is compare.
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:52,000 --> 00:00:55,000
|
| 47 |
+
This method takes two methods arguments.
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:55,000 --> 00:01:00,000
|
| 51 |
+
This may be different reference types, as you can see here, but they should be the same.
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:01:00,000 --> 00:01:06,000
|
| 55 |
+
This method, according to the interface contracts, should compare to objects and tell us what objects
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:01:06,000 --> 00:01:08,000
|
| 59 |
+
should go before the other one.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:01:08,000 --> 00:01:10,000
|
| 63 |
+
How it can tell us this.
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:10,000 --> 00:01:12,000
|
| 67 |
+
My return in value.
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:12,000 --> 00:01:19,000
|
| 71 |
+
Everything is simple here in case the first argument is less than the second one negative integer is
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:19,000 --> 00:01:20,000
|
| 75 |
+
returned.
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:20,000 --> 00:01:27,000
|
| 79 |
+
In case the first argument is equal to the second argument, then zero is returned and only in case
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:27,000 --> 00:01:29,000
|
| 83 |
+
the first argument is more than the second one.
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:30,000 --> 00:01:36,000
|
| 87 |
+
In this case, positive integer is returned and this function is enough to source all elements in your
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:36,000 --> 00:01:38,000
|
| 91 |
+
collection, according to the quicksort algorithm.
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:39,000 --> 00:01:43,000
|
| 95 |
+
And a bit later today, we're going to learn how quicksort algorithm works.
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:44,000 --> 00:01:50,000
|
| 99 |
+
Right now, let's investigate what else we have here in the comparator interface we have here.
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:50,000 --> 00:01:56,000
|
| 103 |
+
Absaroka equals method, but it will have implementation in any class because each class is extended
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:56,000 --> 00:01:57,000
|
| 107 |
+
from object and object.
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:57,000 --> 00:02:00,000
|
| 111 |
+
Class has implementation of equals method.
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:02:01,000 --> 00:02:05,000
|
| 115 |
+
That's Y equals usually is not overridden in comparative implementations.
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:02:06,000 --> 00:02:11,000
|
| 119 |
+
Now I want to share with you information how you can quickly get comparator for natural and inverse
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:11,000 --> 00:02:12,000
|
| 123 |
+
ordering.
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:12,000 --> 00:02:18,000
|
| 127 |
+
Here is a reverse order method IT comparator that source items in reverse order.
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:19,000 --> 00:02:22,000
|
| 131 |
+
But what is reverse order to explain this?
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:22,000 --> 00:02:23,000
|
| 135 |
+
Let me open them up.
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:23,000 --> 00:02:26,000
|
| 139 |
+
Programs that I prepared specially for this lesson.
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:27,000 --> 00:02:30,000
|
| 143 |
+
Let me also run it to explore console output together with you.
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:31,000 --> 00:02:33,000
|
| 147 |
+
Imagine that we have a list of integers.
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:34,000 --> 00:02:38,000
|
| 151 |
+
We have one fifteen to thirty seven and one hundred.
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:38,000 --> 00:02:45,000
|
| 155 |
+
And it is obvious for us what the natural order of these numbers is the same as it is easy for us to
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:45,000 --> 00:02:47,000
|
| 159 |
+
understand what a reverse order is.
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:48,000 --> 00:02:53,000
|
| 163 |
+
Each list has certain methods that takes object of comparison type as an argument.
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:02:53,000 --> 00:02:59,000
|
| 167 |
+
Let's call short method for our list and reverse order comparator into this method.
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:02:59,000 --> 00:03:05,000
|
| 171 |
+
And after we printed the console, the same collection, we noticed that our collection becomes sorted
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:03:05,000 --> 00:03:06,000
|
| 175 |
+
in the reverse order.
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:06,000 --> 00:03:10,000
|
| 179 |
+
But the things that are obvious for us are not obvious for the machines.
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:11,000 --> 00:03:16,000
|
| 183 |
+
I believe you understand that for Java it is not obvious by default how to sort numbers.
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:17,000 --> 00:03:23,000
|
| 187 |
+
There should be some code written that would tell Java to sort our collection exactly in this way.
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:23,000 --> 00:03:27,000
|
| 191 |
+
So let's understand how to describe logic of natural ordering.
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:27,000 --> 00:03:34,000
|
| 195 |
+
To explain this, let me open integer type and here we can see that integer implements comparable interface.
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:35,000 --> 00:03:36,000
|
| 199 |
+
What is this?
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:36,000 --> 00:03:37,000
|
| 203 |
+
Let me open this one.
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:38,000 --> 00:03:44,000
|
| 207 |
+
Comparable interface declares the contract only for one method that is compared to method.
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:45,000 --> 00:03:50,000
|
| 211 |
+
It takes another object as a method argument and can compare this.
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:50,000 --> 00:03:54,000
|
| 215 |
+
The current object with the object that was passed into the method.
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:54,000 --> 00:03:59,000
|
| 219 |
+
And you already can see the difference between compare and compare to methods.
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:59,000 --> 00:04:07,000
|
| 223 |
+
Compare method takes two arguments compared to takes one argument in more simple words compared the
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:04:07,000 --> 00:04:09,000
|
| 227 |
+
interface tells us something like this.
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:04:10,000 --> 00:04:15,000
|
| 231 |
+
Give me two elements and I will tell you which one is greater than the other one.
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:04:15,000 --> 00:04:18,000
|
| 235 |
+
Whereas comparable interface tells us something like this.
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:04:19,000 --> 00:04:25,000
|
| 239 |
+
Give me an element and I will tell you if it is greater than me, can you feel the difference?
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:25,000 --> 00:04:32,000
|
| 243 |
+
Usually comparable interface is implemented by types when we expect that objects of this type will be
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:32,000 --> 00:04:39,000
|
| 247 |
+
sorted in containers like we have with the integer type creator of integer class for assorted objects
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:39,000 --> 00:04:44,000
|
| 251 |
+
of this type will be compared between each other a lot of times in the future.
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:44,000 --> 00:04:46,000
|
| 255 |
+
Let me open integer class again.
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:47,000 --> 00:04:50,000
|
| 259 |
+
Let me show you how compared to Method is implemented here.
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:50,000 --> 00:04:54,000
|
| 263 |
+
You can see the internal method compare is called here.
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:54,000 --> 00:05:01,000
|
| 267 |
+
We possess a current value of the integer object because integer object has value variable and we also
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:05:01,000 --> 00:05:02,000
|
| 271 |
+
pass into value of another.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:05:03,000 --> 00:05:10,000
|
| 275 |
+
Integer, let me open this campaign method and here we can see that in case the first argument that
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:05:10,000 --> 00:05:17,000
|
| 279 |
+
is X is less than the second argument, that is Y, Z, we return to negative integer minus one.
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:05:17,000 --> 00:05:25,000
|
| 283 |
+
And in case the statement is false, we check if X and Y are equal and is equal, we return zero.
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:05:25,000 --> 00:05:31,000
|
| 287 |
+
And if no, that means X is greater than Y and we are to return positive integer.
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:05:32,000 --> 00:05:33,000
|
| 291 |
+
That is one.
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:05:33,000 --> 00:05:39,000
|
| 295 |
+
To be honest, I still don't know why developers adjudicate decided to write so many texts here.
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:05:39,000 --> 00:05:46,000
|
| 299 |
+
Imagine that in case you have two integers and you need to compare them just right here, X minus Y
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:46,000 --> 00:05:47,000
|
| 303 |
+
and that's it.
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:47,000 --> 00:05:55,000
|
| 307 |
+
In case X is lower than why we would get negative number in case the equal will get zero, in case X
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:55,000 --> 00:05:58,000
|
| 311 |
+
is greater than Y will get positive integer.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:59,000 --> 00:06:03,000
|
| 315 |
+
Sometimes guys from Oracle overcomplicating the things really.
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:06:03,000 --> 00:06:09,000
|
| 319 |
+
But as true professionals, we have to understand this and respect their solutions according to the
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:06:09,000 --> 00:06:13,000
|
| 323 |
+
contract, compared to also returns in value to certain elements.
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:06:14,000 --> 00:06:19,000
|
| 327 |
+
The way how compared to method is implemented in the type is called natural order.
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:06:20,000 --> 00:06:26,000
|
| 331 |
+
So I believe now you understand how Java made the reverse competitor to this required just one positive
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:06:26,000 --> 00:06:30,000
|
| 335 |
+
result of this method into the negative and vice versa.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:06:30,000 --> 00:06:32,000
|
| 339 |
+
Let's get back to our example.
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:06:32,000 --> 00:06:38,000
|
| 343 |
+
Now, imagine that we want to search elements in natural order in the computer interface.
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:06:38,000 --> 00:06:42,000
|
| 347 |
+
There is also another default method was in the natural order.
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:06:42,000 --> 00:06:45,000
|
| 351 |
+
It looks like that is exactly what we need.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:06:45,000 --> 00:06:51,000
|
| 355 |
+
You already know what natural order is and you can understand how numbers in our list will be sorted.
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:06:52,000 --> 00:06:57,000
|
| 359 |
+
Things are pretty straightforward with the list of integers, but what will happen with our list of
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:57,000 --> 00:06:58,000
|
| 363 |
+
products here?
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:58,000 --> 00:07:03,000
|
| 367 |
+
I credit list that contains all products from our online store application.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:07:03,000 --> 00:07:06,000
|
| 371 |
+
In case you skipped homework, I will explain you.
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:07:07,000 --> 00:07:09,000
|
| 375 |
+
We created our own service.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:07:09,000 --> 00:07:14,000
|
| 379 |
+
That is the default product management service that implements Singleton parkrun and can be created
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:07:14,000 --> 00:07:15,000
|
| 383 |
+
only in single copy.
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:07:16,000 --> 00:07:18,000
|
| 387 |
+
That's why we call that instance method here.
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:07:18,000 --> 00:07:21,000
|
| 391 |
+
This class contains all products for our app.
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:07:22,000 --> 00:07:26,000
|
| 395 |
+
Products are described with the help of another custom type product type.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:07:27,000 --> 00:07:29,000
|
| 399 |
+
If you want, you can explore this class in the details.
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:07:29,000 --> 00:07:32,000
|
| 403 |
+
Don't worry, I will leave a link to this class.
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:07:32,000 --> 00:07:38,000
|
| 407 |
+
It is still located in our training project that I am sure you already clone from the GitHub.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:07:39,000 --> 00:07:43,000
|
| 411 |
+
So when we fetched all products, we bring them to the console.
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:07:43,000 --> 00:07:45,000
|
| 415 |
+
Each product from the new line.
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:45,000 --> 00:07:47,000
|
| 419 |
+
I created custom method for that.
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:48,000 --> 00:07:50,000
|
| 423 |
+
Nothing special just for each loop.
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:50,000 --> 00:07:51,000
|
| 427 |
+
That's it.
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:52,000 --> 00:07:55,000
|
| 431 |
+
Please don't pay attention to this wild card in the master signature.
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:56,000 --> 00:07:58,000
|
| 435 |
+
We will talk about that when we return.
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:58,000 --> 00:07:59,000
|
| 439 |
+
Generics topic.
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:07:59,000 --> 00:08:03,000
|
| 443 |
+
What happens when we try to source products in natural order?
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:08:03,000 --> 00:08:05,000
|
| 447 |
+
We see a compilation error.
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:08:05,000 --> 00:08:06,000
|
| 451 |
+
Why?
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:08:06,000 --> 00:08:10,000
|
| 455 |
+
Because our custom product type does not implement comparable interface.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:08:11,000 --> 00:08:14,000
|
| 459 |
+
So what we have to do now, we have two options.
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:08:14,000 --> 00:08:19,000
|
| 463 |
+
Either we have to implement comparable interface and our product type or we have to implement our own
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:08:19,000 --> 00:08:20,000
|
| 467 |
+
comparator.
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:08:20,000 --> 00:08:23,000
|
| 471 |
+
That would contain the logic to compare elements.
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:08:23,000 --> 00:08:27,000
|
| 475 |
+
Let me show you all these options to save the time.
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:08:27,000 --> 00:08:33,000
|
| 479 |
+
During the video lesson, I created a product type that implements comparable interface and by default
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:33,000 --> 00:08:34,000
|
| 483 |
+
we source products by idee.
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:35,000 --> 00:08:42,000
|
| 487 |
+
To implement comparable interface, I added one more interface here after implements keyboards, you're
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:42,000 --> 00:08:44,000
|
| 491 |
+
already familiar how to use generics.
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:44,000 --> 00:08:46,000
|
| 495 |
+
Wasleys she has a similar thing.
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:08:47,000 --> 00:08:53,000
|
| 499 |
+
I specify product type here in Diamond Operator to tell that our comparable implementation should compare
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:08:53,000 --> 00:08:54,000
|
| 503 |
+
product type.
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:08:54,000 --> 00:09:01,000
|
| 507 |
+
The generic usage allows me to get product type in parameters here in compared to method instead of
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:09:01,000 --> 00:09:04,000
|
| 511 |
+
pure object and Tussaud elements by.
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:09:04,000 --> 00:09:06,000
|
| 515 |
+
I just perform subtraction here.
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:09:06,000 --> 00:09:12,000
|
| 519 |
+
We already reviewed on previous examples in which cases I return positive, negative or zero here.
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:09:13,000 --> 00:09:19,000
|
| 523 |
+
That's why I suggest moving further now when we have comparable product, let's create a few objects
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:09:19,000 --> 00:09:22,000
|
| 527 |
+
of comparable product type and add them to the list.
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:09:23,000 --> 00:09:28,000
|
| 531 |
+
In the real app, probably you would extend product interface from comparable interface or you would
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:09:28,000 --> 00:09:34,000
|
| 535 |
+
implement some absurd product type where you would implement comparable interface and you would use
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:09:34,000 --> 00:09:36,000
|
| 539 |
+
that level of abstraction across your all application.
|
| 540 |
+
|
| 541 |
+
136
|
| 542 |
+
00:09:37,000 --> 00:09:39,000
|
| 543 |
+
That just a few ideas to think about.
|
| 544 |
+
|
| 545 |
+
137
|
| 546 |
+
00:09:40,000 --> 00:09:45,000
|
| 547 |
+
Now, in case we would support a comparable product, we would have all our products sorted according
|
| 548 |
+
|
| 549 |
+
138
|
| 550 |
+
00:09:45,000 --> 00:09:46,000
|
| 551 |
+
to ideas.
|
| 552 |
+
|
| 553 |
+
139
|
| 554 |
+
00:09:47,000 --> 00:09:51,000
|
| 555 |
+
And as you can see, it doesn't matter in which order we added our products to the list.
|
| 556 |
+
|
| 557 |
+
140
|
| 558 |
+
00:09:52,000 --> 00:09:58,000
|
| 559 |
+
But what if we want to sort my product name and natural order doesn't work for us?
|
| 560 |
+
|
| 561 |
+
141
|
| 562 |
+
00:09:58,000 --> 00:10:01,000
|
| 563 |
+
In this case, we have to implement our competitor.
|
| 564 |
+
|
| 565 |
+
142
|
| 566 |
+
00:10:02,000 --> 00:10:10,000
|
| 567 |
+
We have four ways to implement comparator Zaya LeClaire anonymous class, create separate class, write
|
| 568 |
+
|
| 569 |
+
143
|
| 570 |
+
00:10:10,000 --> 00:10:13,000
|
| 571 |
+
lambda expression, use method reference.
|
| 572 |
+
|
| 573 |
+
144
|
| 574 |
+
00:10:14,000 --> 00:10:19,000
|
| 575 |
+
Then we are going to review first two options and the rest will learn in the separate lessons.
|
| 576 |
+
|
| 577 |
+
145
|
| 578 |
+
00:10:19,000 --> 00:10:25,000
|
| 579 |
+
When we will talk about functional programming in Java, we have our list of products where products
|
| 580 |
+
|
| 581 |
+
146
|
| 582 |
+
00:10:25,000 --> 00:10:28,000
|
| 583 |
+
don't implement comparable interface.
|
| 584 |
+
|
| 585 |
+
147
|
| 586 |
+
00:10:28,000 --> 00:10:30,000
|
| 587 |
+
Let me use that one for sourcing.
|
| 588 |
+
|
| 589 |
+
148
|
| 590 |
+
00:10:31,000 --> 00:10:38,000
|
| 591 |
+
I write a new comparator and specify product type in Diament operator to tell Java compilers, and this
|
| 592 |
+
|
| 593 |
+
149
|
| 594 |
+
00:10:38,000 --> 00:10:43,000
|
| 595 |
+
comparator will work with Prototype and after that I am going to declare anonymous class.
|
| 596 |
+
|
| 597 |
+
150
|
| 598 |
+
00:10:44,000 --> 00:10:50,000
|
| 599 |
+
And in case you missed my Java lesson about anonymous classes, please check that it will help you for
|
| 600 |
+
|
| 601 |
+
151
|
| 602 |
+
00:10:50,000 --> 00:10:55,000
|
| 603 |
+
understanding of anonymous classes and here give implementation for compare method.
|
| 604 |
+
|
| 605 |
+
152
|
| 606 |
+
00:10:56,000 --> 00:10:59,000
|
| 607 |
+
The second option is to implement separate class.
|
| 608 |
+
|
| 609 |
+
153
|
| 610 |
+
00:10:59,000 --> 00:11:05,000
|
| 611 |
+
You can create separate file for that one, but for the sake of the demo, I will declare another class
|
| 612 |
+
|
| 613 |
+
154
|
| 614 |
+
00:11:05,000 --> 00:11:09,000
|
| 615 |
+
in the same file here to keep all code examples from the lesson in one file.
|
| 616 |
+
|
| 617 |
+
155
|
| 618 |
+
00:11:10,000 --> 00:11:15,000
|
| 619 |
+
So I have product name comparator class that implements comparator interface.
|
| 620 |
+
|
| 621 |
+
156
|
| 622 |
+
00:11:16,000 --> 00:11:19,000
|
| 623 |
+
The implementation is the same as we have in our anonymous class.
|
| 624 |
+
|
| 625 |
+
157
|
| 626 |
+
00:11:20,000 --> 00:11:24,000
|
| 627 |
+
I can source my products by passing the reference to the object of my competitor.
|
| 628 |
+
|
| 629 |
+
158
|
| 630 |
+
00:11:25,000 --> 00:11:28,000
|
| 631 |
+
So there's two ways to source elements are similar.
|
| 632 |
+
|
| 633 |
+
159
|
| 634 |
+
00:11:28,000 --> 00:11:30,000
|
| 635 |
+
It is up to you which one to choose.
|
| 636 |
+
|
| 637 |
+
160
|
| 638 |
+
00:11:31,000 --> 00:11:36,000
|
| 639 |
+
I'm going to give you a task where you might practice in the implementation of comparator interface.
|
| 640 |
+
|
| 641 |
+
161
|
| 642 |
+
00:11:37,000 --> 00:11:43,000
|
| 643 |
+
If you want me to answer what is better comparator or comparable, I wouldn't answer that question.
|
| 644 |
+
|
| 645 |
+
162
|
| 646 |
+
00:11:44,000 --> 00:11:48,000
|
| 647 |
+
Using off any of these interfaces depends on the real case.
|
| 648 |
+
|
| 649 |
+
163
|
| 650 |
+
00:11:48,000 --> 00:11:54,000
|
| 651 |
+
For example, you need to search elements by specific field in one method, then compare to usage would
|
| 652 |
+
|
| 653 |
+
164
|
| 654 |
+
00:11:54,000 --> 00:12:00,000
|
| 655 |
+
be justified in case you don't have possibility to rewrite the type and implement comparable there.
|
| 656 |
+
|
| 657 |
+
165
|
| 658 |
+
00:12:01,000 --> 00:12:03,000
|
| 659 |
+
You also have to use comparator in this case.
|
| 660 |
+
|
| 661 |
+
166
|
| 662 |
+
00:12:04,000 --> 00:12:09,000
|
| 663 |
+
But if you know that objects of your type will be sorted on a regular basis during the creation of the
|
| 664 |
+
|
| 665 |
+
167
|
| 666 |
+
00:12:09,000 --> 00:12:13,000
|
| 667 |
+
new type, you can consider implementation of comparable interface.
|
| 668 |
+
|
| 669 |
+
168
|
| 670 |
+
00:12:13,000 --> 00:12:14,000
|
| 671 |
+
Does it make sense?
|
| 672 |
+
|
| 673 |
+
169
|
| 674 |
+
00:12:15,000 --> 00:12:19,000
|
| 675 |
+
Before we proceed, I want to finish overview of assets in Comparator.
|
| 676 |
+
|
| 677 |
+
170
|
| 678 |
+
00:12:19,000 --> 00:12:24,000
|
| 679 |
+
We have overloaded them comparing methods which I would say not used very often.
|
| 680 |
+
|
| 681 |
+
171
|
| 682 |
+
00:12:25,000 --> 00:12:29,000
|
| 683 |
+
Originally, this method is built to great chain for comparison logic.
|
| 684 |
+
|
| 685 |
+
172
|
| 686 |
+
00:12:29,000 --> 00:12:34,000
|
| 687 |
+
In the case, elements are equal, but to be honest, you can write the same logic in one method.
|
| 688 |
+
|
| 689 |
+
173
|
| 690 |
+
00:12:35,000 --> 00:12:40,000
|
| 691 |
+
But it is also worth to mention that such architecture would allow you to be more flexible in describing
|
| 692 |
+
|
| 693 |
+
174
|
| 694 |
+
00:12:40,000 --> 00:12:45,000
|
| 695 |
+
your comparison logic and to use different chain of comparisons in different situations.
|
| 696 |
+
|
| 697 |
+
175
|
| 698 |
+
00:12:46,000 --> 00:12:52,000
|
| 699 |
+
While this brings a lot of flexibility, I can't come up with an example right now or any business case
|
| 700 |
+
|
| 701 |
+
176
|
| 702 |
+
00:12:52,000 --> 00:12:54,000
|
| 703 |
+
where this flexibility will be needed.
|
| 704 |
+
|
| 705 |
+
177
|
| 706 |
+
00:12:55,000 --> 00:13:01,000
|
| 707 |
+
We also hear no first and no last message that returned competitors with a specific logic for certain
|
| 708 |
+
|
| 709 |
+
178
|
| 710 |
+
00:13:01,000 --> 00:13:05,000
|
| 711 |
+
new values and here also different variations of compare and method.
|
| 712 |
+
|
| 713 |
+
179
|
| 714 |
+
00:13:05,000 --> 00:13:07,000
|
| 715 |
+
Those are pretty interesting.
|
| 716 |
+
|
| 717 |
+
180
|
| 718 |
+
00:13:07,000 --> 00:13:13,000
|
| 719 |
+
For example, we can call comparing method and parse functions that will extract the field that we want
|
| 720 |
+
|
| 721 |
+
181
|
| 722 |
+
00:13:13,000 --> 00:13:20,000
|
| 723 |
+
to use for sorting or extract the field and override natural ordering for it by providing another function
|
| 724 |
+
|
| 725 |
+
182
|
| 726 |
+
00:13:20,000 --> 00:13:21,000
|
| 727 |
+
in return.
|
| 728 |
+
|
| 729 |
+
183
|
| 730 |
+
00:13:21,000 --> 00:13:24,000
|
| 731 |
+
We will get comparators that we can use to search elements.
|
| 732 |
+
|
| 733 |
+
184
|
| 734 |
+
00:13:25,000 --> 00:13:31,000
|
| 735 |
+
Review of these methods lies outside of our today's agenda, but we will definitely talk about this
|
| 736 |
+
|
| 737 |
+
185
|
| 738 |
+
00:13:31,000 --> 00:13:33,000
|
| 739 |
+
when we agree on functional programming topic.
|
| 740 |
+
|
| 741 |
+
186
|
| 742 |
+
00:13:34,000 --> 00:13:39,000
|
| 743 |
+
The last thing for the is that I want to discuss is to answer one of your potential questions.
|
| 744 |
+
|
| 745 |
+
187
|
| 746 |
+
00:13:40,000 --> 00:13:41,000
|
| 747 |
+
Take into account this video.
|
| 748 |
+
|
| 749 |
+
188
|
| 750 |
+
00:13:41,000 --> 00:13:47,000
|
| 751 |
+
Of course, I always try to predict what questions you might have, but in case I didn't answer all
|
| 752 |
+
|
| 753 |
+
189
|
| 754 |
+
00:13:47,000 --> 00:13:49,000
|
| 755 |
+
your questions in the media, feel free to pose questions.
|
| 756 |
+
|
| 757 |
+
190
|
| 758 |
+
00:13:49,000 --> 00:13:55,000
|
| 759 |
+
And the easiest lesson probably you are wondering how function that takes on the two arguments.
|
| 760 |
+
|
| 761 |
+
191
|
| 762 |
+
00:13:55,000 --> 00:13:59,000
|
| 763 |
+
That is our campaign method, how it concerns all elements.
|
| 764 |
+
|
| 765 |
+
192
|
| 766 |
+
00:14:00,000 --> 00:14:03,000
|
| 767 |
+
That is because algorithms with the name quicksort is applied.
|
| 768 |
+
|
| 769 |
+
193
|
| 770 |
+
00:14:04,000 --> 00:14:09,000
|
| 771 |
+
This is not the course about algorithms, but I believe for the general understanding it will be useful
|
| 772 |
+
|
| 773 |
+
194
|
| 774 |
+
00:14:09,000 --> 00:14:12,000
|
| 775 |
+
for you to know how quicksort algorithm works.
|
| 776 |
+
|
| 777 |
+
195
|
| 778 |
+
00:14:12,000 --> 00:14:16,000
|
| 779 |
+
As I said, I'm not going to dive deep into the details.
|
| 780 |
+
|
| 781 |
+
196
|
| 782 |
+
00:14:16,000 --> 00:14:22,000
|
| 783 |
+
Someday I will create course about algorithms and we are going to learn all algorithms in a nutshell.
|
| 784 |
+
|
| 785 |
+
197
|
| 786 |
+
00:14:23,000 --> 00:14:26,000
|
| 787 |
+
But right now, I want you to look at this GIF image.
|
| 788 |
+
|
| 789 |
+
198
|
| 790 |
+
00:14:26,000 --> 00:14:30,000
|
| 791 |
+
It explains exactly how quicksort algorithm works.
|
| 792 |
+
|
| 793 |
+
199
|
| 794 |
+
00:14:31,000 --> 00:14:32,000
|
| 795 |
+
Quicksort algorithm.
|
| 796 |
+
|
| 797 |
+
200
|
| 798 |
+
00:14:32,000 --> 00:14:37,000
|
| 799 |
+
It is still a commonly used algorithm for searching when implemented well.
|
| 800 |
+
|
| 801 |
+
201
|
| 802 |
+
00:14:37,000 --> 00:14:41,000
|
| 803 |
+
It can be about two or three times faster than its main competitors.
|
| 804 |
+
|
| 805 |
+
202
|
| 806 |
+
00:14:41,000 --> 00:14:43,000
|
| 807 |
+
Match, source and heat source.
|
| 808 |
+
|
| 809 |
+
203
|
| 810 |
+
00:14:44,000 --> 00:14:51,000
|
| 811 |
+
The algorithm finds pivot element and after that split all elements into two separate, comparing each
|
| 812 |
+
|
| 813 |
+
204
|
| 814 |
+
00:14:51,000 --> 00:14:56,000
|
| 815 |
+
element with belittlement algorithm source element by telling whether a particular element less or greater
|
| 816 |
+
|
| 817 |
+
205
|
| 818 |
+
00:14:56,000 --> 00:14:57,000
|
| 819 |
+
than pivot.
|
| 820 |
+
|
| 821 |
+
206
|
| 822 |
+
00:14:58,000 --> 00:15:03,000
|
| 823 |
+
As we go over each element, we constantly compare two elements and swapping them.
|
| 824 |
+
|
| 825 |
+
207
|
| 826 |
+
00:15:04,000 --> 00:15:07,000
|
| 827 |
+
That's why Java needs methods that can compare to elements.
|
| 828 |
+
|
| 829 |
+
208
|
| 830 |
+
00:15:08,000 --> 00:15:14,000
|
| 831 |
+
If you would open source code of the source method, you would discover a compromise that will be called
|
| 832 |
+
|
| 833 |
+
209
|
| 834 |
+
00:15:14,000 --> 00:15:17,000
|
| 835 |
+
multiple times until all elements will be sorted.
|
| 836 |
+
|
| 837 |
+
210
|
| 838 |
+
00:15:17,000 --> 00:15:23,000
|
| 839 |
+
Now, I believe you understand why we need to pass the parameters into our campaign method.
|
| 840 |
+
|
| 841 |
+
211
|
| 842 |
+
00:15:23,000 --> 00:15:26,000
|
| 843 |
+
We did a great job today and learned a lot of things.
|
| 844 |
+
|
| 845 |
+
212
|
| 846 |
+
00:15:26,000 --> 00:15:29,000
|
| 847 |
+
Let's recap what we have learned today.
|
| 848 |
+
|
| 849 |
+
213
|
| 850 |
+
00:15:29,000 --> 00:15:32,000
|
| 851 |
+
Today we learned what comparator is.
|
| 852 |
+
|
| 853 |
+
214
|
| 854 |
+
00:15:32,000 --> 00:15:35,000
|
| 855 |
+
We also learned what a comparable interface is.
|
| 856 |
+
|
| 857 |
+
215
|
| 858 |
+
00:15:35,000 --> 00:15:41,000
|
| 859 |
+
We learned how to source elements in list by using natural and reverse ordering of elements.
|
| 860 |
+
|
| 861 |
+
216
|
| 862 |
+
00:15:41,000 --> 00:15:47,000
|
| 863 |
+
Now, you know what the difference is between the compare and compare to methods and real examples we
|
| 864 |
+
|
| 865 |
+
217
|
| 866 |
+
00:15:47,000 --> 00:15:51,000
|
| 867 |
+
learned when we need to use comparator and when we need to use comparable.
|
| 868 |
+
|
| 869 |
+
218
|
| 870 |
+
00:15:52,000 --> 00:15:57,000
|
| 871 |
+
We created our custom comparable product and created comparison for existing type.
|
| 872 |
+
|
| 873 |
+
219
|
| 874 |
+
00:15:57,000 --> 00:16:00,000
|
| 875 |
+
And at the end of the lesson we learned quicksort algorithm.
|
| 876 |
+
|
| 877 |
+
220
|
| 878 |
+
00:16:01,000 --> 00:16:03,000
|
| 879 |
+
Now I suggest reviewing your homework.
|
| 880 |
+
|
| 881 |
+
221
|
| 882 |
+
00:16:04,000 --> 00:16:09,000
|
| 883 |
+
And your homework, you have to implement comparison in the separate file that would search products
|
| 884 |
+
|
| 885 |
+
222
|
| 886 |
+
00:16:09,000 --> 00:16:13,000
|
| 887 |
+
by category names, then by price and then by product name.
|
| 888 |
+
|
| 889 |
+
223
|
| 890 |
+
00:16:13,000 --> 00:16:19,000
|
| 891 |
+
Here you may find links to the product interface type and implementation of product interface.
|
| 892 |
+
|
| 893 |
+
224
|
| 894 |
+
00:16:19,000 --> 00:16:25,000
|
| 895 |
+
Also here you can see a list of products that you can use during the testing and believe that you will
|
| 896 |
+
|
| 897 |
+
225
|
| 898 |
+
00:16:25,000 --> 00:16:27,000
|
| 899 |
+
be able to accomplish this task easily.
|
| 900 |
+
|
| 901 |
+
226
|
| 902 |
+
00:16:28,000 --> 00:16:29,000
|
| 903 |
+
I believe in you.
|
| 904 |
+
|
| 905 |
+
227
|
| 906 |
+
00:16:30,000 --> 00:16:32,000
|
| 907 |
+
That's all what I have for you for today.
|
| 908 |
+
|
| 909 |
+
228
|
| 910 |
+
00:16:32,000 --> 00:16:36,000
|
| 911 |
+
Thanks a lot for your attention and see you in the next lesson.
|
| 912 |
+
|
19 - Java Collections Framework/008 Homework-Solution-Custom-Comparator.url
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[InternetShortcut]
|
| 2 |
+
URL=https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/hw/onlinestore/withlist/utils/comparators/CustomProductComparator.java
|
19 - Java Collections Framework/008 Homework.url
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[InternetShortcut]
|
| 2 |
+
URL=https://docs.google.com/document/d/1senXk6JLFWsVQnJT5si_QgodHkXMFgIIPK447rgXSN0/edit?usp=sharing
|
19 - Java Collections Framework/008 Source-code-of-the-example-used-in-the-lesson.url
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[InternetShortcut]
|
| 2 |
+
URL=https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/sorting/ComparisonDemo.java
|
19 - Java Collections Framework/010 Homework-Solution-Custom-Iterator-and-ListIterator.url
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[InternetShortcut]
|
| 2 |
+
URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/collections/list/hw
|
19 - Java Collections Framework/010 Homework.url
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[InternetShortcut]
|
| 2 |
+
URL=https://docs.google.com/document/d/1EAQRwHR1HbWt95T3FtS9EOdQsIc_3nZFYUvc6Qv4frQ/edit?usp=sharing
|
19 - Java Collections Framework/010 Iterable, Iterator & ListIterator_en.srt
ADDED
|
@@ -0,0 +1,1080 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1
|
| 2 |
+
00:00:06,000 --> 00:00:06,000
|
| 3 |
+
Hello, Jim.
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:06,000 --> 00:00:11,000
|
| 7 |
+
In this lesson, we are going to talk about what iterable and iterator interfaces are.
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:11,000 --> 00:00:17,000
|
| 11 |
+
We would investigate source code of these two interfaces and also will answer what is the role of these
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:17,000 --> 00:00:19,000
|
| 15 |
+
two interfaces in Java collections framework.
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:20,000 --> 00:00:23,000
|
| 19 |
+
After this lesson, you will never confuse these two interfaces.
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:23,000 --> 00:00:26,000
|
| 23 |
+
We are going to learn three types of iterator.
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:26,000 --> 00:00:32,000
|
| 27 |
+
And at the end of the lesson, I also want to demo what least Iterator is and how it is different from
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:32,000 --> 00:00:33,000
|
| 31 |
+
Iterator.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:33,000 --> 00:00:34,000
|
| 35 |
+
Let's start.
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:34,000 --> 00:00:40,000
|
| 39 |
+
I believe you remember that first time when we looked at collection interface, we found that collection
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:40,000 --> 00:00:43,000
|
| 43 |
+
interface is extended from iterable interface.
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:43,000 --> 00:00:50,000
|
| 47 |
+
You remember that as you can see on this class diagram, iterable interface has only one method iterator.
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:51,000 --> 00:00:53,000
|
| 51 |
+
This method should return object of iterate type.
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:00:54,000 --> 00:00:59,000
|
| 55 |
+
That means that each implementation of collection interfacing Java should have iterator.
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:00:59,000 --> 00:01:03,000
|
| 59 |
+
I believe that is all what we can say about iterable interface.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:01:03,000 --> 00:01:10,000
|
| 63 |
+
This interface is to tell that I'm the type that has iterator more interesting to talk about what an
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:10,000 --> 00:01:17,000
|
| 67 |
+
iterator is and to answer this question, I suggest reviewing source code of iterator type in eclipse
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:17,000 --> 00:01:18,000
|
| 71 |
+
in few words.
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:18,000 --> 00:01:22,000
|
| 75 |
+
Iterator is a type that can go over each element in a container.
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:22,000 --> 00:01:23,000
|
| 79 |
+
That's it.
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:23,000 --> 00:01:27,000
|
| 83 |
+
You might be wondering, is it really so hard and separate type is needed?
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:28,000 --> 00:01:31,000
|
| 87 |
+
It is not so hard, but imagine two simple cases.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:31,000 --> 00:01:34,000
|
| 91 |
+
You have array lists and linked list.
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:34,000 --> 00:01:39,000
|
| 95 |
+
In our list we are together elements from the array by the indexes in the linked list.
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:39,000 --> 00:01:44,000
|
| 99 |
+
We have to get the reference to the next node from each node to iterate over elements.
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:44,000 --> 00:01:50,000
|
| 103 |
+
Can you see that the way how to iterate over each element, even in these two collections, is completely
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:50,000 --> 00:01:51,000
|
| 107 |
+
different?
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:52,000 --> 00:01:58,000
|
| 111 |
+
That's exactly the reason why we need to come up with some abstract type like Iterator to set the interface
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:01:58,000 --> 00:02:02,000
|
| 115 |
+
that should be implemented by specific implementations of collection interface.
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:02:02,000 --> 00:02:05,000
|
| 119 |
+
So let's sum up what Iterator is.
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:06,000 --> 00:02:12,000
|
| 123 |
+
Iterator is an interface that allows access to the elements in container and navigation in collection,
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:12,000 --> 00:02:19,000
|
| 127 |
+
including iteration or in other words, looping over each element in any collection without knowing
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:19,000 --> 00:02:22,000
|
| 131 |
+
the details of implementation of specific collection.
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:23,000 --> 00:02:30,000
|
| 135 |
+
Now we are going to run the interface of iterate the type it has to abstract and two default methods.
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:31,000 --> 00:02:33,000
|
| 139 |
+
Let me explain what each of these methods is about.
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:34,000 --> 00:02:37,000
|
| 143 |
+
Has an X method returns true or false?
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:37,000 --> 00:02:43,000
|
| 147 |
+
It tells us whether the next element is present will use this method in loops to check if it was to
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:43,000 --> 00:02:49,000
|
| 151 |
+
go on with our loop or we reached the end of the collection and we have to break the loop.
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:50,000 --> 00:02:53,000
|
| 155 |
+
Next method returns the next element in connection.
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:53,000 --> 00:02:54,000
|
| 159 |
+
Be careful.
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:54,000 --> 00:03:01,000
|
| 163 |
+
This method may throw no such element exception and interrupt your program execution in case you called
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:03:01,000 --> 00:03:02,000
|
| 167 |
+
next method.
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:03:02,000 --> 00:03:04,000
|
| 171 |
+
But there are no any elements there.
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:03:04,000 --> 00:03:07,000
|
| 175 |
+
That is a contract of the Iterator interface.
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:07,000 --> 00:03:09,000
|
| 179 |
+
We can do nothing about that.
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:09,000 --> 00:03:16,000
|
| 183 |
+
That's why before calling next method, we have to always call has next method remove method supposed
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:16,000 --> 00:03:21,000
|
| 187 |
+
to remove the last element returned by next method and now attention.
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:21,000 --> 00:03:25,000
|
| 191 |
+
This method can be called only once after each next method call.
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:25,000 --> 00:03:31,000
|
| 195 |
+
We can't call two times next method and after that call two times remove method.
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:31,000 --> 00:03:37,000
|
| 199 |
+
That is the way how Iterator should work in case you would call remove method without calling next method
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:37,000 --> 00:03:42,000
|
| 203 |
+
or we'll call remove two times in a row in your program, your program will be stopped with illegal
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:42,000 --> 00:03:43,000
|
| 207 |
+
state exception.
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:44,000 --> 00:03:46,000
|
| 211 |
+
But there is more interesting thing here.
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:46,000 --> 00:03:50,000
|
| 215 |
+
By default, remove method throws and support the separation exception.
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:03:50,000 --> 00:03:56,000
|
| 219 |
+
That means that in case we would call this method, our program will be stopped with the exceptional
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:03:56,000 --> 00:03:56,000
|
| 223 |
+
situation.
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:03:57,000 --> 00:04:01,000
|
| 227 |
+
Now I'm going to say not only my opinion, but opinion of different engineers too.
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:04:02,000 --> 00:04:06,000
|
| 231 |
+
It is senseless to declare method in the interface that is not needed.
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:04:06,000 --> 00:04:07,000
|
| 235 |
+
Yes, exactly.
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:04:08,000 --> 00:04:14,000
|
| 239 |
+
This exception here and support the separation exception tells us that by default this method is not
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:14,000 --> 00:04:15,000
|
| 243 |
+
supported.
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:15,000 --> 00:04:18,000
|
| 247 |
+
Don't do that during the implementation of your interfaces.
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:19,000 --> 00:04:19,000
|
| 251 |
+
Why?
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:20,000 --> 00:04:21,000
|
| 255 |
+
Let me explain here.
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:21,000 --> 00:04:24,000
|
| 259 |
+
We can see a violation of one of the solid principles.
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:25,000 --> 00:04:29,000
|
| 263 |
+
Can you guess what solid principle is violated in the Iterator interface?
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:30,000 --> 00:04:31,000
|
| 267 |
+
Exactly.
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:04:31,000 --> 00:04:34,000
|
| 271 |
+
High principle interface aggregation principle.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:04:34,000 --> 00:04:39,000
|
| 275 |
+
According to this principle, no client should be forced to depend on methods it doesn't use.
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:04:40,000 --> 00:04:46,000
|
| 279 |
+
Originally, according to the documentation, Iterator type was created to iterate over elements, but
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:04:46,000 --> 00:04:47,000
|
| 283 |
+
not to remove them.
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:04:47,000 --> 00:04:50,000
|
| 287 |
+
How would I recommend implementing this?
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:04:50,000 --> 00:04:56,000
|
| 291 |
+
I would create something like removable iterator that extends iterate type and would let client of my
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:04:56,000 --> 00:05:03,000
|
| 295 |
+
code to decide whether they need to remove method or no, because right now each implementation of Iterator.
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:05:03,000 --> 00:05:10,000
|
| 299 |
+
Interface has removed MassArt, even if it is not a that this is default MassArt and there is no need
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:10,000 --> 00:05:10,000
|
| 303 |
+
to override it.
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:11,000 --> 00:05:18,000
|
| 307 |
+
But this does not make life of engineers easier because we still can call, remove by mistake and rely
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:18,000 --> 00:05:21,000
|
| 311 |
+
on the fact that this behavior should be supported in iterator.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:22,000 --> 00:05:24,000
|
| 315 |
+
Now, you know that there is an exception here.
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:25,000 --> 00:05:30,000
|
| 319 |
+
The other side of this violation is that in the case in Java collections framework, engineers would
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:30,000 --> 00:05:35,000
|
| 323 |
+
follow all or P principles, including interface aggregation principle.
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:35,000 --> 00:05:42,000
|
| 327 |
+
There would be big bank of interfaces that is hard to learn and hard to remember and even harder to
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:05:42,000 --> 00:05:42,000
|
| 331 |
+
maintain.
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:05:43,000 --> 00:05:49,000
|
| 335 |
+
So as you can see, programming like everything else in our lives is all about tradeoffs and compromises.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:05:50,000 --> 00:05:56,000
|
| 339 |
+
The last but not the least massaged here in Interactor interface is for each remaining, this matter
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:05:56,000 --> 00:06:01,000
|
| 343 |
+
takes function that should be applied for each element that remains in the container.
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:06:01,000 --> 00:06:07,000
|
| 347 |
+
The usage of this message requires knowledge of functional programming in Java and no interfaces from
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:06:07,000 --> 00:06:09,000
|
| 351 |
+
the Java Wattyl function package.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:06:10,000 --> 00:06:13,000
|
| 355 |
+
That's why today will not Damul work of this method.
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:06:13,000 --> 00:06:16,000
|
| 359 |
+
But we will damage it in the lesson about functional programming.
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:17,000 --> 00:06:23,000
|
| 363 |
+
OK, now when we know iterate the interface, I suggest learning how it works and to practice a bit.
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:24,000 --> 00:06:28,000
|
| 367 |
+
And I would like to visualize the way how Massaponax and remove works.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:28,000 --> 00:06:30,000
|
| 371 |
+
Let's take a look at this slide.
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:30,000 --> 00:06:36,000
|
| 375 |
+
I want you to imagine that Iterator works like a cursor, namely at the beginning.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:36,000 --> 00:06:38,000
|
| 379 |
+
It stands right before the first element.
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:39,000 --> 00:06:43,000
|
| 383 |
+
When we call next method, it returns the next element to us.
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:06:43,000 --> 00:06:49,000
|
| 387 |
+
And now cursor stands between the first and the second element in case we call next method one more
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:06:49,000 --> 00:06:55,000
|
| 391 |
+
time cursor is moved to the position between second and the third element like you see on the slide.
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:06:56,000 --> 00:07:02,000
|
| 395 |
+
Now, when we call remove method Iterator works as a backspace key on the Windows machines, it removes
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:07:02,000 --> 00:07:05,000
|
| 399 |
+
elements that stands right before the cursor.
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:07:05,000 --> 00:07:06,000
|
| 403 |
+
Does it make sense?
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:07:07,000 --> 00:07:08,000
|
| 407 |
+
Now let's get back to Eclipse.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:07:09,000 --> 00:07:15,000
|
| 411 |
+
For the sake of the drama, I created this demo file to practice a bit with Iterator, let me run this
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:07:15,000 --> 00:07:18,000
|
| 415 |
+
program and walk you through the different cases that are listed here.
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:19,000 --> 00:07:24,000
|
| 419 |
+
At the beginning, I created the list of integers to play with, you already know this construction,
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:25,000 --> 00:07:27,000
|
| 423 |
+
so there is nothing special for you here.
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:27,000 --> 00:07:30,000
|
| 427 |
+
Now, let's iterate over each element in container.
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:31,000 --> 00:07:37,000
|
| 431 |
+
I call iterate a method on our list that returns iterator object parametrized by integer type.
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:37,000 --> 00:07:44,000
|
| 435 |
+
This means that when I will call next Masset iterate, I will reach an object of type integer like it
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:44,000 --> 00:07:49,000
|
| 439 |
+
specified here in Diamond Operator, but not the object of type object.
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:07:49,000 --> 00:07:55,000
|
| 443 |
+
After that we have while loop and I check in condition statement here was an iterator has an extra element
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:07:55,000 --> 00:07:56,000
|
| 447 |
+
or no.
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:07:56,000 --> 00:08:03,000
|
| 451 |
+
And if yes I want to print it to cancel next match it returns me means a reference to the next element
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:08:03,000 --> 00:08:04,000
|
| 455 |
+
in my container.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:08:04,000 --> 00:08:06,000
|
| 459 |
+
Is everything clear here.
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:08:06,000 --> 00:08:10,000
|
| 463 |
+
Haubert is the next example is more like practical type.
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:08:11,000 --> 00:08:17,000
|
| 467 |
+
Some of my students that I taught offline feel concerned that they can use the same iterator once we
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:08:17,000 --> 00:08:19,000
|
| 471 |
+
iterate it over all elements.
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:08:19,000 --> 00:08:26,000
|
| 475 |
+
So after the previous loop, our iterator cursor is at the end of the container and has an X method
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:08:26,000 --> 00:08:27,000
|
| 479 |
+
will return false.
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:27,000 --> 00:08:31,000
|
| 483 |
+
That is exactly the reason why we see this console output here.
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:32,000 --> 00:08:33,000
|
| 487 |
+
But what to do now?
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:33,000 --> 00:08:40,000
|
| 491 |
+
We can use the same variable and initialize it with a new iterator object because no message to reset
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:40,000 --> 00:08:44,000
|
| 495 |
+
courser obliterated back again to the beginning like we did here.
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:08:45,000 --> 00:08:46,000
|
| 499 |
+
So that is fine.
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:08:47,000 --> 00:08:49,000
|
| 503 |
+
Now I want to them how remove method works.
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:08:50,000 --> 00:08:56,000
|
| 507 |
+
Let's remove all even numbers from our container we call next method to get the element from the container.
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:08:57,000 --> 00:09:02,000
|
| 511 |
+
After that, we check whether this number is A1 and if yes, then we remove it.
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:09:02,000 --> 00:09:06,000
|
| 515 |
+
You can see that I don't violate the rules of remove method usage.
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:09:07,000 --> 00:09:10,000
|
| 519 |
+
I call remove method only after I called next method.
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:09:11,000 --> 00:09:14,000
|
| 523 |
+
And also there are no multiple locations of remove method.
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:09:15,000 --> 00:09:22,000
|
| 527 |
+
You also can notice that iterator that is implemented in at least overwrites remove Masset and doesn't
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:09:22,000 --> 00:09:27,000
|
| 531 |
+
throw and supports the separation exception like the full implementation of Remove Massud does.
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:09:28,000 --> 00:09:33,000
|
| 535 |
+
Now, if you are not familiar with the exception topic yet, let me show you an example.
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:09:33,000 --> 00:09:36,000
|
| 539 |
+
What exception means and how the writer may throw exceptions.
|
| 540 |
+
|
| 541 |
+
136
|
| 542 |
+
00:09:37,000 --> 00:09:43,000
|
| 543 |
+
Lattman comments these lines of code I initialised again my iterative variable with the new iterator
|
| 544 |
+
|
| 545 |
+
137
|
| 546 |
+
00:09:43,000 --> 00:09:44,000
|
| 547 |
+
object.
|
| 548 |
+
|
| 549 |
+
138
|
| 550 |
+
00:09:44,000 --> 00:09:47,000
|
| 551 |
+
After that I call Remove Masset without calling.
|
| 552 |
+
|
| 553 |
+
139
|
| 554 |
+
00:09:47,000 --> 00:09:48,000
|
| 555 |
+
Next Masset.
|
| 556 |
+
|
| 557 |
+
140
|
| 558 |
+
00:09:48,000 --> 00:09:50,000
|
| 559 |
+
Let me run my program now.
|
| 560 |
+
|
| 561 |
+
141
|
| 562 |
+
00:09:50,000 --> 00:09:53,000
|
| 563 |
+
And here we can see illegal state exception.
|
| 564 |
+
|
| 565 |
+
142
|
| 566 |
+
00:09:53,000 --> 00:09:58,000
|
| 567 |
+
The same exceptions will be thrown in case we would call remove Massud two times in a row.
|
| 568 |
+
|
| 569 |
+
143
|
| 570 |
+
00:09:59,000 --> 00:10:04,000
|
| 571 |
+
That is something what you have to remember at the end of the lesson I will share with your home task
|
| 572 |
+
|
| 573 |
+
144
|
| 574 |
+
00:10:04,000 --> 00:10:09,000
|
| 575 |
+
where you will have opportunity to practice your skills in writing your custom iterators.
|
| 576 |
+
|
| 577 |
+
145
|
| 578 |
+
00:10:09,000 --> 00:10:14,000
|
| 579 |
+
Let me comment these lines to be able to execute code that is written after this one.
|
| 580 |
+
|
| 581 |
+
146
|
| 582 |
+
00:10:15,000 --> 00:10:21,000
|
| 583 |
+
Let me also show one more important exception that might be thrown by Iterator that is concurrent modification,
|
| 584 |
+
|
| 585 |
+
147
|
| 586 |
+
00:10:21,000 --> 00:10:25,000
|
| 587 |
+
exception and uncommon these lines of code and will damage to you.
|
| 588 |
+
|
| 589 |
+
148
|
| 590 |
+
00:10:26,000 --> 00:10:32,000
|
| 591 |
+
Imagine that we created Iterator and when we started iteration, we removed elements from the container,
|
| 592 |
+
|
| 593 |
+
149
|
| 594 |
+
00:10:33,000 --> 00:10:37,000
|
| 595 |
+
but not with the help of Iterator, but just by using the removed method of our list.
|
| 596 |
+
|
| 597 |
+
150
|
| 598 |
+
00:10:38,000 --> 00:10:39,000
|
| 599 |
+
This is just an example.
|
| 600 |
+
|
| 601 |
+
151
|
| 602 |
+
00:10:39,000 --> 00:10:45,000
|
| 603 |
+
In real life, it might happen that you created an iterator on the list that is shared between different
|
| 604 |
+
|
| 605 |
+
152
|
| 606 |
+
00:10:45,000 --> 00:10:50,000
|
| 607 |
+
threats of execution and somebody in another thread did some modifications to your list.
|
| 608 |
+
|
| 609 |
+
153
|
| 610 |
+
00:10:51,000 --> 00:10:56,000
|
| 611 |
+
And after we would call next method, we would see concurrent modification exception.
|
| 612 |
+
|
| 613 |
+
154
|
| 614 |
+
00:10:56,000 --> 00:11:01,000
|
| 615 |
+
That means somebody modified the collection after Iterator had been created.
|
| 616 |
+
|
| 617 |
+
155
|
| 618 |
+
00:11:02,000 --> 00:11:07,000
|
| 619 |
+
Iterate an object, noticed that and want to let us know that collections that we are iterating over
|
| 620 |
+
|
| 621 |
+
156
|
| 622 |
+
00:11:07,000 --> 00:11:09,000
|
| 623 |
+
is not up to date.
|
| 624 |
+
|
| 625 |
+
157
|
| 626 |
+
00:11:09,000 --> 00:11:15,000
|
| 627 |
+
And that information about elements that I will read with the help of this iterator is not relevant
|
| 628 |
+
|
| 629 |
+
158
|
| 630 |
+
00:11:15,000 --> 00:11:15,000
|
| 631 |
+
anymore.
|
| 632 |
+
|
| 633 |
+
159
|
| 634 |
+
00:11:16,000 --> 00:11:19,000
|
| 635 |
+
This type of iterator is called fail fast iterator.
|
| 636 |
+
|
| 637 |
+
160
|
| 638 |
+
00:11:20,000 --> 00:11:25,000
|
| 639 |
+
That is default implementation of iterators in majority of collection implementations that are not developed
|
| 640 |
+
|
| 641 |
+
161
|
| 642 |
+
00:11:25,000 --> 00:11:27,000
|
| 643 |
+
to be used in multithreaded environment.
|
| 644 |
+
|
| 645 |
+
162
|
| 646 |
+
00:11:28,000 --> 00:11:34,000
|
| 647 |
+
What to do in this case, in case you have iterate to make sure there is no other place in your code
|
| 648 |
+
|
| 649 |
+
163
|
| 650 |
+
00:11:34,000 --> 00:11:36,000
|
| 651 |
+
where you modify the same collection simultaneously.
|
| 652 |
+
|
| 653 |
+
164
|
| 654 |
+
00:11:37,000 --> 00:11:43,000
|
| 655 |
+
If you do modify collections from different sets of execution, then you need failsafe iterator.
|
| 656 |
+
|
| 657 |
+
165
|
| 658 |
+
00:11:43,000 --> 00:11:47,000
|
| 659 |
+
That is a second type of iterator that usually called failsafe.
|
| 660 |
+
|
| 661 |
+
166
|
| 662 |
+
00:11:48,000 --> 00:11:53,000
|
| 663 |
+
Let me Corman's the concurrent modification demo code to be able to proceed with the next one and I
|
| 664 |
+
|
| 665 |
+
167
|
| 666 |
+
00:11:53,000 --> 00:11:55,000
|
| 667 |
+
ran the program again.
|
| 668 |
+
|
| 669 |
+
168
|
| 670 |
+
00:11:55,000 --> 00:12:02,000
|
| 671 |
+
Usually thread safe implementation of collections also implements failsafe iterator to explain in short
|
| 672 |
+
|
| 673 |
+
169
|
| 674 |
+
00:12:02,000 --> 00:12:04,000
|
| 675 |
+
how it works without going deep into the details.
|
| 676 |
+
|
| 677 |
+
170
|
| 678 |
+
00:12:05,000 --> 00:12:11,000
|
| 679 |
+
Failsafe Iterate that makes a copy of the internal data structure and iterate over the corporate data
|
| 680 |
+
|
| 681 |
+
171
|
| 682 |
+
00:12:11,000 --> 00:12:11,000
|
| 683 |
+
structure.
|
| 684 |
+
|
| 685 |
+
172
|
| 686 |
+
00:12:12,000 --> 00:12:17,000
|
| 687 |
+
And a structural modification done to the Iterator doesn't affect the copied data structure.
|
| 688 |
+
|
| 689 |
+
173
|
| 690 |
+
00:12:17,000 --> 00:12:20,000
|
| 691 |
+
So original data structure is changed.
|
| 692 |
+
|
| 693 |
+
174
|
| 694 |
+
00:12:21,000 --> 00:12:26,000
|
| 695 |
+
This type of iterator creates a snapshot and iterate over elements in this snapshot.
|
| 696 |
+
|
| 697 |
+
175
|
| 698 |
+
00:12:27,000 --> 00:12:30,000
|
| 699 |
+
The drawback of such iterator type is obvious.
|
| 700 |
+
|
| 701 |
+
176
|
| 702 |
+
00:12:30,000 --> 00:12:36,000
|
| 703 |
+
In some cases, you may not receive latest and up to date version of elements in case collection is
|
| 704 |
+
|
| 705 |
+
177
|
| 706 |
+
00:12:36,000 --> 00:12:38,000
|
| 707 |
+
modified from the different threats.
|
| 708 |
+
|
| 709 |
+
178
|
| 710 |
+
00:12:39,000 --> 00:12:41,000
|
| 711 |
+
But sometimes it might be not critical for you.
|
| 712 |
+
|
| 713 |
+
179
|
| 714 |
+
00:12:42,000 --> 00:12:48,000
|
| 715 |
+
Here we have thread safe list implementation copy and write a list I initialize.
|
| 716 |
+
|
| 717 |
+
180
|
| 718 |
+
00:12:48,000 --> 00:12:50,000
|
| 719 |
+
It was elements that are in our integers list.
|
| 720 |
+
|
| 721 |
+
181
|
| 722 |
+
00:12:51,000 --> 00:12:55,000
|
| 723 |
+
I create iterator interface of the that is the same everywhere.
|
| 724 |
+
|
| 725 |
+
182
|
| 726 |
+
00:12:56,000 --> 00:12:58,000
|
| 727 |
+
That's why I use the same variables that I had created.
|
| 728 |
+
|
| 729 |
+
183
|
| 730 |
+
00:12:59,000 --> 00:13:05,000
|
| 731 |
+
As I already mentioned, failsafe iterators creates a snapshot of the container to prove this.
|
| 732 |
+
|
| 733 |
+
184
|
| 734 |
+
00:13:05,000 --> 00:13:13,000
|
| 735 |
+
Here I add another integer to this container and now when I iterate over elements and as in previous
|
| 736 |
+
|
| 737 |
+
185
|
| 738 |
+
00:13:13,000 --> 00:13:15,000
|
| 739 |
+
example, I remove elements from collection.
|
| 740 |
+
|
| 741 |
+
186
|
| 742 |
+
00:13:15,000 --> 00:13:19,000
|
| 743 |
+
Without Iterator, I still bring elements from the container to the console.
|
| 744 |
+
|
| 745 |
+
187
|
| 746 |
+
00:13:20,000 --> 00:13:23,000
|
| 747 |
+
But why not print the collection to console?
|
| 748 |
+
|
| 749 |
+
188
|
| 750 |
+
00:13:23,000 --> 00:13:27,000
|
| 751 |
+
It has only one number that we added after iterator creation.
|
| 752 |
+
|
| 753 |
+
189
|
| 754 |
+
00:13:27,000 --> 00:13:33,000
|
| 755 |
+
This proves that Iterator creates a snapshot with elements, and this snapshot is not updated as we
|
| 756 |
+
|
| 757 |
+
190
|
| 758 |
+
00:13:33,000 --> 00:13:36,000
|
| 759 |
+
update collection after creation of Iterator.
|
| 760 |
+
|
| 761 |
+
191
|
| 762 |
+
00:13:37,000 --> 00:13:41,000
|
| 763 |
+
There is also a third type of iterator that is called weakly consistent.
|
| 764 |
+
|
| 765 |
+
192
|
| 766 |
+
00:13:42,000 --> 00:13:48,000
|
| 767 |
+
It is called so because this type of iterator can reflect some, but not necessarily all of the changes
|
| 768 |
+
|
| 769 |
+
193
|
| 770 |
+
00:13:48,000 --> 00:13:52,000
|
| 771 |
+
that have been made to the collection since Iterator is created.
|
| 772 |
+
|
| 773 |
+
194
|
| 774 |
+
00:13:52,000 --> 00:13:53,000
|
| 775 |
+
Let me show you this.
|
| 776 |
+
|
| 777 |
+
195
|
| 778 |
+
00:13:53,000 --> 00:14:00,000
|
| 779 |
+
I declare a new variable of collection type parametrized with integer type an aggregate object of concurrent
|
| 780 |
+
|
| 781 |
+
196
|
| 782 |
+
00:14:00,000 --> 00:14:01,000
|
| 783 |
+
linked deck.
|
| 784 |
+
|
| 785 |
+
197
|
| 786 |
+
00:14:01,000 --> 00:14:05,000
|
| 787 |
+
This collection implementation has weekly consistent Iterator implementation.
|
| 788 |
+
|
| 789 |
+
198
|
| 790 |
+
00:14:06,000 --> 00:14:11,000
|
| 791 |
+
I create an iterator and now attention similar to the previous example.
|
| 792 |
+
|
| 793 |
+
199
|
| 794 |
+
00:14:11,000 --> 00:14:14,000
|
| 795 |
+
I add new integer here and now.
|
| 796 |
+
|
| 797 |
+
200
|
| 798 |
+
00:14:14,000 --> 00:14:20,000
|
| 799 |
+
When I'm iterating over each element, I can see that new integer already was taken into account here.
|
| 800 |
+
|
| 801 |
+
201
|
| 802 |
+
00:14:21,000 --> 00:14:26,000
|
| 803 |
+
But as it is said in the documentation, there is no guarantee that all updates to the collection will
|
| 804 |
+
|
| 805 |
+
202
|
| 806 |
+
00:14:26,000 --> 00:14:31,000
|
| 807 |
+
be taken into account by the moment Iterator would reach the specific element.
|
| 808 |
+
|
| 809 |
+
203
|
| 810 |
+
00:14:31,000 --> 00:14:34,000
|
| 811 |
+
I understand now what is really consistent iterator.
|
| 812 |
+
|
| 813 |
+
204
|
| 814 |
+
00:14:35,000 --> 00:14:39,000
|
| 815 |
+
So now we may say that we learned three types of the iterator.
|
| 816 |
+
|
| 817 |
+
205
|
| 818 |
+
00:14:39,000 --> 00:14:44,000
|
| 819 |
+
The last thing that I would like to learn with you today is a list iterator.
|
| 820 |
+
|
| 821 |
+
206
|
| 822 |
+
00:14:44,000 --> 00:14:46,000
|
| 823 |
+
Let's look at this interface.
|
| 824 |
+
|
| 825 |
+
207
|
| 826 |
+
00:14:46,000 --> 00:14:51,000
|
| 827 |
+
The first thing that you can see is that list rate that extends iterate the interface.
|
| 828 |
+
|
| 829 |
+
208
|
| 830 |
+
00:14:52,000 --> 00:14:58,000
|
| 831 |
+
The main feature that is introduced list, right, is to iterate over elements in the reverse direction.
|
| 832 |
+
|
| 833 |
+
209
|
| 834 |
+
00:14:58,000 --> 00:15:04,000
|
| 835 |
+
If Iterator can go over elements from the beginning to the end, the list rate that can go from the
|
| 836 |
+
|
| 837 |
+
210
|
| 838 |
+
00:15:04,000 --> 00:15:06,000
|
| 839 |
+
end to the beginning.
|
| 840 |
+
|
| 841 |
+
211
|
| 842 |
+
00:15:06,000 --> 00:15:12,000
|
| 843 |
+
It also declares mass that absent in iterator interface, Zaya has Hesperus.
|
| 844 |
+
|
| 845 |
+
212
|
| 846 |
+
00:15:12,000 --> 00:15:14,000
|
| 847 |
+
It is similar to his next.
|
| 848 |
+
|
| 849 |
+
213
|
| 850 |
+
00:15:14,000 --> 00:15:21,000
|
| 851 |
+
But check if there any element in another direction, previs returns the reference to the previous element
|
| 852 |
+
|
| 853 |
+
214
|
| 854 |
+
00:15:21,000 --> 00:15:29,000
|
| 855 |
+
in the container next index to get the index of the next element, previous index it returns.
|
| 856 |
+
|
| 857 |
+
215
|
| 858 |
+
00:15:29,000 --> 00:15:36,000
|
| 859 |
+
The element that would be returned by previous MassArt set replaces the last element that was returned.
|
| 860 |
+
|
| 861 |
+
216
|
| 862 |
+
00:15:36,000 --> 00:15:38,000
|
| 863 |
+
And this is important to understand.
|
| 864 |
+
|
| 865 |
+
217
|
| 866 |
+
00:15:39,000 --> 00:15:46,000
|
| 867 |
+
It replaces elements that was returned after the next or previous method in case that method is called
|
| 868 |
+
|
| 869 |
+
218
|
| 870 |
+
00:15:46,000 --> 00:15:51,000
|
| 871 |
+
without calling next the previous method before that illegal state exception strong.
|
| 872 |
+
|
| 873 |
+
219
|
| 874 |
+
00:15:51,000 --> 00:15:59,000
|
| 875 |
+
Add method adds element to the container so you can see a few more important features of the list iterator.
|
| 876 |
+
|
| 877 |
+
220
|
| 878 |
+
00:15:59,000 --> 00:16:05,000
|
| 879 |
+
It also allows us to add element to the container during the iteration over elements or to substitute
|
| 880 |
+
|
| 881 |
+
221
|
| 882 |
+
00:16:05,000 --> 00:16:05,000
|
| 883 |
+
elements.
|
| 884 |
+
|
| 885 |
+
222
|
| 886 |
+
00:16:06,000 --> 00:16:08,000
|
| 887 |
+
Let's look at the list, iterator them.
|
| 888 |
+
|
| 889 |
+
223
|
| 890 |
+
00:16:08,000 --> 00:16:11,000
|
| 891 |
+
Now, I created a separate file for that.
|
| 892 |
+
|
| 893 |
+
224
|
| 894 |
+
00:16:11,000 --> 00:16:13,000
|
| 895 |
+
Let me also execute this program.
|
| 896 |
+
|
| 897 |
+
225
|
| 898 |
+
00:16:14,000 --> 00:16:17,000
|
| 899 |
+
I have the same container was integers as in previous example.
|
| 900 |
+
|
| 901 |
+
226
|
| 902 |
+
00:16:17,000 --> 00:16:19,000
|
| 903 |
+
The list interface declares list.
|
| 904 |
+
|
| 905 |
+
227
|
| 906 |
+
00:16:19,000 --> 00:16:20,000
|
| 907 |
+
Iterate the method.
|
| 908 |
+
|
| 909 |
+
228
|
| 910 |
+
00:16:20,000 --> 00:16:25,000
|
| 911 |
+
As you remember, this method returns as the objects of list iterator type.
|
| 912 |
+
|
| 913 |
+
229
|
| 914 |
+
00:16:26,000 --> 00:16:27,000
|
| 915 |
+
One more interesting feature.
|
| 916 |
+
|
| 917 |
+
230
|
| 918 |
+
00:16:27,000 --> 00:16:31,000
|
| 919 |
+
We can get at least iterator from the specific position if we need.
|
| 920 |
+
|
| 921 |
+
231
|
| 922 |
+
00:16:31,000 --> 00:16:36,000
|
| 923 |
+
I can't imagine the case when I would use it, but it is interesting feature to know about.
|
| 924 |
+
|
| 925 |
+
232
|
| 926 |
+
00:16:36,000 --> 00:16:39,000
|
| 927 |
+
List Iterator, for example.
|
| 928 |
+
|
| 929 |
+
233
|
| 930 |
+
00:16:39,000 --> 00:16:41,000
|
| 931 |
+
Here I set List Iterator as a second index.
|
| 932 |
+
|
| 933 |
+
234
|
| 934 |
+
00:16:42,000 --> 00:16:48,000
|
| 935 |
+
Here is a position of the cursor in the index zero here, position of the cursor in the index one and
|
| 936 |
+
|
| 937 |
+
235
|
| 938 |
+
00:16:48,000 --> 00:16:49,000
|
| 939 |
+
here is two.
|
| 940 |
+
|
| 941 |
+
236
|
| 942 |
+
00:16:50,000 --> 00:16:54,000
|
| 943 |
+
So the next goal of the previous method should return number two.
|
| 944 |
+
|
| 945 |
+
237
|
| 946 |
+
00:16:55,000 --> 00:16:59,000
|
| 947 |
+
And now you can see in the console output that two is returned.
|
| 948 |
+
|
| 949 |
+
238
|
| 950 |
+
00:16:59,000 --> 00:17:02,000
|
| 951 |
+
Now I want to update this element.
|
| 952 |
+
|
| 953 |
+
239
|
| 954 |
+
00:17:02,000 --> 00:17:06,000
|
| 955 |
+
I call set method and pass twenty two this method.
|
| 956 |
+
|
| 957 |
+
240
|
| 958 |
+
00:17:06,000 --> 00:17:10,000
|
| 959 |
+
So the elements that was returned previously is substituted with twenty.
|
| 960 |
+
|
| 961 |
+
241
|
| 962 |
+
00:17:11,000 --> 00:17:17,000
|
| 963 |
+
So my next goal of the next method should return twenty and he and console you can see at least Iterator
|
| 964 |
+
|
| 965 |
+
242
|
| 966 |
+
00:17:17,000 --> 00:17:20,000
|
| 967 |
+
works exactly in the way we expect it to work.
|
| 968 |
+
|
| 969 |
+
243
|
| 970 |
+
00:17:21,000 --> 00:17:27,000
|
| 971 |
+
In case I want to add an element with the help of this iterator, I call add method and the item is
|
| 972 |
+
|
| 973 |
+
244
|
| 974 |
+
00:17:27,000 --> 00:17:29,000
|
| 975 |
+
inserted right before the cursor.
|
| 976 |
+
|
| 977 |
+
245
|
| 978 |
+
00:17:30,000 --> 00:17:36,000
|
| 979 |
+
So in case I added twenty one, I can get it now by calling the previous method and here's twenty one
|
| 980 |
+
|
| 981 |
+
246
|
| 982 |
+
00:17:37,000 --> 00:17:42,000
|
| 983 |
+
and remove mass at the last item that was returned either by next or previous method.
|
| 984 |
+
|
| 985 |
+
247
|
| 986 |
+
00:17:43,000 --> 00:17:50,000
|
| 987 |
+
In this case after location of remove method twenty one will be removed and here we printed all elements
|
| 988 |
+
|
| 989 |
+
248
|
| 990 |
+
00:17:50,000 --> 00:17:51,000
|
| 991 |
+
to console to prove this.
|
| 992 |
+
|
| 993 |
+
249
|
| 994 |
+
00:17:52,000 --> 00:17:57,000
|
| 995 |
+
Now, I believe you have a full understanding of how Étretat enlisted radar works.
|
| 996 |
+
|
| 997 |
+
250
|
| 998 |
+
00:17:57,000 --> 00:17:59,000
|
| 999 |
+
Let's recap what we have learned today.
|
| 1000 |
+
|
| 1001 |
+
251
|
| 1002 |
+
00:18:00,000 --> 00:18:02,000
|
| 1003 |
+
Today, we learned what iterable is.
|
| 1004 |
+
|
| 1005 |
+
252
|
| 1006 |
+
00:18:02,000 --> 00:18:06,000
|
| 1007 |
+
We also understand what Iterator is now.
|
| 1008 |
+
|
| 1009 |
+
253
|
| 1010 |
+
00:18:06,000 --> 00:18:12,000
|
| 1011 |
+
We know the difference between these two interfaces when real examples, we saw how Iterator works in
|
| 1012 |
+
|
| 1013 |
+
254
|
| 1014 |
+
00:18:12,000 --> 00:18:13,000
|
| 1015 |
+
this lesson.
|
| 1016 |
+
|
| 1017 |
+
255
|
| 1018 |
+
00:18:13,000 --> 00:18:18,000
|
| 1019 |
+
We saw what exceptions might be thrown by iterator, including concurrent modification, exception,
|
| 1020 |
+
|
| 1021 |
+
256
|
| 1022 |
+
00:18:18,000 --> 00:18:23,000
|
| 1023 |
+
illegal state exception, unsupported aliment exception and no such aliment exception.
|
| 1024 |
+
|
| 1025 |
+
257
|
| 1026 |
+
00:18:24,000 --> 00:18:29,000
|
| 1027 |
+
We learned three types of iterator fail fast, fail safe and weakly consistent.
|
| 1028 |
+
|
| 1029 |
+
258
|
| 1030 |
+
00:18:30,000 --> 00:18:34,000
|
| 1031 |
+
And at the end of the lesson we learned at least iterator and how it works.
|
| 1032 |
+
|
| 1033 |
+
259
|
| 1034 |
+
00:18:34,000 --> 00:18:36,000
|
| 1035 |
+
Now let's review your homework.
|
| 1036 |
+
|
| 1037 |
+
260
|
| 1038 |
+
00:18:37,000 --> 00:18:43,000
|
| 1039 |
+
In short, you have to coordinate exercises here, you have to implement Iterator and Lisa the for the
|
| 1040 |
+
|
| 1041 |
+
261
|
| 1042 |
+
00:18:43,000 --> 00:18:50,000
|
| 1043 |
+
default Miley's class that you implemented in scoping her homework about lists, read attentively all
|
| 1044 |
+
|
| 1045 |
+
262
|
| 1046 |
+
00:18:50,000 --> 00:18:54,000
|
| 1047 |
+
the requirements here I prepared for you method signatures and description of interfaces.
|
| 1048 |
+
|
| 1049 |
+
263
|
| 1050 |
+
00:18:55,000 --> 00:18:57,000
|
| 1051 |
+
All you have to do is implement methods.
|
| 1052 |
+
|
| 1053 |
+
264
|
| 1054 |
+
00:18:58,000 --> 00:19:03,000
|
| 1055 |
+
You will see here some requirements related to exceptions in case you are not familiar with exceptions
|
| 1056 |
+
|
| 1057 |
+
265
|
| 1058 |
+
00:19:03,000 --> 00:19:04,000
|
| 1059 |
+
topic.
|
| 1060 |
+
|
| 1061 |
+
266
|
| 1062 |
+
00:19:04,000 --> 00:19:09,000
|
| 1063 |
+
There is absolutely no harm because I wrote the line of code that you have to write.
|
| 1064 |
+
|
| 1065 |
+
267
|
| 1066 |
+
00:19:09,000 --> 00:19:15,000
|
| 1067 |
+
One exceptions should be thrown that said, don't skip this homework.
|
| 1068 |
+
|
| 1069 |
+
268
|
| 1070 |
+
00:19:15,000 --> 00:19:17,000
|
| 1071 |
+
It is important for understanding of the topic.
|
| 1072 |
+
|
| 1073 |
+
269
|
| 1074 |
+
00:19:18,000 --> 00:19:19,000
|
| 1075 |
+
Thanks a lot for your attention.
|
| 1076 |
+
|
| 1077 |
+
270
|
| 1078 |
+
00:19:19,000 --> 00:19:21,000
|
| 1079 |
+
See you in the next lesson.
|
| 1080 |
+
|
19 - Java Collections Framework/010 Source-code-of-the-examples-used-in-the-lesson.url
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[InternetShortcut]
|
| 2 |
+
URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/collections/iterator
|
19 - Java Collections Framework/012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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1
|
| 2 |
+
00:00:06,000 --> 00:00:06,000
|
| 3 |
+
Hello, Jim.
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:06,000 --> 00:00:10,000
|
| 7 |
+
Today, we are going to lunch with you and other collections of Iraq.
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:10,000 --> 00:00:15,000
|
| 11 |
+
Today we'll talk about you interface and one more important interface that extends you, that is that
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:15,000 --> 00:00:19,000
|
| 15 |
+
interface with the masses in interface.
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:19,000 --> 00:00:24,000
|
| 19 |
+
And I hope you didn't skip lessons because in previous lessons during the General Overy, we already
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:24,000 --> 00:00:28,000
|
| 23 |
+
talked about you and discussed Masset that this interface has.
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:29,000 --> 00:00:31,000
|
| 27 |
+
But today we'll dive into the details.
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:31,000 --> 00:00:34,000
|
| 31 |
+
After that, we'll learn methods in that interface.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:34,000 --> 00:00:38,000
|
| 35 |
+
Today, we're going to learn what is the difference between these two interfaces.
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:39,000 --> 00:00:44,000
|
| 39 |
+
Also, we'll learn what FTF old principle is and what LIFO principle is.
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:45,000 --> 00:00:51,000
|
| 43 |
+
After we learn interfaces, we'll take a look at the most popular Q and deck implementations.
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:51,000 --> 00:00:54,000
|
| 47 |
+
And I will share with you practical tips and practical cases.
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:55,000 --> 00:01:00,000
|
| 51 |
+
And at the end of the lesson, we are going to review your home task and I will explain how you can
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:01:00,000 --> 00:01:01,000
|
| 55 |
+
practice your skills.
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:01:01,000 --> 00:01:07,000
|
| 59 |
+
Let's start and to understand what CU is, we have to understand what FTF old principle is.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:01:08,000 --> 00:01:16,000
|
| 63 |
+
If you don't skip lessons, then you remember that FCF also is a method of organizing of a data structure
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:16,000 --> 00:01:22,000
|
| 67 |
+
where the first elements that enter the queue, the first leifs is a Q, in other words, the head of
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:22,000 --> 00:01:30,000
|
| 71 |
+
the queue always processed first f i f o stands for first in first out here on the slide you may see
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:30,000 --> 00:01:34,000
|
| 75 |
+
brutalisation of the Q the Q has the head and the tail.
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:35,000 --> 00:01:41,000
|
| 79 |
+
Students usually wondered where the heart of the Q is and where style of the Q by convention.
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:41,000 --> 00:01:49,000
|
| 83 |
+
The end of the queue at which elements are added is called the tail back Oriya of the Q The end at which
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:49,000 --> 00:01:53,000
|
| 87 |
+
elements are removed is called the hat or front of the Q.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:53,000 --> 00:01:58,000
|
| 91 |
+
Analogously two words used when people line up to wait for goods or services.
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:58,000 --> 00:02:00,000
|
| 95 |
+
Does it make sense now?
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:02:00,000 --> 00:02:03,000
|
| 99 |
+
If yes, then let's answer our next question.
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:02:03,000 --> 00:02:05,000
|
| 103 |
+
Where Q is used.
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:02:05,000 --> 00:02:07,000
|
| 107 |
+
Imagine that you have two services.
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:02:07,000 --> 00:02:11,000
|
| 111 |
+
The first service is in charge of onboarding of new customer.
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:02:11,000 --> 00:02:18,000
|
| 115 |
+
This service process information about the user verifies his payment method at him to the theorem,
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:02:18,000 --> 00:02:24,000
|
| 119 |
+
checks whether this user already registered, etc. Let's call it onboarding service.
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:24,000 --> 00:02:30,000
|
| 123 |
+
And another service is in charge of handling all payments from the user for his subscription on a monthly
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:30,000 --> 00:02:30,000
|
| 127 |
+
basis.
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:31,000 --> 00:02:33,000
|
| 131 |
+
Let's call this payment service.
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:33,000 --> 00:02:39,000
|
| 135 |
+
Those are two independent services because the first one is in charge of selling subscriptions to customer
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:39,000 --> 00:02:41,000
|
| 139 |
+
only on one side.
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:41,000 --> 00:02:47,000
|
| 143 |
+
But they are different of the similar marketing sites that promotes different products and services
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:47,000 --> 00:02:47,000
|
| 147 |
+
of the company.
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:48,000 --> 00:02:54,000
|
| 151 |
+
Our onboarding service is one out of many services, but the service that is responsible for charging
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:54,000 --> 00:03:00,000
|
| 155 |
+
clients on a monthly basis is used by all websites and systems within the same company.
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:03:01,000 --> 00:03:06,000
|
| 159 |
+
This is real life scenarios that my team implemented in simplified form also.
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:03:06,000 --> 00:03:08,000
|
| 163 |
+
But still, I believe you got my point.
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:03:08,000 --> 00:03:14,000
|
| 167 |
+
And before process payment information from any of the website, the queue exists.
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:03:14,000 --> 00:03:21,000
|
| 171 |
+
It exists right in the middle between all services and charge and service and all services, including
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:03:21,000 --> 00:03:25,000
|
| 175 |
+
our onboarding service submits the message in the queue.
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:25,000 --> 00:03:33,000
|
| 179 |
+
The message contains payment profile of our customer and product details and our payment service process.
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:33,000 --> 00:03:39,000
|
| 183 |
+
All these messages one by one and implements all necessary logic related for recurring payments.
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:40,000 --> 00:03:41,000
|
| 187 |
+
Does it make more sense now?
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:42,000 --> 00:03:43,000
|
| 191 |
+
Can you understand now?
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:43,000 --> 00:03:45,000
|
| 195 |
+
Why do we need Kyuss hope?
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:45,000 --> 00:03:49,000
|
| 199 |
+
This brings more clarity and you understand why we need to use Qs.
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:50,000 --> 00:03:57,000
|
| 203 |
+
OK, if you understood cuz let's understand what a deck is and to understand that we have to understand
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:57,000 --> 00:03:59,000
|
| 207 |
+
what LIFO principle is.
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:04:00,000 --> 00:04:06,000
|
| 211 |
+
LIFO is a method of organizing the manipulation of a data, whereas the last element that entered the
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:04:06,000 --> 00:04:09,000
|
| 215 |
+
container should be processed first.
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:04:09,000 --> 00:04:12,000
|
| 219 |
+
LIFO stands for Last In, First Out.
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:04:13,000 --> 00:04:19,000
|
| 223 |
+
If you remember stack class that extends vector, that is also implementation of LIFO principle.
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:04:20,000 --> 00:04:23,000
|
| 227 |
+
And on the screen you can see visualisation of stack.
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:04:23,000 --> 00:04:30,000
|
| 231 |
+
But where we might want to apply LIFO principle, the easiest example of that usage, which you are
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:04:30,000 --> 00:04:32,000
|
| 235 |
+
faced with on a daily basis, is in the clips.
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:04:33,000 --> 00:04:36,000
|
| 239 |
+
Have you ever used and do operations in Eclipse?
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:36,000 --> 00:04:38,000
|
| 243 |
+
How do you think the operation works?
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:39,000 --> 00:04:45,000
|
| 247 |
+
Each batch of changes is put in the stack and then the case and those short cards is correct.
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:45,000 --> 00:04:48,000
|
| 251 |
+
The latest separation is removed from the stack.
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:48,000 --> 00:04:51,000
|
| 255 |
+
For example, you wrote Hello World.
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:51,000 --> 00:04:54,000
|
| 259 |
+
The World World is on top of your stack.
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:54,000 --> 00:04:58,000
|
| 263 |
+
When you want to run the operation, it leaves the stack first.
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:04:58,000 --> 00:05:00,000
|
| 267 |
+
Or imagine your browser history.
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:05:00,000 --> 00:05:02,000
|
| 271 |
+
You open new pages and then you need.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:05:03,000 --> 00:05:10,000
|
| 275 |
+
The return on the previous page or asset allocation in your Java program, we can call one message from
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:05:10,000 --> 00:05:16,000
|
| 279 |
+
another one and after that call one more method how to track the flow of program execution only with
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:05:16,000 --> 00:05:23,000
|
| 283 |
+
the help of the stack data structure that stores elements according to LIFO method that it makes more
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:05:23,000 --> 00:05:23,000
|
| 287 |
+
sense.
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:05:23,000 --> 00:05:26,000
|
| 291 |
+
Now, can you understand now when do we need stack?
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:05:27,000 --> 00:05:27,000
|
| 295 |
+
Awesome.
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:05:28,000 --> 00:05:34,000
|
| 299 |
+
And now when you understood what CU and DEC is and why we need them, I suggest dive deeper into the
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:34,000 --> 00:05:36,000
|
| 303 |
+
details and learn interfaces.
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:36,000 --> 00:05:40,000
|
| 307 |
+
Here is a new interface we have at and of a message here.
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:41,000 --> 00:05:43,000
|
| 311 |
+
Both exist to add elements to the queue.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:44,000 --> 00:05:47,000
|
| 315 |
+
Both returns through in case element was added to the queue.
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:05:48,000 --> 00:05:52,000
|
| 319 |
+
Then why do we need two similar methods and why do we need add method here?
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:05:52,000 --> 00:05:54,000
|
| 323 |
+
If it is present in collection interface?
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:05:55,000 --> 00:06:01,000
|
| 327 |
+
Let's understand the difference at that is present in queue interface to highlight the specific behavior
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:06:01,000 --> 00:06:06,000
|
| 331 |
+
of that method in queue type add method adds elements to the queue.
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:06:06,000 --> 00:06:12,000
|
| 335 |
+
But as you can see from the documentation here in legal state, exceptions will be thrown in case element
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:06:12,000 --> 00:06:15,000
|
| 339 |
+
couldn't be added because of the capacity restrictions.
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:06:16,000 --> 00:06:21,000
|
| 343 |
+
To be honest, in most of the cases you wouldn't see this error while working with the implementation
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:06:21,000 --> 00:06:23,000
|
| 347 |
+
of the queue interface.
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:06:23,000 --> 00:06:23,000
|
| 351 |
+
Why?
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:06:24,000 --> 00:06:29,000
|
| 355 |
+
Because most of the implementations have no restrictions on capacity and their unbounded.
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:06:30,000 --> 00:06:34,000
|
| 359 |
+
And in this case there is no difference between at and of.
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:34,000 --> 00:06:41,000
|
| 363 |
+
A method of a method doesn't throw exception in case element is not added because of the capacity restrictions.
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:41,000 --> 00:06:44,000
|
| 367 |
+
It also can return false hope.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:44,000 --> 00:06:49,000
|
| 371 |
+
This knowledge will help you during the interview, in case you will be asked what the difference is
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:49,000 --> 00:06:52,000
|
| 375 |
+
between add and offer method in queue interface.
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:52,000 --> 00:06:53,000
|
| 379 |
+
Let's move on.
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:06:53,000 --> 00:06:58,000
|
| 383 |
+
We have two methods to retrieve elements from the heart of the queue and remove it from the queue.
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:06:59,000 --> 00:07:01,000
|
| 387 |
+
Zaya, remove and pull.
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:07:01,000 --> 00:07:06,000
|
| 391 |
+
The only difference between them is the way how they behave in case there are no more elements in the
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:07:06,000 --> 00:07:07,000
|
| 395 |
+
queue.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:07:07,000 --> 00:07:13,000
|
| 399 |
+
Remove Masset in this case will throw no such element exception and Paul MassArt will just returns.
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:07:13,000 --> 00:07:16,000
|
| 403 |
+
And now what do you see in real life?
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:07:16,000 --> 00:07:19,000
|
| 407 |
+
I would say evaluate the logic of execution of your program.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:07:19,000 --> 00:07:26,000
|
| 411 |
+
First, in case you would ask me what method I would use, I would use full method and would just perform
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:07:26,000 --> 00:07:26,000
|
| 415 |
+
null check.
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:27,000 --> 00:07:31,000
|
| 419 |
+
I just afraid of all exceptions and I would rather opt for options.
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:31,000 --> 00:07:37,000
|
| 423 |
+
That doesn't throw an exception, but all cases and programming styles are different and I can accept
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:37,000 --> 00:07:38,000
|
| 427 |
+
that.
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:38,000 --> 00:07:40,000
|
| 431 |
+
And that's why it's up to you.
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:40,000 --> 00:07:44,000
|
| 435 |
+
Which method to choose is a similar situation with the next two methods.
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:45,000 --> 00:07:50,000
|
| 439 |
+
We have two methods that allows us to get the elements from the head of the queue, but that don't remove
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:07:50,000 --> 00:07:54,000
|
| 443 |
+
element from the queue zaya element and pick.
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:07:55,000 --> 00:07:58,000
|
| 447 |
+
The only difference is that element Masad Maestro.
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:07:58,000 --> 00:08:03,000
|
| 451 |
+
No such element exception in case there is no more aliments and big method would just return.
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:08:03,000 --> 00:08:06,000
|
| 455 |
+
Now you already know what I would choose.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:08:06,000 --> 00:08:09,000
|
| 459 |
+
That's all methods that are declared in queue interface.
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:08:09,000 --> 00:08:14,000
|
| 463 |
+
Let's move further and let's investigate what message do we have in that interface.
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:08:14,000 --> 00:08:22,000
|
| 467 |
+
So as we already discussed, that extends queue interface and organizes data according to LIFG principle.
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:08:23,000 --> 00:08:28,000
|
| 471 |
+
Let's review methods now that are present here in the top of our list.
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:08:28,000 --> 00:08:34,000
|
| 475 |
+
We can find a lot of similar methods that can work with the head and with the tail of the queue at first
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:08:34,000 --> 00:08:37,000
|
| 479 |
+
and at last of a first and of last.
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:38,000 --> 00:08:44,000
|
| 483 |
+
Remove first and remove last, both first and last week first and pick last.
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:44,000 --> 00:08:46,000
|
| 487 |
+
I believe it is clear how they work.
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:46,000 --> 00:08:52,000
|
| 491 |
+
Since we discussed similar methods in queue interface, I noticed that there is no element first and
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:52,000 --> 00:08:57,000
|
| 495 |
+
element last method if to follow the analogy in is naming.
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:08:57,000 --> 00:09:03,000
|
| 499 |
+
But do we have methods that doesn't remove element from the queue and throws an exception in case there
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:09:03,000 --> 00:09:03,000
|
| 503 |
+
is no element?
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:09:04,000 --> 00:09:08,000
|
| 507 |
+
Yes, we have aget first and last method here.
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:09:08,000 --> 00:09:14,000
|
| 511 |
+
They here also to interest in masses, remove first Securus and remove last appearance.
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:09:14,000 --> 00:09:20,000
|
| 515 |
+
When we are referring to the first occurrence, we mean first in case we would reverse elements from
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:09:20,000 --> 00:09:21,000
|
| 519 |
+
the had the tail.
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:09:21,000 --> 00:09:27,000
|
| 523 |
+
So the first Securus will be closer to the heart of the queue and the last appearance is closer to the
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:09:27,000 --> 00:09:28,000
|
| 527 |
+
tail of the queue.
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:09:29,000 --> 00:09:36,000
|
| 531 |
+
After that abasic message from the queue go here and en masse, it adds all elements to the container,
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:09:36,000 --> 00:09:39,000
|
| 535 |
+
the same as it is declared in connection interface.
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:09:39,000 --> 00:09:45,000
|
| 539 |
+
There is only one clarification that all elements will be inserted into the end of the queue.
|
| 540 |
+
|
| 541 |
+
136
|
| 542 |
+
00:09:45,000 --> 00:09:47,000
|
| 543 |
+
And here are static methods.
|
| 544 |
+
|
| 545 |
+
137
|
| 546 |
+
00:09:47,000 --> 00:09:53,000
|
| 547 |
+
We already discussed what the stack is and here's a mass to manage stack push.
|
| 548 |
+
|
| 549 |
+
138
|
| 550 |
+
00:09:53,000 --> 00:09:55,000
|
| 551 |
+
It adds element in the heart of the queue.
|
| 552 |
+
|
| 553 |
+
139
|
| 554 |
+
00:09:55,000 --> 00:09:58,000
|
| 555 |
+
This method will throw illegal state exception in the case.
|
| 556 |
+
|
| 557 |
+
140
|
| 558 |
+
00:09:58,000 --> 00:10:02,000
|
| 559 |
+
Element can't be added due to capacity restrictions.
|
| 560 |
+
|
| 561 |
+
141
|
| 562 |
+
00:10:02,000 --> 00:10:05,000
|
| 563 |
+
This method is similar to at first method.
|
| 564 |
+
|
| 565 |
+
142
|
| 566 |
+
00:10:05,000 --> 00:10:08,000
|
| 567 |
+
This is even specified in general documentation.
|
| 568 |
+
|
| 569 |
+
143
|
| 570 |
+
00:10:08,000 --> 00:10:10,000
|
| 571 |
+
Then why do we need it at all?
|
| 572 |
+
|
| 573 |
+
144
|
| 574 |
+
00:10:11,000 --> 00:10:16,000
|
| 575 |
+
For compatibility reasons with legacy class stack, the push and pop methods exist.
|
| 576 |
+
|
| 577 |
+
145
|
| 578 |
+
00:10:16,000 --> 00:10:21,000
|
| 579 |
+
This means that they're only to make a transition of all code easier for programa.
|
| 580 |
+
|
| 581 |
+
146
|
| 582 |
+
00:10:22,000 --> 00:10:26,000
|
| 583 |
+
The pop method is here and it is equivalent of remove first MassArt.
|
| 584 |
+
|
| 585 |
+
147
|
| 586 |
+
00:10:27,000 --> 00:10:32,000
|
| 587 |
+
And I believe you already understood why Oracle left this method in this interface.
|
| 588 |
+
|
| 589 |
+
148
|
| 590 |
+
00:10:32,000 --> 00:10:36,000
|
| 591 |
+
The last message that we didn't talk about is the sending iterator.
|
| 592 |
+
|
| 593 |
+
149
|
| 594 |
+
00:10:37,000 --> 00:10:42,000
|
| 595 |
+
This message, according to the interface, should return iterator objects that can iterate over the
|
| 596 |
+
|
| 597 |
+
150
|
| 598 |
+
00:10:42,000 --> 00:10:44,000
|
| 599 |
+
elements in reverse sequential order.
|
| 600 |
+
|
| 601 |
+
151
|
| 602 |
+
00:10:45,000 --> 00:10:50,000
|
| 603 |
+
That is from the last element from our tail to the first element to our hat.
|
| 604 |
+
|
| 605 |
+
152
|
| 606 |
+
00:10:51,000 --> 00:10:54,000
|
| 607 |
+
That's all matters that we have in our back interface.
|
| 608 |
+
|
| 609 |
+
153
|
| 610 |
+
00:10:54,000 --> 00:10:58,000
|
| 611 |
+
Now let's investigate the most popular Q and deck implementations.
|
| 612 |
+
|
| 613 |
+
154
|
| 614 |
+
00:10:59,000 --> 00:11:05,000
|
| 615 |
+
On this slide, you can see the most popular implementations of Q and back interfaces, I recommend
|
| 616 |
+
|
| 617 |
+
155
|
| 618 |
+
00:11:05,000 --> 00:11:08,000
|
| 619 |
+
you post the video and read the slide attentively.
|
| 620 |
+
|
| 621 |
+
156
|
| 622 |
+
00:11:09,000 --> 00:11:13,000
|
| 623 |
+
I believe there is no need to investigate each of these class in details.
|
| 624 |
+
|
| 625 |
+
157
|
| 626 |
+
00:11:13,000 --> 00:11:19,000
|
| 627 |
+
It is better to put our focus on the most popular implementations, the most popular implementation,
|
| 628 |
+
|
| 629 |
+
158
|
| 630 |
+
00:11:19,000 --> 00:11:26,000
|
| 631 |
+
in my opinion, and based on the official Oracle tutorials can be split in two major categories implementations
|
| 632 |
+
|
| 633 |
+
159
|
| 634 |
+
00:11:26,000 --> 00:11:30,000
|
| 635 |
+
of the interface and implementations of just rescue interface.
|
| 636 |
+
|
| 637 |
+
160
|
| 638 |
+
00:11:30,000 --> 00:11:36,000
|
| 639 |
+
In case you need the implementations, then most likely you will be happy with slinked list or array
|
| 640 |
+
|
| 641 |
+
161
|
| 642 |
+
00:11:36,000 --> 00:11:37,000
|
| 643 |
+
that class.
|
| 644 |
+
|
| 645 |
+
162
|
| 646 |
+
00:11:37,000 --> 00:11:43,000
|
| 647 |
+
If you need Q implementations, most likely you will opt for lenth list of priority queue if you need
|
| 648 |
+
|
| 649 |
+
163
|
| 650 |
+
00:11:43,000 --> 00:11:45,000
|
| 651 |
+
thread safe implementations of the queue.
|
| 652 |
+
|
| 653 |
+
164
|
| 654 |
+
00:11:45,000 --> 00:11:50,000
|
| 655 |
+
I would like to draw attention to avoid blocking Q and priority blocking queue.
|
| 656 |
+
|
| 657 |
+
165
|
| 658 |
+
00:11:50,000 --> 00:11:55,000
|
| 659 |
+
If you need thread safe implementations of DEC, then your choice is linked lock and DEC.
|
| 660 |
+
|
| 661 |
+
166
|
| 662 |
+
00:11:56,000 --> 00:11:58,000
|
| 663 |
+
As you can see there is really a lot of options.
|
| 664 |
+
|
| 665 |
+
167
|
| 666 |
+
00:11:59,000 --> 00:12:06,000
|
| 667 |
+
But in my opinion and based on my experience in 95 percent of cases when you would need to use DEC implementation
|
| 668 |
+
|
| 669 |
+
168
|
| 670 |
+
00:12:06,000 --> 00:12:12,000
|
| 671 |
+
to implement some stack or in case you would need Q you would use in case class the rest five percent
|
| 672 |
+
|
| 673 |
+
169
|
| 674 |
+
00:12:12,000 --> 00:12:17,000
|
| 675 |
+
of cases is for thread safe implementation of the Q and DEC and also priority.
|
| 676 |
+
|
| 677 |
+
170
|
| 678 |
+
00:12:17,000 --> 00:12:25,000
|
| 679 |
+
Q taking into account we already had lesson about Lindley's and we already learned the Q and DEC interfaces.
|
| 680 |
+
|
| 681 |
+
171
|
| 682 |
+
00:12:25,000 --> 00:12:29,000
|
| 683 |
+
There will be nothing hard for you just to call these methods on linked list.
|
| 684 |
+
|
| 685 |
+
172
|
| 686 |
+
00:12:29,000 --> 00:12:34,000
|
| 687 |
+
And that is why, for the sake of the demo, I would like to show you how AQ works on the example of
|
| 688 |
+
|
| 689 |
+
173
|
| 690 |
+
00:12:34,000 --> 00:12:35,000
|
| 691 |
+
priority.
|
| 692 |
+
|
| 693 |
+
174
|
| 694 |
+
00:12:35,000 --> 00:12:38,000
|
| 695 |
+
Q So here I prepared them file.
|
| 696 |
+
|
| 697 |
+
175
|
| 698 |
+
00:12:38,000 --> 00:12:43,000
|
| 699 |
+
I will leave link to this file in attachments to the lesson so that you could copy and run this file
|
| 700 |
+
|
| 701 |
+
176
|
| 702 |
+
00:12:43,000 --> 00:12:44,000
|
| 703 |
+
on your local computer.
|
| 704 |
+
|
| 705 |
+
177
|
| 706 |
+
00:12:45,000 --> 00:12:47,000
|
| 707 |
+
Here I declare it variable of type.
|
| 708 |
+
|
| 709 |
+
178
|
| 710 |
+
00:12:47,000 --> 00:12:51,000
|
| 711 |
+
Q Parametrized with the integer type here I created object of.
|
| 712 |
+
|
| 713 |
+
179
|
| 714 |
+
00:12:52,000 --> 00:12:57,000
|
| 715 |
+
Q And in these lines you can see that I added to the Q five elements.
|
| 716 |
+
|
| 717 |
+
180
|
| 718 |
+
00:12:57,000 --> 00:13:00,000
|
| 719 |
+
They are two eight three one then.
|
| 720 |
+
|
| 721 |
+
181
|
| 722 |
+
00:13:01,000 --> 00:13:05,000
|
| 723 |
+
So in the case I'd like to take the first element in the Q what it would be.
|
| 724 |
+
|
| 725 |
+
182
|
| 726 |
+
00:13:06,000 --> 00:13:10,000
|
| 727 |
+
Take your time to think about this question because this is a trick question.
|
| 728 |
+
|
| 729 |
+
183
|
| 730 |
+
00:13:11,000 --> 00:13:17,000
|
| 731 |
+
We all know how Q works and what is a five for principle, but priority Q has interesting feature.
|
| 732 |
+
|
| 733 |
+
184
|
| 734 |
+
00:13:18,000 --> 00:13:22,000
|
| 735 |
+
It automatically source elements according to the natural order.
|
| 736 |
+
|
| 737 |
+
185
|
| 738 |
+
00:13:22,000 --> 00:13:26,000
|
| 739 |
+
I hope you didn't skip the lesson about comparator uncomparable.
|
| 740 |
+
|
| 741 |
+
186
|
| 742 |
+
00:13:26,000 --> 00:13:32,000
|
| 743 |
+
And you know that natural order is an order that is described in the compared to method because of implementation
|
| 744 |
+
|
| 745 |
+
187
|
| 746 |
+
00:13:32,000 --> 00:13:33,000
|
| 747 |
+
of comparable interface.
|
| 748 |
+
|
| 749 |
+
188
|
| 750 |
+
00:13:34,000 --> 00:13:40,000
|
| 751 |
+
And that's where a provocative word comes from in the name of the Q it prioritize elements.
|
| 752 |
+
|
| 753 |
+
189
|
| 754 |
+
00:13:40,000 --> 00:13:46,000
|
| 755 |
+
So in case I would prefer to control the elements from the head of the Q this would be one even despite
|
| 756 |
+
|
| 757 |
+
190
|
| 758 |
+
00:13:46,000 --> 00:13:50,000
|
| 759 |
+
integer object was well your one wasn't inserted the first.
|
| 760 |
+
|
| 761 |
+
191
|
| 762 |
+
00:13:51,000 --> 00:13:53,000
|
| 763 |
+
Let me run the program to show you this.
|
| 764 |
+
|
| 765 |
+
192
|
| 766 |
+
00:13:53,000 --> 00:13:57,000
|
| 767 |
+
I used polymathic to get elements from the Q and remove it.
|
| 768 |
+
|
| 769 |
+
193
|
| 770 |
+
00:13:57,000 --> 00:14:04,000
|
| 771 |
+
So the size of the Q right now is four now in case I call Big Masset and get the hell out of the Q,
|
| 772 |
+
|
| 773 |
+
194
|
| 774 |
+
00:14:04,000 --> 00:14:07,000
|
| 775 |
+
but don't remove element here.
|
| 776 |
+
|
| 777 |
+
195
|
| 778 |
+
00:14:07,000 --> 00:14:11,000
|
| 779 |
+
You can see in console output that our next object and our priority.
|
| 780 |
+
|
| 781 |
+
196
|
| 782 |
+
00:14:11,000 --> 00:14:13,000
|
| 783 |
+
Q is to and the size of the peak.
|
| 784 |
+
|
| 785 |
+
197
|
| 786 |
+
00:14:14,000 --> 00:14:21,000
|
| 787 |
+
It is still four because I didn't remove elements from the Q Pay attention to the fact that all elements
|
| 788 |
+
|
| 789 |
+
198
|
| 790 |
+
00:14:21,000 --> 00:14:22,000
|
| 791 |
+
that you put into the priority.
|
| 792 |
+
|
| 793 |
+
199
|
| 794 |
+
00:14:22,000 --> 00:14:28,000
|
| 795 |
+
Q should implement comparable interface because in case type doesn't implement comparable interface,
|
| 796 |
+
|
| 797 |
+
200
|
| 798 |
+
00:14:28,000 --> 00:14:35,000
|
| 799 |
+
Breuer's UCU object would throw exception, glossiest exception that would say that your type cannot
|
| 800 |
+
|
| 801 |
+
201
|
| 802 |
+
00:14:35,000 --> 00:14:37,000
|
| 803 |
+
be cast to comparable type.
|
| 804 |
+
|
| 805 |
+
202
|
| 806 |
+
00:14:37,000 --> 00:14:39,000
|
| 807 |
+
Let me show you an example.
|
| 808 |
+
|
| 809 |
+
203
|
| 810 |
+
00:14:39,000 --> 00:14:46,000
|
| 811 |
+
Let me comment these lines of code here, you can see that I create Q Parametrized by product type.
|
| 812 |
+
|
| 813 |
+
204
|
| 814 |
+
00:14:46,000 --> 00:14:53,000
|
| 815 |
+
Just to remind you, product is our custom type that we created during our work on online store implementation.
|
| 816 |
+
|
| 817 |
+
205
|
| 818 |
+
00:14:53,000 --> 00:14:56,000
|
| 819 |
+
After that, I want to place my product into this.
|
| 820 |
+
|
| 821 |
+
206
|
| 822 |
+
00:14:56,000 --> 00:15:04,000
|
| 823 |
+
Q Let me run the program to show you what would happen and here you can see glass cast exception.
|
| 824 |
+
|
| 825 |
+
207
|
| 826 |
+
00:15:04,000 --> 00:15:05,000
|
| 827 |
+
What to do now?
|
| 828 |
+
|
| 829 |
+
208
|
| 830 |
+
00:15:06,000 --> 00:15:07,000
|
| 831 |
+
We have two options here.
|
| 832 |
+
|
| 833 |
+
209
|
| 834 |
+
00:15:08,000 --> 00:15:13,000
|
| 835 |
+
The first one is to use only types that implement comparable interface.
|
| 836 |
+
|
| 837 |
+
210
|
| 838 |
+
00:15:13,000 --> 00:15:16,000
|
| 839 |
+
The second option is to set our priority.
|
| 840 |
+
|
| 841 |
+
211
|
| 842 |
+
00:15:16,000 --> 00:15:18,000
|
| 843 |
+
Q How to compare elements.
|
| 844 |
+
|
| 845 |
+
212
|
| 846 |
+
00:15:18,000 --> 00:15:23,000
|
| 847 |
+
Let me comment these lines of code to show you the next example here.
|
| 848 |
+
|
| 849 |
+
213
|
| 850 |
+
00:15:23,000 --> 00:15:29,000
|
| 851 |
+
You can see that I created the same Q Parametrized by product type, but I pass the product comparison
|
| 852 |
+
|
| 853 |
+
214
|
| 854 |
+
00:15:29,000 --> 00:15:31,000
|
| 855 |
+
to the constructor of prosecute.
|
| 856 |
+
|
| 857 |
+
215
|
| 858 |
+
00:15:32,000 --> 00:15:40,000
|
| 859 |
+
Now my project knows how to compare products and saw them let me run the program and we can't see error
|
| 860 |
+
|
| 861 |
+
216
|
| 862 |
+
00:15:40,000 --> 00:15:40,000
|
| 863 |
+
anymore.
|
| 864 |
+
|
| 865 |
+
217
|
| 866 |
+
00:15:41,000 --> 00:15:47,000
|
| 867 |
+
That is because our Q knows how to prioritize products, where to use priority.
|
| 868 |
+
|
| 869 |
+
218
|
| 870 |
+
00:15:47,000 --> 00:15:51,000
|
| 871 |
+
Q Imagine that you want to implement helpdesk during the day.
|
| 872 |
+
|
| 873 |
+
219
|
| 874 |
+
00:15:51,000 --> 00:15:57,000
|
| 875 |
+
You receive tons of requests and complaints, but you have limited number of operators in your company
|
| 876 |
+
|
| 877 |
+
220
|
| 878 |
+
00:15:57,000 --> 00:15:58,000
|
| 879 |
+
that can.
|
| 880 |
+
|
| 881 |
+
221
|
| 882 |
+
00:15:58,000 --> 00:16:05,000
|
| 883 |
+
These requests and you have special app for your operators where each operator can click a button,
|
| 884 |
+
|
| 885 |
+
222
|
| 886 |
+
00:16:05,000 --> 00:16:12,000
|
| 887 |
+
they can request and move it in progress, and it is obvious that most critical requests should be processed
|
| 888 |
+
|
| 889 |
+
223
|
| 890 |
+
00:16:12,000 --> 00:16:18,000
|
| 891 |
+
first in case a customer can't make a payment in the online store or customer already paid.
|
| 892 |
+
|
| 893 |
+
224
|
| 894 |
+
00:16:18,000 --> 00:16:23,000
|
| 895 |
+
But some error happened and he or she can't get details of his order.
|
| 896 |
+
|
| 897 |
+
225
|
| 898 |
+
00:16:23,000 --> 00:16:29,000
|
| 899 |
+
That is more critical than some random question, like one sorting by manufacturer will be implemented
|
| 900 |
+
|
| 901 |
+
226
|
| 902 |
+
00:16:29,000 --> 00:16:30,000
|
| 903 |
+
on your site.
|
| 904 |
+
|
| 905 |
+
227
|
| 906 |
+
00:16:30,000 --> 00:16:37,000
|
| 907 |
+
They agree with me and what you have to do probably on the front end, you would implement some dropdown
|
| 908 |
+
|
| 909 |
+
228
|
| 910 |
+
00:16:37,000 --> 00:16:40,000
|
| 911 |
+
where you would ask your customer to categorize request.
|
| 912 |
+
|
| 913 |
+
229
|
| 914 |
+
00:16:41,000 --> 00:16:47,000
|
| 915 |
+
For example, here on the slide you can see example of support of Panya in your system.
|
| 916 |
+
|
| 917 |
+
230
|
| 918 |
+
00:16:47,000 --> 00:16:50,000
|
| 919 |
+
You have some object, something like support ticket type.
|
| 920 |
+
|
| 921 |
+
231
|
| 922 |
+
00:16:50,000 --> 00:16:54,000
|
| 923 |
+
You also have to implement logic that would assign support ticket type.
|
| 924 |
+
|
| 925 |
+
232
|
| 926 |
+
00:16:54,000 --> 00:17:00,000
|
| 927 |
+
And based on the type of the request, you would assign priority, high, medium or low.
|
| 928 |
+
|
| 929 |
+
233
|
| 930 |
+
00:17:00,000 --> 00:17:04,000
|
| 931 |
+
And after that you would pull your support ticket object into the queue.
|
| 932 |
+
|
| 933 |
+
234
|
| 934 |
+
00:17:05,000 --> 00:17:11,000
|
| 935 |
+
And you already know that we have to either implement compatible interface in our support ticket or
|
| 936 |
+
|
| 937 |
+
235
|
| 938 |
+
00:17:11,000 --> 00:17:14,000
|
| 939 |
+
we have to create a competitor and pass it to priority queue.
|
| 940 |
+
|
| 941 |
+
236
|
| 942 |
+
00:17:14,000 --> 00:17:15,000
|
| 943 |
+
Interesting.
|
| 944 |
+
|
| 945 |
+
237
|
| 946 |
+
00:17:15,000 --> 00:17:17,000
|
| 947 |
+
I hope it is.
|
| 948 |
+
|
| 949 |
+
238
|
| 950 |
+
00:17:17,000 --> 00:17:23,000
|
| 951 |
+
And moreover, implementing something like this already a real life task for our software engineer.
|
| 952 |
+
|
| 953 |
+
239
|
| 954 |
+
00:17:23,000 --> 00:17:25,000
|
| 955 |
+
This will be your homework.
|
| 956 |
+
|
| 957 |
+
240
|
| 958 |
+
00:17:25,000 --> 00:17:30,000
|
| 959 |
+
But before I would share with you the details of your homework, let's recap what we have learned today.
|
| 960 |
+
|
| 961 |
+
241
|
| 962 |
+
00:17:31,000 --> 00:17:33,000
|
| 963 |
+
Today we learned Q and DEC interfaces.
|
| 964 |
+
|
| 965 |
+
242
|
| 966 |
+
00:17:34,000 --> 00:17:38,000
|
| 967 |
+
We learned in detail how matters that are described in these interfaces work.
|
| 968 |
+
|
| 969 |
+
243
|
| 970 |
+
00:17:39,000 --> 00:17:43,000
|
| 971 |
+
We learned what a FFO and LIFO data store methods are.
|
| 972 |
+
|
| 973 |
+
244
|
| 974 |
+
00:17:44,000 --> 00:17:49,000
|
| 975 |
+
We used you and DEC implementations and learned the most popular ones after that.
|
| 976 |
+
|
| 977 |
+
245
|
| 978 |
+
00:17:49,000 --> 00:17:56,000
|
| 979 |
+
On the real example, we learned how particular works and now I suggest reviewing your homework.
|
| 980 |
+
|
| 981 |
+
246
|
| 982 |
+
00:17:56,000 --> 00:18:02,000
|
| 983 |
+
You have to implement helpdesk facades that would serve as a main interface for a support engineer to
|
| 984 |
+
|
| 985 |
+
247
|
| 986 |
+
00:18:02,000 --> 00:18:09,000
|
| 987 |
+
interact with the system, helpdesk facade interface has only three masses that you support.
|
| 988 |
+
|
| 989 |
+
248
|
| 990 |
+
00:18:09,000 --> 00:18:16,000
|
| 991 |
+
You could get next support ticket and get a number of tickets according to our requirements, get next
|
| 992 |
+
|
| 993 |
+
249
|
| 994 |
+
00:18:16,000 --> 00:18:16,000
|
| 995 |
+
support ticket.
|
| 996 |
+
|
| 997 |
+
250
|
| 998 |
+
00:18:16,000 --> 00:18:20,000
|
| 999 |
+
Masset will be called when your support engineer would click on the button.
|
| 1000 |
+
|
| 1001 |
+
251
|
| 1002 |
+
00:18:21,000 --> 00:18:24,000
|
| 1003 |
+
This message should return top priority item.
|
| 1004 |
+
|
| 1005 |
+
252
|
| 1006 |
+
00:18:24,000 --> 00:18:29,000
|
| 1007 |
+
I almost explained to you how to implement Help Desk in the online store.
|
| 1008 |
+
|
| 1009 |
+
253
|
| 1010 |
+
00:18:29,000 --> 00:18:35,000
|
| 1011 |
+
Here you can find the details about what request type might be and priority for specific request type
|
| 1012 |
+
|
| 1013 |
+
254
|
| 1014 |
+
00:18:36,000 --> 00:18:42,000
|
| 1015 |
+
during the creation of the support ticket will specify only typos request and its priority is defined
|
| 1016 |
+
|
| 1017 |
+
255
|
| 1018 |
+
00:18:42,000 --> 00:18:45,000
|
| 1019 |
+
automatically based on the Moppin that are written down in the table.
|
| 1020 |
+
|
| 1021 |
+
256
|
| 1022 |
+
00:18:46,000 --> 00:18:48,000
|
| 1023 |
+
And there is one more requirement in the case.
|
| 1024 |
+
|
| 1025 |
+
257
|
| 1026 |
+
00:18:48,000 --> 00:18:51,000
|
| 1027 |
+
Support tickets have the same priority.
|
| 1028 |
+
|
| 1029 |
+
258
|
| 1030 |
+
00:18:51,000 --> 00:18:54,000
|
| 1031 |
+
The one that was created earlier should be processed first.
|
| 1032 |
+
|
| 1033 |
+
259
|
| 1034 |
+
00:18:55,000 --> 00:18:57,000
|
| 1035 |
+
I can give you a small hint here.
|
| 1036 |
+
|
| 1037 |
+
260
|
| 1038 |
+
00:18:57,000 --> 00:18:58,000
|
| 1039 |
+
You can implement counter.
|
| 1040 |
+
|
| 1041 |
+
261
|
| 1042 |
+
00:18:59,000 --> 00:19:04,000
|
| 1043 |
+
This even might be static field and you may consider the value of this field when you would compare
|
| 1044 |
+
|
| 1045 |
+
262
|
| 1046 |
+
00:19:04,000 --> 00:19:06,000
|
| 1047 |
+
to support tickets, for example.
|
| 1048 |
+
|
| 1049 |
+
263
|
| 1050 |
+
00:19:06,000 --> 00:19:08,000
|
| 1051 |
+
Does it make sense home?
|
| 1052 |
+
|
| 1053 |
+
264
|
| 1054 |
+
00:19:08,000 --> 00:19:09,000
|
| 1055 |
+
The task is clear for you.
|
| 1056 |
+
|
| 1057 |
+
265
|
| 1058 |
+
00:19:10,000 --> 00:19:15,000
|
| 1059 |
+
This is a really interesting task that will help you a lot in understanding of the cues and will give
|
| 1060 |
+
|
| 1061 |
+
266
|
| 1062 |
+
00:19:15,000 --> 00:19:17,000
|
| 1063 |
+
you some clues to real life experience.
|
| 1064 |
+
|
| 1065 |
+
267
|
| 1066 |
+
00:19:18,000 --> 00:19:19,000
|
| 1067 |
+
Thank you all for your attention.
|
| 1068 |
+
|
| 1069 |
+
268
|
| 1070 |
+
00:19:19,000 --> 00:19:22,000
|
| 1071 |
+
Have a great day and see you in the next lesson.
|
| 1072 |
+
|
19 - Java Collections Framework/012 Solution-for-Homework-Back-end-system-for-help-desk.url
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[InternetShortcut]
|
| 2 |
+
URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/hw/onlinestore/withlist/helpdesk
|
19 - Java Collections Framework/012 Source-code-of-the-example-used-in-the-lesson.url
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[InternetShortcut]
|
| 2 |
+
URL=https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/collections/queue/QueueDemo.java
|
19 - Java Collections Framework/014 Map Hierarchy_en.srt
ADDED
|
@@ -0,0 +1,876 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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 --> 00:00:11,000
|
| 3 |
+
Hello, dear students, today we have important topic we are going to review another Iraq of Java collections
|
| 4 |
+
|
| 5 |
+
2
|
| 6 |
+
00:00:11,000 --> 00:00:14,000
|
| 7 |
+
framework that is MOP Iraqi today.
|
| 8 |
+
|
| 9 |
+
3
|
| 10 |
+
00:00:14,000 --> 00:00:16,000
|
| 11 |
+
We are going to run map interface.
|
| 12 |
+
|
| 13 |
+
4
|
| 14 |
+
00:00:16,000 --> 00:00:20,000
|
| 15 |
+
We are also going to review such interfaces like sorted map and navigable map.
|
| 16 |
+
|
| 17 |
+
5
|
| 18 |
+
00:00:21,000 --> 00:00:26,000
|
| 19 |
+
I'm going to hold overview of implementations of map interface and what features they have.
|
| 20 |
+
|
| 21 |
+
6
|
| 22 |
+
00:00:27,000 --> 00:00:32,000
|
| 23 |
+
Also, we'll talk about what the dictionary is and how hash tablecloth is different from hash map.
|
| 24 |
+
|
| 25 |
+
7
|
| 26 |
+
00:00:32,000 --> 00:00:37,000
|
| 27 |
+
After we learn, Ceri will focus on map interface and its methods.
|
| 28 |
+
|
| 29 |
+
8
|
| 30 |
+
00:00:37,000 --> 00:00:39,000
|
| 31 |
+
Your review of map interface.
|
| 32 |
+
|
| 33 |
+
9
|
| 34 |
+
00:00:39,000 --> 00:00:41,000
|
| 35 |
+
We also will learn what entry type is.
|
| 36 |
+
|
| 37 |
+
10
|
| 38 |
+
00:00:42,000 --> 00:00:46,000
|
| 39 |
+
As you can see that we have a lot of things to learn in our plans.
|
| 40 |
+
|
| 41 |
+
11
|
| 42 |
+
00:00:46,000 --> 00:00:53,000
|
| 43 |
+
Let's start and I'd like to start with you from the overview of Map Iraqi first and the key features
|
| 44 |
+
|
| 45 |
+
12
|
| 46 |
+
00:00:53,000 --> 00:00:53,000
|
| 47 |
+
of MAP.
|
| 48 |
+
|
| 49 |
+
13
|
| 50 |
+
00:00:54,000 --> 00:01:00,000
|
| 51 |
+
And after we learn this, we are going to dive deeper in the details to investigate each interface in
|
| 52 |
+
|
| 53 |
+
14
|
| 54 |
+
00:01:00,000 --> 00:01:04,000
|
| 55 |
+
particular on the top of our Iraqi, we have map interface.
|
| 56 |
+
|
| 57 |
+
15
|
| 58 |
+
00:01:04,000 --> 00:01:07,000
|
| 59 |
+
This type exists to map keys to values.
|
| 60 |
+
|
| 61 |
+
16
|
| 62 |
+
00:01:07,000 --> 00:01:11,000
|
| 63 |
+
All keys are unique, various may be duplicated.
|
| 64 |
+
|
| 65 |
+
17
|
| 66 |
+
00:01:11,000 --> 00:01:15,000
|
| 67 |
+
And there are a lot of places and our programs where we can apply map implementations.
|
| 68 |
+
|
| 69 |
+
18
|
| 70 |
+
00:01:16,000 --> 00:01:22,000
|
| 71 |
+
If you remember on one of the lessons I showed you example of mobile app for sports betting tips, for
|
| 72 |
+
|
| 73 |
+
19
|
| 74 |
+
00:01:22,000 --> 00:01:26,000
|
| 75 |
+
example, we can receive from server a lot of sports events.
|
| 76 |
+
|
| 77 |
+
20
|
| 78 |
+
00:01:26,000 --> 00:01:33,000
|
| 79 |
+
After that, we can group them by date and your keyword would be the specific date and the value would
|
| 80 |
+
|
| 81 |
+
21
|
| 82 |
+
00:01:33,000 --> 00:01:38,000
|
| 83 |
+
be a collection of sporting events on this day or another example, recently you have implemented Home
|
| 84 |
+
|
| 85 |
+
22
|
| 86 |
+
00:01:38,000 --> 00:01:40,000
|
| 87 |
+
Task Help Desk.
|
| 88 |
+
|
| 89 |
+
23
|
| 90 |
+
00:01:40,000 --> 00:01:41,000
|
| 91 |
+
In that task.
|
| 92 |
+
|
| 93 |
+
24
|
| 94 |
+
00:01:41,000 --> 00:01:44,000
|
| 95 |
+
You also could use map implementations to map support.
|
| 96 |
+
|
| 97 |
+
25
|
| 98 |
+
00:01:44,000 --> 00:01:47,000
|
| 99 |
+
Request type was its priority.
|
| 100 |
+
|
| 101 |
+
26
|
| 102 |
+
00:01:47,000 --> 00:01:53,000
|
| 103 |
+
In this case, support request type would be the key and it will be unique and priority would be the
|
| 104 |
+
|
| 105 |
+
27
|
| 106 |
+
00:01:53,000 --> 00:01:55,000
|
| 107 |
+
value and can be duplicated.
|
| 108 |
+
|
| 109 |
+
28
|
| 110 |
+
00:01:56,000 --> 00:02:01,000
|
| 111 |
+
And I keep creating examples on the fly because there really are a lot of cases where you need some
|
| 112 |
+
|
| 113 |
+
29
|
| 114 |
+
00:02:01,000 --> 00:02:04,000
|
| 115 |
+
data structure where you would store key value pass.
|
| 116 |
+
|
| 117 |
+
30
|
| 118 |
+
00:02:04,000 --> 00:02:07,000
|
| 119 |
+
OK, so we really understood why we need map.
|
| 120 |
+
|
| 121 |
+
31
|
| 122 |
+
00:02:07,000 --> 00:02:14,000
|
| 123 |
+
Now let's understand what specific different implementations of map interface have abstract map use
|
| 124 |
+
|
| 125 |
+
32
|
| 126 |
+
00:02:14,000 --> 00:02:21,000
|
| 127 |
+
implementations for some of the methods of map interface, hash map implementation of map interface.
|
| 128 |
+
|
| 129 |
+
33
|
| 130 |
+
00:02:21,000 --> 00:02:27,000
|
| 131 |
+
IT stores element using the mechanism of hash tables that guarantees constant amount of time for each
|
| 132 |
+
|
| 133 |
+
34
|
| 134 |
+
00:02:27,000 --> 00:02:29,000
|
| 135 |
+
region and place elements.
|
| 136 |
+
|
| 137 |
+
35
|
| 138 |
+
00:02:29,000 --> 00:02:33,000
|
| 139 |
+
That's why everyone loves hash map linked hash map.
|
| 140 |
+
|
| 141 |
+
36
|
| 142 |
+
00:02:33,000 --> 00:02:38,000
|
| 143 |
+
Besides storing elements also memorized the sequence of adding entries in the map.
|
| 144 |
+
|
| 145 |
+
37
|
| 146 |
+
00:02:39,000 --> 00:02:46,000
|
| 147 |
+
So the order of elements during the iteration is predictable because linked hash map maintains the list
|
| 148 |
+
|
| 149 |
+
38
|
| 150 |
+
00:02:46,000 --> 00:02:48,000
|
| 151 |
+
ran through all of its entries.
|
| 152 |
+
|
| 153 |
+
39
|
| 154 |
+
00:02:48,000 --> 00:02:55,000
|
| 155 |
+
If we need thread safe implementation of the map, we would opt for concurrent hash map that implements
|
| 156 |
+
|
| 157 |
+
40
|
| 158 |
+
00:02:55,000 --> 00:02:56,000
|
| 159 |
+
concurrent map.
|
| 160 |
+
|
| 161 |
+
41
|
| 162 |
+
00:02:56,000 --> 00:02:58,000
|
| 163 |
+
That in turn extends map interface.
|
| 164 |
+
|
| 165 |
+
42
|
| 166 |
+
00:02:59,000 --> 00:03:03,000
|
| 167 |
+
We have a few more interfaces that extend map interface.
|
| 168 |
+
|
| 169 |
+
43
|
| 170 |
+
00:03:03,000 --> 00:03:10,000
|
| 171 |
+
Zaya sorted map and navigable map sort of map provides ordering of a map based on its case.
|
| 172 |
+
|
| 173 |
+
44
|
| 174 |
+
00:03:11,000 --> 00:03:17,000
|
| 175 |
+
The map is ordered according to the natural order of its keys that is defined according to implementation
|
| 176 |
+
|
| 177 |
+
45
|
| 178 |
+
00:03:17,000 --> 00:03:25,000
|
| 179 |
+
of comparable interface or alternatively, Solin order may be defined by comparator navigable map extensors
|
| 180 |
+
|
| 181 |
+
46
|
| 182 |
+
00:03:25,000 --> 00:03:31,000
|
| 183 |
+
map and provides developers with possibility to return the closest matches for given such targets.
|
| 184 |
+
|
| 185 |
+
47
|
| 186 |
+
00:03:31,000 --> 00:03:38,000
|
| 187 |
+
The most popular implementations of this interface are three map and concurrence key place map for multithreaded
|
| 188 |
+
|
| 189 |
+
48
|
| 190 |
+
00:03:38,000 --> 00:03:39,000
|
| 191 |
+
environment.
|
| 192 |
+
|
| 193 |
+
49
|
| 194 |
+
00:03:40,000 --> 00:03:42,000
|
| 195 |
+
We also have APSA class dictionary.
|
| 196 |
+
|
| 197 |
+
50
|
| 198 |
+
00:03:42,000 --> 00:03:48,000
|
| 199 |
+
How it is different from the map interface you can reclass was created in Java version one and supposed
|
| 200 |
+
|
| 201 |
+
51
|
| 202 |
+
00:03:48,000 --> 00:03:52,000
|
| 203 |
+
to be a parent class for all types that map keys to values.
|
| 204 |
+
|
| 205 |
+
52
|
| 206 |
+
00:03:52,000 --> 00:03:58,000
|
| 207 |
+
Since multiple inheritance in Java is not supported by the map interface was introduced in Java version
|
| 208 |
+
|
| 209 |
+
53
|
| 210 |
+
00:03:58,000 --> 00:03:58,000
|
| 211 |
+
two.
|
| 212 |
+
|
| 213 |
+
54
|
| 214 |
+
00:03:59,000 --> 00:04:05,000
|
| 215 |
+
So I would say that dictionary is an old version of map interface and that is considered as an obsolete
|
| 216 |
+
|
| 217 |
+
55
|
| 218 |
+
00:04:05,000 --> 00:04:07,000
|
| 219 |
+
and use of map is preferred.
|
| 220 |
+
|
| 221 |
+
56
|
| 222 |
+
00:04:08,000 --> 00:04:13,000
|
| 223 |
+
But still, you might be asked about dictionary during the interview and for your common Java literacy,
|
| 224 |
+
|
| 225 |
+
57
|
| 226 |
+
00:04:13,000 --> 00:04:15,000
|
| 227 |
+
you have to be aware about it.
|
| 228 |
+
|
| 229 |
+
58
|
| 230 |
+
00:04:16,000 --> 00:04:21,000
|
| 231 |
+
Hash table is a concrete class that extends the dictionary type and internments map interface.
|
| 232 |
+
|
| 233 |
+
59
|
| 234 |
+
00:04:22,000 --> 00:04:27,000
|
| 235 |
+
It was considered as a thread safe version of hash map unless concurrent hash map was introduced in
|
| 236 |
+
|
| 237 |
+
60
|
| 238 |
+
00:04:27,000 --> 00:04:33,000
|
| 239 |
+
Java version five, the synchronization mechanism is not so efficient as it is implemented in concurrent
|
| 240 |
+
|
| 241 |
+
61
|
| 242 |
+
00:04:33,000 --> 00:04:37,000
|
| 243 |
+
Hashmat, in case you are not familiar with the trending topic.
|
| 244 |
+
|
| 245 |
+
62
|
| 246 |
+
00:04:37,000 --> 00:04:42,000
|
| 247 |
+
That would explain the difference in the implementation of low interest rate and support in these classes.
|
| 248 |
+
|
| 249 |
+
63
|
| 250 |
+
00:04:42,000 --> 00:04:46,000
|
| 251 |
+
In simple words, hash table closes the door in your home.
|
| 252 |
+
|
| 253 |
+
64
|
| 254 |
+
00:04:46,000 --> 00:04:53,000
|
| 255 |
+
Concurrent hash map closes a separate doors in your home to allow everyone to walk around the home until
|
| 256 |
+
|
| 257 |
+
65
|
| 258 |
+
00:04:53,000 --> 00:04:54,000
|
| 259 |
+
only one room is closed.
|
| 260 |
+
|
| 261 |
+
66
|
| 262 |
+
00:04:55,000 --> 00:05:01,000
|
| 263 |
+
Can you feel the difference in implementation of concurrency support in these two classes and meet later
|
| 264 |
+
|
| 265 |
+
67
|
| 266 |
+
00:05:01,000 --> 00:05:02,000
|
| 267 |
+
in the separate lessons?
|
| 268 |
+
|
| 269 |
+
68
|
| 270 |
+
00:05:02,000 --> 00:05:08,000
|
| 271 |
+
We are going to learn multithreaded together and we will get back to a thread safe map implementations.
|
| 272 |
+
|
| 273 |
+
69
|
| 274 |
+
00:05:09,000 --> 00:05:11,000
|
| 275 |
+
That's how MAP Iraqis look like.
|
| 276 |
+
|
| 277 |
+
70
|
| 278 |
+
00:05:11,000 --> 00:05:16,000
|
| 279 |
+
Before we proceed with the details, I want to finish the topic of differences between hash map and
|
| 280 |
+
|
| 281 |
+
71
|
| 282 |
+
00:05:16,000 --> 00:05:17,000
|
| 283 |
+
hash table.
|
| 284 |
+
|
| 285 |
+
72
|
| 286 |
+
00:05:18,000 --> 00:05:24,000
|
| 287 |
+
So the first thing that is different we already discussed on MassArt and hash table are synchronized.
|
| 288 |
+
|
| 289 |
+
73
|
| 290 |
+
00:05:24,000 --> 00:05:28,000
|
| 291 |
+
And that's why hash table is considered to be a thread safe map.
|
| 292 |
+
|
| 293 |
+
74
|
| 294 |
+
00:05:28,000 --> 00:05:33,000
|
| 295 |
+
Hash table also does not allow news, a new case nor new values.
|
| 296 |
+
|
| 297 |
+
75
|
| 298 |
+
00:05:33,000 --> 00:05:39,000
|
| 299 |
+
On the other hand, hash map allows us to store one key and multiple values.
|
| 300 |
+
|
| 301 |
+
76
|
| 302 |
+
00:05:39,000 --> 00:05:43,000
|
| 303 |
+
Hash table is a legacy class, whereas hash map is newer.
|
| 304 |
+
|
| 305 |
+
77
|
| 306 |
+
00:05:44,000 --> 00:05:50,000
|
| 307 |
+
And now I suggest opening the source code of map interface to learn that the communication and methods
|
| 308 |
+
|
| 309 |
+
78
|
| 310 |
+
00:05:50,000 --> 00:05:53,000
|
| 311 |
+
of this interface here is map interface.
|
| 312 |
+
|
| 313 |
+
79
|
| 314 |
+
00:05:53,000 --> 00:06:00,000
|
| 315 |
+
Pay attention to this interface doesn't extend iterable interface like collection while review and map
|
| 316 |
+
|
| 317 |
+
80
|
| 318 |
+
00:06:00,000 --> 00:06:00,000
|
| 319 |
+
interface.
|
| 320 |
+
|
| 321 |
+
81
|
| 322 |
+
00:06:00,000 --> 00:06:06,000
|
| 323 |
+
I'm going to use and work by saying entry, I would always mean the key value pair.
|
| 324 |
+
|
| 325 |
+
82
|
| 326 |
+
00:06:06,000 --> 00:06:11,000
|
| 327 |
+
Is it clear, for example, size returns, amount of entries in the map.
|
| 328 |
+
|
| 329 |
+
83
|
| 330 |
+
00:06:12,000 --> 00:06:16,000
|
| 331 |
+
In other words, a number of key value pairs is empty.
|
| 332 |
+
|
| 333 |
+
84
|
| 334 |
+
00:06:16,000 --> 00:06:18,000
|
| 335 |
+
This is self-described Macit.
|
| 336 |
+
|
| 337 |
+
85
|
| 338 |
+
00:06:18,000 --> 00:06:25,000
|
| 339 |
+
It checks whether the current map is empty or no, contains key verifies whether a map contains specific
|
| 340 |
+
|
| 341 |
+
86
|
| 342 |
+
00:06:25,000 --> 00:06:32,000
|
| 343 |
+
contains value, similar method to check value in map, yet method to get value from the map we have
|
| 344 |
+
|
| 345 |
+
87
|
| 346 |
+
00:06:32,000 --> 00:06:32,000
|
| 347 |
+
to use.
|
| 348 |
+
|
| 349 |
+
88
|
| 350 |
+
00:06:33,000 --> 00:06:37,000
|
| 351 |
+
So we ask you to get Masset to retrieve our value.
|
| 352 |
+
|
| 353 |
+
89
|
| 354 |
+
00:06:37,000 --> 00:06:39,000
|
| 355 |
+
There is no method in map.
|
| 356 |
+
|
| 357 |
+
90
|
| 358 |
+
00:06:39,000 --> 00:06:41,000
|
| 359 |
+
Instead, we have put method.
|
| 360 |
+
|
| 361 |
+
91
|
| 362 |
+
00:06:41,000 --> 00:06:44,000
|
| 363 |
+
We can put key value pair in map.
|
| 364 |
+
|
| 365 |
+
92
|
| 366 |
+
00:06:44,000 --> 00:06:47,000
|
| 367 |
+
That's why put method takes two arguments.
|
| 368 |
+
|
| 369 |
+
93
|
| 370 |
+
00:06:48,000 --> 00:06:50,000
|
| 371 |
+
Pay attention to the return tab here.
|
| 372 |
+
|
| 373 |
+
94
|
| 374 |
+
00:06:50,000 --> 00:06:56,000
|
| 375 |
+
Imagine that you put in map integer value one and some customer reference type user as a value to the
|
| 376 |
+
|
| 377 |
+
95
|
| 378 |
+
00:06:56,000 --> 00:07:01,000
|
| 379 |
+
map in this case, but will return now and now.
|
| 380 |
+
|
| 381 |
+
96
|
| 382 |
+
00:07:01,000 --> 00:07:07,000
|
| 383 |
+
Imagine that you put new value but with the same key you call put MassArt again was integer value one
|
| 384 |
+
|
| 385 |
+
97
|
| 386 |
+
00:07:07,000 --> 00:07:09,000
|
| 387 |
+
and new user object.
|
| 388 |
+
|
| 389 |
+
98
|
| 390 |
+
00:07:09,000 --> 00:07:15,000
|
| 391 |
+
In this case, both method will return the value that was previously associated with the key.
|
| 392 |
+
|
| 393 |
+
99
|
| 394 |
+
00:07:15,000 --> 00:07:16,000
|
| 395 |
+
That means previous user.
|
| 396 |
+
|
| 397 |
+
100
|
| 398 |
+
00:07:17,000 --> 00:07:18,000
|
| 399 |
+
Does it make sense?
|
| 400 |
+
|
| 401 |
+
101
|
| 402 |
+
00:07:18,000 --> 00:07:24,000
|
| 403 |
+
If you want to remove some entry from the map, you have to call remove Masset and Paskey as a method
|
| 404 |
+
|
| 405 |
+
102
|
| 406 |
+
00:07:24,000 --> 00:07:29,000
|
| 407 |
+
argument map interface, declare methods for bulk operations, for example.
|
| 408 |
+
|
| 409 |
+
103
|
| 410 |
+
00:07:29,000 --> 00:07:33,000
|
| 411 |
+
Put all method can add all entries from one object to another.
|
| 412 |
+
|
| 413 |
+
104
|
| 414 |
+
00:07:34,000 --> 00:07:35,000
|
| 415 |
+
Clear message.
|
| 416 |
+
|
| 417 |
+
105
|
| 418 |
+
00:07:35,000 --> 00:07:38,000
|
| 419 |
+
Remove all mappings from the current map object.
|
| 420 |
+
|
| 421 |
+
106
|
| 422 |
+
00:07:38,000 --> 00:07:44,000
|
| 423 |
+
He has said massive returns contain the offset type that contains only keys from this map object.
|
| 424 |
+
|
| 425 |
+
107
|
| 426 |
+
00:07:44,000 --> 00:07:45,000
|
| 427 |
+
Why set?
|
| 428 |
+
|
| 429 |
+
108
|
| 430 |
+
00:07:46,000 --> 00:07:48,000
|
| 431 |
+
Because all keys are unique and map.
|
| 432 |
+
|
| 433 |
+
109
|
| 434 |
+
00:07:48,000 --> 00:07:51,000
|
| 435 |
+
That's why I said type is returned.
|
| 436 |
+
|
| 437 |
+
110
|
| 438 |
+
00:07:51,000 --> 00:07:57,000
|
| 439 |
+
In case we want to retrieve all whaler's from the map, we have to call values method that returns collection
|
| 440 |
+
|
| 441 |
+
111
|
| 442 |
+
00:07:57,000 --> 00:07:58,000
|
| 443 |
+
of elements.
|
| 444 |
+
|
| 445 |
+
112
|
| 446 |
+
00:07:58,000 --> 00:07:59,000
|
| 447 |
+
Why collection?
|
| 448 |
+
|
| 449 |
+
113
|
| 450 |
+
00:08:00,000 --> 00:08:03,000
|
| 451 |
+
Because values are not unique and collection is returned.
|
| 452 |
+
|
| 453 |
+
114
|
| 454 |
+
00:08:04,000 --> 00:08:10,000
|
| 455 |
+
Here's one more very useful method and set this massive return set of entries of this map.
|
| 456 |
+
|
| 457 |
+
115
|
| 458 |
+
00:08:10,000 --> 00:08:15,000
|
| 459 |
+
Each key value pair is represented as a single object of type entry.
|
| 460 |
+
|
| 461 |
+
116
|
| 462 |
+
00:08:15,000 --> 00:08:17,000
|
| 463 |
+
You really understand why set returned?
|
| 464 |
+
|
| 465 |
+
117
|
| 466 |
+
00:08:18,000 --> 00:08:23,000
|
| 467 |
+
Because each key value pair is unique and three is in our interface in map.
|
| 468 |
+
|
| 469 |
+
118
|
| 470 |
+
00:08:24,000 --> 00:08:25,000
|
| 471 |
+
Let's look at it.
|
| 472 |
+
|
| 473 |
+
119
|
| 474 |
+
00:08:25,000 --> 00:08:29,000
|
| 475 |
+
Entry type has to match assets that are used more often than others.
|
| 476 |
+
|
| 477 |
+
120
|
| 478 |
+
00:08:29,000 --> 00:08:32,000
|
| 479 |
+
They are yet key and get value.
|
| 480 |
+
|
| 481 |
+
121
|
| 482 |
+
00:08:32,000 --> 00:08:39,000
|
| 483 |
+
For example, we can iterate over a set of entries in foreach loop and in the foreach loop body we can
|
| 484 |
+
|
| 485 |
+
122
|
| 486 |
+
00:08:39,000 --> 00:08:42,000
|
| 487 |
+
use reference to the entry object together is a key or value.
|
| 488 |
+
|
| 489 |
+
123
|
| 490 |
+
00:08:43,000 --> 00:08:45,000
|
| 491 |
+
It depends on what exactly we need.
|
| 492 |
+
|
| 493 |
+
124
|
| 494 |
+
00:08:45,000 --> 00:08:46,000
|
| 495 |
+
According to our logic.
|
| 496 |
+
|
| 497 |
+
125
|
| 498 |
+
00:08:47,000 --> 00:08:51,000
|
| 499 |
+
There are also other methods that data on my opinion are not used very often.
|
| 500 |
+
|
| 501 |
+
126
|
| 502 |
+
00:08:51,000 --> 00:08:53,000
|
| 503 |
+
For example, set value.
|
| 504 |
+
|
| 505 |
+
127
|
| 506 |
+
00:08:53,000 --> 00:08:57,000
|
| 507 |
+
It allows us to set value associated with the current key in the entry.
|
| 508 |
+
|
| 509 |
+
128
|
| 510 |
+
00:08:57,000 --> 00:09:03,000
|
| 511 |
+
In my opinion, if there would be such need, I mean to update the value associated with a specific
|
| 512 |
+
|
| 513 |
+
129
|
| 514 |
+
00:09:03,000 --> 00:09:09,000
|
| 515 |
+
key, most likely you want to do this with entry time, but instead we'll just call good method with
|
| 516 |
+
|
| 517 |
+
130
|
| 518 |
+
00:09:09,000 --> 00:09:12,000
|
| 519 |
+
the same key on map object to update the value.
|
| 520 |
+
|
| 521 |
+
131
|
| 522 |
+
00:09:13,000 --> 00:09:18,000
|
| 523 |
+
But probably one day you would face with the case that while iterating over entries, you need to implement
|
| 524 |
+
|
| 525 |
+
132
|
| 526 |
+
00:09:18,000 --> 00:09:24,000
|
| 527 |
+
logic that under some specific conditions you have to update value that is associated with a specific
|
| 528 |
+
|
| 529 |
+
133
|
| 530 |
+
00:09:24,000 --> 00:09:25,000
|
| 531 |
+
key.
|
| 532 |
+
|
| 533 |
+
134
|
| 534 |
+
00:09:25,000 --> 00:09:29,000
|
| 535 |
+
And for this case, you already know what method can help you with that.
|
| 536 |
+
|
| 537 |
+
135
|
| 538 |
+
00:09:30,000 --> 00:09:32,000
|
| 539 |
+
You can see equals and hash code.
|
| 540 |
+
|
| 541 |
+
136
|
| 542 |
+
00:09:32,000 --> 00:09:38,000
|
| 543 |
+
You already know these methods and also entry has a few interesting static methods.
|
| 544 |
+
|
| 545 |
+
137
|
| 546 |
+
00:09:38,000 --> 00:09:41,000
|
| 547 |
+
We are going to use them in our next lessons.
|
| 548 |
+
|
| 549 |
+
138
|
| 550 |
+
00:09:41,000 --> 00:09:41,000
|
| 551 |
+
Right now.
|
| 552 |
+
|
| 553 |
+
139
|
| 554 |
+
00:09:41,000 --> 00:09:48,000
|
| 555 |
+
Let me explain you and see what I say about we have comparing biochem assets at source entries by case
|
| 556 |
+
|
| 557 |
+
140
|
| 558 |
+
00:09:48,000 --> 00:09:55,000
|
| 559 |
+
in case there implement comparable interface and we compare the parameter in case keys don't implement
|
| 560 |
+
|
| 561 |
+
141
|
| 562 |
+
00:09:55,000 --> 00:09:56,000
|
| 563 |
+
comparable interface.
|
| 564 |
+
|
| 565 |
+
142
|
| 566 |
+
00:09:57,000 --> 00:10:03,000
|
| 567 |
+
These methods return compared to that we can use to search and now attention to search our entries set,
|
| 568 |
+
|
| 569 |
+
143
|
| 570 |
+
00:10:04,000 --> 00:10:06,000
|
| 571 |
+
but not elements in map bytes key.
|
| 572 |
+
|
| 573 |
+
144
|
| 574 |
+
00:10:07,000 --> 00:10:12,000
|
| 575 |
+
And we also have comparing by value method that returns comparisons that can compare entries set by
|
| 576 |
+
|
| 577 |
+
145
|
| 578 |
+
00:10:12,000 --> 00:10:13,000
|
| 579 |
+
values.
|
| 580 |
+
|
| 581 |
+
146
|
| 582 |
+
00:10:13,000 --> 00:10:16,000
|
| 583 |
+
Imagine that you want to search your map by.
|
| 584 |
+
|
| 585 |
+
147
|
| 586 |
+
00:10:16,000 --> 00:10:21,000
|
| 587 |
+
Well, to be honest, compared to that source, my case is not so cool.
|
| 588 |
+
|
| 589 |
+
148
|
| 590 |
+
00:10:21,000 --> 00:10:21,000
|
| 591 |
+
Why?
|
| 592 |
+
|
| 593 |
+
149
|
| 594 |
+
00:10:22,000 --> 00:10:27,000
|
| 595 |
+
Because we can create object of three map and put all elements from any map there and elements will
|
| 596 |
+
|
| 597 |
+
150
|
| 598 |
+
00:10:27,000 --> 00:10:31,000
|
| 599 |
+
be sorted automatically by case, but sorting by various.
|
| 600 |
+
|
| 601 |
+
151
|
| 602 |
+
00:10:31,000 --> 00:10:36,000
|
| 603 |
+
That is really helpful compared to now when we answer it, what entry type is.
|
| 604 |
+
|
| 605 |
+
152
|
| 606 |
+
00:10:36,000 --> 00:10:43,000
|
| 607 |
+
Let's investigate what matters are left here in the map interface equals and hash good methods and.
|
| 608 |
+
|
| 609 |
+
153
|
| 610 |
+
00:10:44,000 --> 00:10:49,000
|
| 611 |
+
The default message I described, for example, here is interesting and useful message.
|
| 612 |
+
|
| 613 |
+
154
|
| 614 |
+
00:10:49,000 --> 00:10:55,000
|
| 615 |
+
Imagine that you need to get away from that, but you don't want to get new in case Element is absent
|
| 616 |
+
|
| 617 |
+
155
|
| 618 |
+
00:10:55,000 --> 00:10:56,000
|
| 619 |
+
in map.
|
| 620 |
+
|
| 621 |
+
156
|
| 622 |
+
00:10:56,000 --> 00:11:03,000
|
| 623 |
+
Instead, you would like to get some default value we can call yet or default to retrieve element by
|
| 624 |
+
|
| 625 |
+
157
|
| 626 |
+
00:11:03,000 --> 00:11:09,000
|
| 627 |
+
key in case and market for such key present or to return default value in case there is no mapping for
|
| 628 |
+
|
| 629 |
+
158
|
| 630 |
+
00:11:09,000 --> 00:11:10,000
|
| 631 |
+
such key.
|
| 632 |
+
|
| 633 |
+
159
|
| 634 |
+
00:11:10,000 --> 00:11:17,000
|
| 635 |
+
Pay attention to the fact that in case we exist and values that is associated with this key is no value,
|
| 636 |
+
|
| 637 |
+
160
|
| 638 |
+
00:11:18,000 --> 00:11:19,000
|
| 639 |
+
then no will be returned.
|
| 640 |
+
|
| 641 |
+
161
|
| 642 |
+
00:11:20,000 --> 00:11:24,000
|
| 643 |
+
Default value will be returned only in case there is no such key in the map.
|
| 644 |
+
|
| 645 |
+
162
|
| 646 |
+
00:11:25,000 --> 00:11:30,000
|
| 647 |
+
For each matsutake takes function that should be applied for each and every one will return functional
|
| 648 |
+
|
| 649 |
+
163
|
| 650 |
+
00:11:30,000 --> 00:11:31,000
|
| 651 |
+
programming with Java.
|
| 652 |
+
|
| 653 |
+
164
|
| 654 |
+
00:11:32,000 --> 00:11:34,000
|
| 655 |
+
That will show you how you can apply this method.
|
| 656 |
+
|
| 657 |
+
165
|
| 658 |
+
00:11:35,000 --> 00:11:41,000
|
| 659 |
+
Replace all text functions that will be applied to each entry and each entry in turn will be substituted
|
| 660 |
+
|
| 661 |
+
166
|
| 662 |
+
00:11:41,000 --> 00:11:44,000
|
| 663 |
+
with the result that will be returned by this function.
|
| 664 |
+
|
| 665 |
+
167
|
| 666 |
+
00:11:44,000 --> 00:11:51,000
|
| 667 |
+
But if absent method should be used when you don't want to override the values that is already associated
|
| 668 |
+
|
| 669 |
+
168
|
| 670 |
+
00:11:51,000 --> 00:11:52,000
|
| 671 |
+
with a specific key.
|
| 672 |
+
|
| 673 |
+
169
|
| 674 |
+
00:11:52,000 --> 00:11:59,000
|
| 675 |
+
So new value will be put into the map only in case there is no entry with such key or keys associated
|
| 676 |
+
|
| 677 |
+
170
|
| 678 |
+
00:11:59,000 --> 00:11:59,000
|
| 679 |
+
with no value.
|
| 680 |
+
|
| 681 |
+
171
|
| 682 |
+
00:12:00,000 --> 00:12:05,000
|
| 683 |
+
The removal method can help you to remove entry by specifying the key value pair here.
|
| 684 |
+
|
| 685 |
+
172
|
| 686 |
+
00:12:05,000 --> 00:12:06,000
|
| 687 |
+
Also replace MassArt.
|
| 688 |
+
|
| 689 |
+
173
|
| 690 |
+
00:12:07,000 --> 00:12:12,000
|
| 691 |
+
They are different from Puth method because you can say that you want to replace Element only with a
|
| 692 |
+
|
| 693 |
+
174
|
| 694 |
+
00:12:12,000 --> 00:12:19,000
|
| 695 |
+
specific key and with a specific value, or in case of overall that method only in case such key exists.
|
| 696 |
+
|
| 697 |
+
175
|
| 698 |
+
00:12:20,000 --> 00:12:24,000
|
| 699 |
+
Comparative absence method allows you to compute value in case he is absent.
|
| 700 |
+
|
| 701 |
+
176
|
| 702 |
+
00:12:24,000 --> 00:12:30,000
|
| 703 |
+
We can pass the keys that doesn't exist in map and function that can compute new value.
|
| 704 |
+
|
| 705 |
+
177
|
| 706 |
+
00:12:30,000 --> 00:12:34,000
|
| 707 |
+
In case such care exists, the value won't be updated.
|
| 708 |
+
|
| 709 |
+
178
|
| 710 |
+
00:12:34,000 --> 00:12:41,000
|
| 711 |
+
Compute if present method takes key and functions that can compute the value based on the current key
|
| 712 |
+
|
| 713 |
+
179
|
| 714 |
+
00:12:41,000 --> 00:12:47,000
|
| 715 |
+
and previous value that is associated with it in case he exists and previous value is not.
|
| 716 |
+
|
| 717 |
+
180
|
| 718 |
+
00:12:47,000 --> 00:12:53,000
|
| 719 |
+
Now, the result of the function will be associated with this key compute method.
|
| 720 |
+
|
| 721 |
+
181
|
| 722 |
+
00:12:53,000 --> 00:12:59,000
|
| 723 |
+
Attempts to compute and mapping for the specified key and its current mapped value is there is no current
|
| 724 |
+
|
| 725 |
+
182
|
| 726 |
+
00:12:59,000 --> 00:12:59,000
|
| 727 |
+
mapping.
|
| 728 |
+
|
| 729 |
+
183
|
| 730 |
+
00:13:00,000 --> 00:13:02,000
|
| 731 |
+
Mersch method works in the following way.
|
| 732 |
+
|
| 733 |
+
184
|
| 734 |
+
00:13:03,000 --> 00:13:08,000
|
| 735 |
+
It is a specified key, is not already associated with a value or is associated with.
|
| 736 |
+
|
| 737 |
+
185
|
| 738 |
+
00:13:08,000 --> 00:13:11,000
|
| 739 |
+
Now associate it with the given no new value.
|
| 740 |
+
|
| 741 |
+
186
|
| 742 |
+
00:13:12,000 --> 00:13:19,000
|
| 743 |
+
Otherwise replace the associated value with the results of the given remapping function or removes if
|
| 744 |
+
|
| 745 |
+
187
|
| 746 |
+
00:13:19,000 --> 00:13:21,000
|
| 747 |
+
the result is now lost for assets.
|
| 748 |
+
|
| 749 |
+
188
|
| 750 |
+
00:13:21,000 --> 00:13:24,000
|
| 751 |
+
Require knowledge of functional programming in Java.
|
| 752 |
+
|
| 753 |
+
189
|
| 754 |
+
00:13:24,000 --> 00:13:29,000
|
| 755 |
+
That's why they will be reviewed in detail separately in the lessons about functional programming.
|
| 756 |
+
|
| 757 |
+
190
|
| 758 |
+
00:13:30,000 --> 00:13:37,000
|
| 759 |
+
Right now it is enough high level understanding what this message do, and now we are done with all
|
| 760 |
+
|
| 761 |
+
191
|
| 762 |
+
00:13:37,000 --> 00:13:42,000
|
| 763 |
+
default methods in my interface and it is time to review static methods in this interface.
|
| 764 |
+
|
| 765 |
+
192
|
| 766 |
+
00:13:43,000 --> 00:13:49,000
|
| 767 |
+
Here we see overloaded static method with the name of this method, say here since Java version nine
|
| 768 |
+
|
| 769 |
+
193
|
| 770 |
+
00:13:49,000 --> 00:13:51,000
|
| 771 |
+
and they can create immutable.
|
| 772 |
+
|
| 773 |
+
194
|
| 774 |
+
00:13:51,000 --> 00:13:56,000
|
| 775 |
+
That also means unverifiable map that contains a limited number of mappings.
|
| 776 |
+
|
| 777 |
+
195
|
| 778 |
+
00:13:57,000 --> 00:14:02,000
|
| 779 |
+
And you can see that the only difference between all of these methods is a number of mappings that it
|
| 780 |
+
|
| 781 |
+
196
|
| 782 |
+
00:14:02,000 --> 00:14:04,000
|
| 783 |
+
takes as a parameter.
|
| 784 |
+
|
| 785 |
+
197
|
| 786 |
+
00:14:05,000 --> 00:14:10,000
|
| 787 |
+
Here's a method that takes variable lengths, argument of type entry, and based on these creates and
|
| 788 |
+
|
| 789 |
+
198
|
| 790 |
+
00:14:10,000 --> 00:14:18,000
|
| 791 |
+
modifiable map and remasters returns and modifiable entry type based on the key value pair that is passed
|
| 792 |
+
|
| 793 |
+
199
|
| 794 |
+
00:14:18,000 --> 00:14:20,000
|
| 795 |
+
to the method, why this method is needed.
|
| 796 |
+
|
| 797 |
+
200
|
| 798 |
+
00:14:20,000 --> 00:14:26,000
|
| 799 |
+
This method is needed, for example, for the previous method that we have just discussed, because
|
| 800 |
+
|
| 801 |
+
201
|
| 802 |
+
00:14:26,000 --> 00:14:31,000
|
| 803 |
+
you want to eliminate the case when your entries changed because somebody got access to it by reference.
|
| 804 |
+
|
| 805 |
+
202
|
| 806 |
+
00:14:32,000 --> 00:14:35,000
|
| 807 |
+
That's why you might want to create an modifiable entry first.
|
| 808 |
+
|
| 809 |
+
203
|
| 810 |
+
00:14:35,000 --> 00:14:37,000
|
| 811 |
+
And this method will help you in that.
|
| 812 |
+
|
| 813 |
+
204
|
| 814 |
+
00:14:38,000 --> 00:14:41,000
|
| 815 |
+
And the last but not least method for today is copy of.
|
| 816 |
+
|
| 817 |
+
205
|
| 818 |
+
00:14:42,000 --> 00:14:48,000
|
| 819 |
+
If we want to create the copy of the map that nobody will be able to modify, we have to call this method
|
| 820 |
+
|
| 821 |
+
206
|
| 822 |
+
00:14:48,000 --> 00:14:52,000
|
| 823 |
+
and parse the map that we want to copy as an argument to this method.
|
| 824 |
+
|
| 825 |
+
207
|
| 826 |
+
00:14:53,000 --> 00:14:55,000
|
| 827 |
+
That's all method for map interface.
|
| 828 |
+
|
| 829 |
+
208
|
| 830 |
+
00:14:55,000 --> 00:15:00,000
|
| 831 |
+
I believe that right now, you know, map interface even better than some senior software engineers.
|
| 832 |
+
|
| 833 |
+
209
|
| 834 |
+
00:15:01,000 --> 00:15:03,000
|
| 835 |
+
Let's recap what we have learned today.
|
| 836 |
+
|
| 837 |
+
210
|
| 838 |
+
00:15:03,000 --> 00:15:05,000
|
| 839 |
+
Today, we learned Map Iraqi.
|
| 840 |
+
|
| 841 |
+
211
|
| 842 |
+
00:15:05,000 --> 00:15:10,000
|
| 843 |
+
We talked about features that are introduced in the implementations of map interface.
|
| 844 |
+
|
| 845 |
+
212
|
| 846 |
+
00:15:11,000 --> 00:15:14,000
|
| 847 |
+
We also talked about source, map and navigable map.
|
| 848 |
+
|
| 849 |
+
213
|
| 850 |
+
00:15:14,000 --> 00:15:16,000
|
| 851 |
+
We discussed what dictionary is.
|
| 852 |
+
|
| 853 |
+
214
|
| 854 |
+
00:15:17,000 --> 00:15:21,000
|
| 855 |
+
Now, you know what the difference is between Hash Table and Hashmat.
|
| 856 |
+
|
| 857 |
+
215
|
| 858 |
+
00:15:21,000 --> 00:15:24,000
|
| 859 |
+
After that, we learned methods of map interface.
|
| 860 |
+
|
| 861 |
+
216
|
| 862 |
+
00:15:25,000 --> 00:15:27,000
|
| 863 |
+
We also learned what entry type is.
|
| 864 |
+
|
| 865 |
+
217
|
| 866 |
+
00:15:28,000 --> 00:15:29,000
|
| 867 |
+
That's all what we have for today.
|
| 868 |
+
|
| 869 |
+
218
|
| 870 |
+
00:15:30,000 --> 00:15:31,000
|
| 871 |
+
Thanks a lot for your attention.
|
| 872 |
+
|
| 873 |
+
219
|
| 874 |
+
00:15:31,000 --> 00:15:33,000
|
| 875 |
+
See you in the next lesson.
|
| 876 |
+
|