diff --git a/.gitattributes b/.gitattributes
index 5ee72732914ac505884aa14827a849908dd827fe..2cc926a187f5adadbb3e3cf74fb18fe21c1fe68d 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -57,3 +57,11 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
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
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
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
+06[[:space:]]-[[:space:]]Strings[[:space:]]in[[:space:]]Java/004[[:space:]]String[[:space:]]Formatting.mp4 filter=lfs diff=lfs merge=lfs -text
+06[[:space:]]-[[:space:]]Strings[[:space:]]in[[:space:]]Java/008[[:space:]]Homework[[:space:]]review[[:space:]]String.mp4 filter=lfs diff=lfs merge=lfs -text
+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
+07[[:space:]]-[[:space:]]Control[[:space:]]Statements/004[[:space:]]Homework[[:space:]]review[[:space:]]'if'[[:space:]]statement.mp4 filter=lfs diff=lfs merge=lfs -text
+07[[:space:]]-[[:space:]]Control[[:space:]]Statements/001[[:space:]]'if[[:space:]]-[[:space:]]else'[[:space:]]construction.mp4 filter=lfs diff=lfs merge=lfs -text
+07[[:space:]]-[[:space:]]Control[[:space:]]Statements/007[[:space:]]Homework[[:space:]]review[[:space:]]'switch'[[:space:]]statement.mp4 filter=lfs diff=lfs merge=lfs -text
+08[[:space:]]-[[:space:]]Miscellaneous/001[[:space:]]Random[[:space:]]numbers[[:space:]]generation.mp4 filter=lfs diff=lfs merge=lfs -text
+07[[:space:]]-[[:space:]]Control[[:space:]]Statements/005[[:space:]]'switch'[[:space:]]construction.mp4 filter=lfs diff=lfs merge=lfs -text
diff --git a/06 - Strings in Java/004 String Formatting.mp4 b/06 - Strings in Java/004 String Formatting.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..3fe8c4b065198ecb2e3386b1dc0b08277ede7fe2
--- /dev/null
+++ b/06 - Strings in Java/004 String Formatting.mp4
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5c2d31160c281e33733b87c952e6a320f0cce90cdcb3caf793594984bf79347b
+size 15954833
diff --git a/06 - Strings in Java/005 Regular expressions in Java.mp4 b/06 - Strings in Java/005 Regular expressions in Java.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..3cdc55f5e89fe56df6628967ebb5f6a1b19e8c85
--- /dev/null
+++ b/06 - Strings in Java/005 Regular expressions in Java.mp4
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0a8b90ac551f9bbc2fa8de4e72ee7dd65c9c1b7946f17c4d9ce666949f38fda0
+size 77492569
diff --git a/06 - Strings in Java/008 Homework review String.mp4 b/06 - Strings in Java/008 Homework review String.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..e966c7ddb7d3cf7519866ade0f0a2c83cafff280
--- /dev/null
+++ b/06 - Strings in Java/008 Homework review String.mp4
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:33c72788fb9cd018fcfe1d56db4e090d538e51e66768b482d22e8707cbced792
+size 15544727
diff --git a/07 - Control Statements/001 'if - else' construction.mp4 b/07 - Control Statements/001 'if - else' construction.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..9933f73ab0c4eaf1e19efc22f946aee999a3d971
--- /dev/null
+++ b/07 - Control Statements/001 'if - else' construction.mp4
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7260b71643450813185ee9c726e797aa8ada20a39ea6a7096bb9e2c60af1a887
+size 77499457
diff --git a/07 - Control Statements/004 Homework review 'if' statement.mp4 b/07 - Control Statements/004 Homework review 'if' statement.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..565683284485bd6d930264e4e39847b4cd6eea3d
--- /dev/null
+++ b/07 - Control Statements/004 Homework review 'if' statement.mp4
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e29e47d7c03d6c94736ec7cde9e62f805ac4639d25a18f50fed344d00487bda0
+size 15041741
diff --git a/07 - Control Statements/005 'switch' construction.mp4 b/07 - Control Statements/005 'switch' construction.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..58a18391be6b531ef1df117a61328bb658c44ce4
--- /dev/null
+++ b/07 - Control Statements/005 'switch' construction.mp4
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a5eb695be02672273fe7d6660a83766ba695d9300d668483de7286aea84444c4
+size 33168730
diff --git a/07 - Control Statements/007 Homework review 'switch' statement.mp4 b/07 - Control Statements/007 Homework review 'switch' statement.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..864ebcd5fd42b6814568b7a9d40efbe0b4830108
--- /dev/null
+++ b/07 - Control Statements/007 Homework review 'switch' statement.mp4
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a8361e365f6f586147ef3eef716f7c0e41a3e3020cea76f454de319c844f6002
+size 18468530
diff --git a/08 - Miscellaneous/001 Random numbers generation.mp4 b/08 - Miscellaneous/001 Random numbers generation.mp4
new file mode 100644
index 0000000000000000000000000000000000000000..4834ad029013c23a207fc6e197dc80df7d0f56c2
--- /dev/null
+++ b/08 - Miscellaneous/001 Random numbers generation.mp4
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:faf4890cd69c6802b58db0708eac0966242d9c92336983d2b00df3028dd4a4e5
+size 9976491
diff --git a/17 - GIT/009 -ls-command-details.url b/17 - GIT/009 -ls-command-details.url
new file mode 100644
index 0000000000000000000000000000000000000000..7a566d555e8530d1cd408bf32f10ce78e6586c2a
--- /dev/null
+++ b/17 - GIT/009 -ls-command-details.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://www.rapidtables.com/code/linux/ls.html
\ No newline at end of file
diff --git a/17 - GIT/009 Git Branching_en.srt b/17 - GIT/009 Git Branching_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..2d99ac025b518d0e4cdcca9059b24ed01ceba65b
--- /dev/null
+++ b/17 - GIT/009 Git Branching_en.srt
@@ -0,0 +1,952 @@
+1
+00:00:06,000 --> 00:00:11,000
+Hello, dissidents, today we are going to a very important lesson today will learn what branches and
+
+2
+00:00:11,000 --> 00:00:13,000
+how to ensure smooth navigation between them.
+
+3
+00:00:14,000 --> 00:00:19,000
+I will explain you how comets, asteroids and get in a nutshell will answer the question, what actually
+
+4
+00:00:19,000 --> 00:00:20,000
+branches?
+
+5
+00:00:20,000 --> 00:00:21,000
+I will explain today.
+
+6
+00:00:21,000 --> 00:00:27,000
+What is it that after you will understand, the theory will proceed with practice exercises to learn
+
+7
+00:00:27,000 --> 00:00:33,000
+commands that will allow us to create new branches and navigate between already existing ones.
+
+8
+00:00:33,000 --> 00:00:39,000
+You learn such commands as Check-Out and Gifts, which will Ranjith branch command.
+
+9
+00:00:39,000 --> 00:00:43,000
+And I'll tell you how you can list all your local branches and remote.
+
+10
+00:00:43,000 --> 00:00:49,000
+Once you're in the practice exercises, I'll show you how you can remove branch locally and in remote
+
+11
+00:00:49,000 --> 00:00:52,000
+repository while navigating between the snapshots.
+
+12
+00:00:52,000 --> 00:00:55,000
+I will show you what the touch that state is.
+
+13
+00:00:55,000 --> 00:01:00,000
+Besides that, today I will show you basically next terminal commands for navigation in the file system,
+
+14
+00:01:00,000 --> 00:01:02,000
+creating files and listin files.
+
+15
+00:01:03,000 --> 00:01:08,000
+Lets start and to start with, let's imagine the case that you receive task on your work and you need
+
+16
+00:01:08,000 --> 00:01:11,000
+to implement it to start work on the new task.
+
+17
+00:01:11,000 --> 00:01:16,000
+You have to isolate your changes from the stable version of your code to make sure you will not mess
+
+18
+00:01:16,000 --> 00:01:18,000
+it up through the late hour code.
+
+19
+00:01:18,000 --> 00:01:22,000
+During the development of the new feature that allows us to create a separate branch.
+
+20
+00:01:23,000 --> 00:01:25,000
+What is the branch we briefly discussed?
+
+21
+00:01:25,000 --> 00:01:26,000
+What is the branch one?
+
+22
+00:01:26,000 --> 00:01:28,000
+We talked about our master branch.
+
+23
+00:01:29,000 --> 00:01:35,000
+But let's recap one more time and simple words unit branch to diverge from the main branch to continue
+
+24
+00:01:35,000 --> 00:01:38,000
+development without messing with the main development branch.
+
+25
+00:01:38,000 --> 00:01:44,000
+For example, here's the main development branch where the latest version of the code is stored and
+
+26
+00:01:44,000 --> 00:01:46,000
+you want to start work on the new task.
+
+27
+00:01:47,000 --> 00:01:53,000
+You create a separate branch, you create comments on that branch, and after that you merge a branch
+
+28
+00:01:53,000 --> 00:01:55,000
+with the development branch easy.
+
+29
+00:01:55,000 --> 00:02:01,000
+Meanwhile, another developer can create a new branch and work in parallel with you for some period
+
+30
+00:02:01,000 --> 00:02:04,000
+of time and merge his changes with years later.
+
+31
+00:02:05,000 --> 00:02:08,000
+That's why we need branches during the software development in a team.
+
+32
+00:02:09,000 --> 00:02:15,000
+To understand how branches work, we need to understand a bit deeper how get stores information you
+
+33
+00:02:15,000 --> 00:02:18,000
+remember that gets its files as a series of the snapshots.
+
+34
+00:02:18,000 --> 00:02:24,000
+When we create a command, get to commit objects that contains a pointer to the snapshot of the content
+
+35
+00:02:24,000 --> 00:02:26,000
+that we added to the staging area.
+
+36
+00:02:26,000 --> 00:02:32,000
+Also, this object stauss pointers to the comments that directly came before the current commit.
+
+37
+00:02:32,000 --> 00:02:38,000
+Before we start learning specific commands how to create branches, I want you to understand the theory,
+
+38
+00:02:38,000 --> 00:02:44,000
+at least on the high level, how it works, what actually happens when we create a new branch on this
+
+39
+00:02:44,000 --> 00:02:49,000
+slide, you can see that I created a new branch with the name testing what actually happened in the
+
+40
+00:02:49,000 --> 00:02:50,000
+language of it.
+
+41
+00:02:50,000 --> 00:02:56,000
+I just created a new pointer on the current commit on the moment when I create a new branch from the
+
+42
+00:02:56,000 --> 00:03:03,000
+master to pointers are pointing out to the same command, but how it knows that at this specific moment
+
+43
+00:03:03,000 --> 00:03:07,000
+of time I'm on the Master Branch, but not on the testing branch.
+
+44
+00:03:07,000 --> 00:03:08,000
+There is one more point.
+
+45
+00:03:08,000 --> 00:03:09,000
+I called that.
+
+46
+00:03:09,000 --> 00:03:11,000
+Now let's imagine we switched branches.
+
+47
+00:03:12,000 --> 00:03:16,000
+I will show you comments a bit later in this lesson when we will have practice exercise.
+
+48
+00:03:16,000 --> 00:03:23,000
+Right now, I want you to focus on the series and this visualization switch branches in the language
+
+49
+00:03:23,000 --> 00:03:25,000
+object is to change head pointer.
+
+50
+00:03:25,000 --> 00:03:31,000
+Now, Head is pointing out to the testing pointer being on this branch, we can create a new command.
+
+51
+00:03:31,000 --> 00:03:32,000
+What happens next?
+
+52
+00:03:33,000 --> 00:03:38,000
+Our testing branch moved forward while Master Branch still points to the previous command.
+
+53
+00:03:38,000 --> 00:03:44,000
+So in this particular case, if you would switch back to the master branch, you would see the state
+
+54
+00:03:44,000 --> 00:03:46,000
+of the file system, which was before your last commit.
+
+55
+00:03:47,000 --> 00:03:53,000
+OK, now you can imagine how pointers and it works, but let's move further now.
+
+56
+00:03:53,000 --> 00:03:58,000
+Imagine that somebody, some as a developer, managed to put changes into the master branch and then
+
+57
+00:03:58,000 --> 00:04:00,000
+you can meet and Master Branch appeared.
+
+58
+00:04:01,000 --> 00:04:03,000
+Your project history has diverged.
+
+59
+00:04:03,000 --> 00:04:07,000
+Both changes in these two countries are isolated from each other.
+
+60
+00:04:07,000 --> 00:04:08,000
+But we can merge.
+
+61
+00:04:08,000 --> 00:04:13,000
+This changes if we want that this exact scenario which we need to learn together.
+
+62
+00:04:13,000 --> 00:04:18,000
+And this course, we are going to learn how to merge changes together from different branches.
+
+63
+00:04:18,000 --> 00:04:22,000
+So right now, you already understand the theory of branches.
+
+64
+00:04:22,000 --> 00:04:28,000
+You can visualize in your mind how navigation between branches works and why do we need this now it
+
+65
+00:04:28,000 --> 00:04:32,000
+is time to run specific it commands that will allow you to navigate between branches.
+
+66
+00:04:32,000 --> 00:04:35,000
+Let's practice usually on the job.
+
+67
+00:04:35,000 --> 00:04:39,000
+You are going to use some task management system or issue trackers that will give you a unique idea
+
+68
+00:04:39,000 --> 00:04:40,000
+of your task.
+
+69
+00:04:41,000 --> 00:04:46,000
+Imagine that we have a task to implement logic of discount calculation for our customers based on the
+
+70
+00:04:46,000 --> 00:04:52,000
+history of purchases where we need to start, we need to start from creation of the branch.
+
+71
+00:04:52,000 --> 00:04:54,000
+There are different ways to create branches.
+
+72
+00:04:55,000 --> 00:05:02,000
+One of the options is to use the next command, get Branch G a three zero one.
+
+73
+00:05:03,000 --> 00:05:10,000
+Let's press enter new branch is created, but you see here in parentheses, I'm still in the master
+
+74
+00:05:10,000 --> 00:05:13,000
+branch to check which branches I have locally.
+
+75
+00:05:13,000 --> 00:05:19,000
+I have to just use the next command get branch to see all remoted branches.
+
+76
+00:05:19,000 --> 00:05:23,000
+I have to use the next command branch was option are.
+
+77
+00:05:24,000 --> 00:05:29,000
+And you see that right now I have only one branch and remote that is my original Austin branch.
+
+78
+00:05:29,000 --> 00:05:33,000
+To see all local and remote branches you have to use the EH option.
+
+79
+00:05:34,000 --> 00:05:36,000
+Get Branch Desh a.
+
+80
+00:05:37,000 --> 00:05:43,000
+And here we can find all local and remote branches, but to be honest, the branch command is rarely
+
+81
+00:05:43,000 --> 00:05:49,000
+used among developers to create a new branch because this command only creates branch but not get you
+
+82
+00:05:49,000 --> 00:05:50,000
+to the new branch.
+
+83
+00:05:50,000 --> 00:05:55,000
+Usually software engineers use the commands it creates and changed branches simultaneously.
+
+84
+00:05:56,000 --> 00:05:58,000
+So let's type the following year.
+
+85
+00:05:58,000 --> 00:05:59,000
+Check out, check out.
+
+86
+00:05:59,000 --> 00:06:01,000
+Command is for changing branches.
+
+87
+00:06:02,000 --> 00:06:07,000
+Option B, this option is to indicate that I want to change and create a new branch.
+
+88
+00:06:07,000 --> 00:06:17,000
+B stands for Branch and now let's specify the name of the branch task three zero one underscore discount.
+
+89
+00:06:17,000 --> 00:06:19,000
+Underscore calculation.
+
+90
+00:06:19,000 --> 00:06:25,000
+Usually with the task, we would like to specify a brief description of what changes will be in this
+
+91
+00:06:25,000 --> 00:06:26,000
+branch press.
+
+92
+00:06:26,000 --> 00:06:33,000
+Enter and we switch to the new branch and in parentheses you can easily identify on which branch you
+
+93
+00:06:33,000 --> 00:06:36,000
+are right now and where is your head pointer.
+
+94
+00:06:36,000 --> 00:06:38,000
+OK, we created changes.
+
+95
+00:06:38,000 --> 00:06:40,000
+Now let's implement our task.
+
+96
+00:06:41,000 --> 00:06:42,000
+For the sake of example.
+
+97
+00:06:42,000 --> 00:06:49,000
+I won't write any code and I will not implement any logic related to the discount calculation because
+
+98
+00:06:49,000 --> 00:06:51,000
+I want you now to focus only on it.
+
+99
+00:06:52,000 --> 00:06:53,000
+But let's imitate that.
+
+100
+00:06:53,000 --> 00:06:57,000
+We need some changes and all of them stored in the new file.
+
+101
+00:06:57,000 --> 00:07:00,000
+Let me use Linux commands to create a new file.
+
+102
+00:07:00,000 --> 00:07:07,000
+First of all, I want to navigate to the folder with the source code Siggie, SIRC and Presenta.
+
+103
+00:07:08,000 --> 00:07:15,000
+Sydney stands for Change Directory and you see here in the path that I navigated to the SC directory.
+
+104
+00:07:16,000 --> 00:07:22,000
+Dutch discount calculation service, Dutch Java Dutch Command allows us to create file.
+
+105
+00:07:23,000 --> 00:07:28,000
+This is one of the possible ways to create files with Linux terminals to check what files you have in
+
+106
+00:07:28,000 --> 00:07:29,000
+the directory.
+
+107
+00:07:29,000 --> 00:07:31,000
+Let me show you one more Linux command.
+
+108
+00:07:32,000 --> 00:07:35,000
+Alas, Resorption El Al.
+
+109
+00:07:35,000 --> 00:07:39,000
+S is a command that list files in the specific directories.
+
+110
+00:07:39,000 --> 00:07:45,000
+I don't see a lot of sense in reviewing all possible options for comment because most likely you want
+
+111
+00:07:45,000 --> 00:07:46,000
+to use them all.
+
+112
+00:07:47,000 --> 00:07:49,000
+I use Option L to have such formatting.
+
+113
+00:07:50,000 --> 00:07:55,000
+I will leave the link and attachments to this lesson about Allah's command and if you wish, you can
+
+114
+00:07:55,000 --> 00:07:56,000
+try different other options.
+
+115
+00:07:57,000 --> 00:07:59,000
+And we see that new file is created.
+
+116
+00:08:00,000 --> 00:08:00,000
+Here it is.
+
+117
+00:08:01,000 --> 00:08:07,000
+Let's also check that file was created in the File Explorer and we can also find it here.
+
+118
+00:08:07,000 --> 00:08:08,000
+Awesome.
+
+119
+00:08:08,000 --> 00:08:12,000
+We have just created a file and here it is in the SLC directory.
+
+120
+00:08:13,000 --> 00:08:18,000
+Before we proceed, I want to show you one more interesting command for navigation and file system.
+
+121
+00:08:18,000 --> 00:08:22,000
+We are terminal Siggie, dot, dot, dot, dot, dot.
+
+122
+00:08:22,000 --> 00:08:25,000
+Always references to the parent directory.
+
+123
+00:08:25,000 --> 00:08:31,000
+So in case you want to navigate one level up, you have to use this command and you see well, already
+
+124
+00:08:31,000 --> 00:08:35,000
+in our project directory and not in saac folder anymore.
+
+125
+00:08:36,000 --> 00:08:40,000
+Now let's pretend that our work on this task is completed and we need everything.
+
+126
+00:08:40,000 --> 00:08:42,000
+What is needed in scope of this task?
+
+127
+00:08:42,000 --> 00:08:45,000
+We have to create a command with our changes.
+
+128
+00:08:45,000 --> 00:08:50,000
+We add file to the staging area as usual, get at DOT.
+
+129
+00:08:50,000 --> 00:08:52,000
+Now we create command.
+
+130
+00:08:53,000 --> 00:08:58,000
+Gate comit dash cam, personal discount for user can be calculated.
+
+131
+00:09:01,000 --> 00:09:04,000
+Great, we have our committee now, a branch.
+
+132
+00:09:04,000 --> 00:09:11,000
+Let's check it, lock gate, lock dash to to see only last two comments.
+
+133
+00:09:11,000 --> 00:09:14,000
+We can see here that this comment is from Master Branch.
+
+134
+00:09:15,000 --> 00:09:18,000
+And here's our new comment on our new branch.
+
+135
+00:09:18,000 --> 00:09:25,000
+By the way, just to remind you that it shows you the history of the current branch only to watch all
+
+136
+00:09:25,000 --> 00:09:26,000
+committees across the repository.
+
+137
+00:09:26,000 --> 00:09:27,000
+You have to type it.
+
+138
+00:09:27,000 --> 00:09:35,000
+Look with options all like this log double dash, all towards the history of committees for the one
+
+139
+00:09:35,000 --> 00:09:43,000
+single branch type Gitlow command with the branch name like this gridlock g a double zero.
+
+140
+00:09:43,000 --> 00:09:47,000
+And do not forget, do you stop key for after completion.
+
+141
+00:09:48,000 --> 00:09:52,000
+OK, this information might help you in the future, and just for the reference.
+
+142
+00:09:53,000 --> 00:09:53,000
+Let's move on.
+
+143
+00:09:54,000 --> 00:09:58,000
+I can easily navigate between branches in my local repository.
+
+144
+00:09:58,000 --> 00:10:01,000
+We already learned the command that allows us to switch branches.
+
+145
+00:10:02,000 --> 00:10:04,000
+Now, let's switch back to the master branch.
+
+146
+00:10:05,000 --> 00:10:06,000
+You check out master.
+
+147
+00:10:07,000 --> 00:10:12,000
+I don't have to use the option because Master Branch already exists and I don't need to create a new
+
+148
+00:10:12,000 --> 00:10:12,000
+one.
+
+149
+00:10:13,000 --> 00:10:17,000
+And we can see that name of the branches changed here in the parentheses.
+
+150
+00:10:17,000 --> 00:10:20,000
+Let's check now the file lists in the SAAC folder.
+
+151
+00:10:21,000 --> 00:10:28,000
+Let's navigate to SASE folder, first CD SAAC and now let's use another command to list files.
+
+152
+00:10:29,000 --> 00:10:31,000
+Alas, that shall.
+
+153
+00:10:31,000 --> 00:10:32,000
+Wow.
+
+154
+00:10:32,000 --> 00:10:40,000
+Magic happened where discount calculation Java file, it is in another snapshot, if you don't believe
+
+155
+00:10:40,000 --> 00:10:41,000
+that file is disappeared.
+
+156
+00:10:41,000 --> 00:10:44,000
+Let me show you in the file Explorer, can you see this?
+
+157
+00:10:45,000 --> 00:10:46,000
+The file is disappeared.
+
+158
+00:10:47,000 --> 00:10:50,000
+Now you learned how to navigate between branches.
+
+159
+00:10:50,000 --> 00:10:52,000
+Can you navigate only between branches?
+
+160
+00:10:52,000 --> 00:10:53,000
+Oh, no.
+
+161
+00:10:53,000 --> 00:10:57,000
+You can also navigate to the specific limit how to do that.
+
+162
+00:10:57,000 --> 00:11:00,000
+Let me show you at the beginning.
+
+163
+00:11:00,000 --> 00:11:04,000
+Let's find the comet where I want to switch, get log dash three.
+
+164
+00:11:05,000 --> 00:11:09,000
+OK, let me switch to this cannot get out.
+
+165
+00:11:10,000 --> 00:11:14,000
+Zero six G, one B and Presenta.
+
+166
+00:11:14,000 --> 00:11:20,000
+So you need to enter a unique combination of characters so that you would understand where you are reference
+
+167
+00:11:20,000 --> 00:11:21,000
+into.
+
+168
+00:11:21,000 --> 00:11:24,000
+And now we switch to the state of this particular comet.
+
+169
+00:11:25,000 --> 00:11:31,000
+Right after you switch to the specific comet, you see one message that you are in the dust head state.
+
+170
+00:11:31,000 --> 00:11:32,000
+What does that mean?
+
+171
+00:11:33,000 --> 00:11:39,000
+That means we are not on the specific branch because most likely this comet is present in different
+
+172
+00:11:39,000 --> 00:11:39,000
+branches.
+
+173
+00:11:40,000 --> 00:11:45,000
+Even if you would create Comet being here, nobody would be able to find this comet other than we are
+
+174
+00:11:45,000 --> 00:11:51,000
+directly examining the fire because new comets won't be connected with any specific branch.
+
+175
+00:11:52,000 --> 00:11:58,000
+That means these changes can easily get lost once you check out a different revision on Branch.
+
+176
+00:11:58,000 --> 00:12:02,000
+So why then we need to check out the specific comet.
+
+177
+00:12:02,000 --> 00:12:08,000
+During your life as a software engineer, you might want to navigate to the specific committee to investigate
+
+178
+00:12:08,000 --> 00:12:11,000
+how some specific chunk of code worked in the past.
+
+179
+00:12:12,000 --> 00:12:15,000
+For example, in case to troubleshoot some defect.
+
+180
+00:12:15,000 --> 00:12:21,000
+You want to investigate how the code worked before and you want to execute this court and the market.
+
+181
+00:12:21,000 --> 00:12:24,000
+That's why you might want to navigate to the specific comet.
+
+182
+00:12:25,000 --> 00:12:32,000
+What I want you to remember is that you shouldn't do any comets in the state just investigating an experiment
+
+183
+00:12:32,000 --> 00:12:33,000
+in this fine.
+
+184
+00:12:33,000 --> 00:12:38,000
+Well, being in the state, doing the commands and the state is not the best idea.
+
+185
+00:12:39,000 --> 00:12:42,000
+Let's get back to our task branch yet.
+
+186
+00:12:42,000 --> 00:12:49,000
+Check out Geet zero zero zero one and press up two times for auto completion.
+
+187
+00:12:49,000 --> 00:12:56,000
+You have to press stop two times because we have a three zero one branch and a three zero one discount
+
+188
+00:12:56,000 --> 00:12:57,000
+calculation branch.
+
+189
+00:12:58,000 --> 00:13:02,000
+And Antep allows you to select the exact branch you need for auto completion.
+
+190
+00:13:03,000 --> 00:13:07,000
+Now, let's push it to a region, yet push our region with option.
+
+191
+00:13:07,000 --> 00:13:13,000
+You g a three zero one underscore and top key to autocomplete.
+
+192
+00:13:14,000 --> 00:13:21,000
+Nice branch was pushed to remote, new branch in remote has been created and the branch remote tracking
+
+193
+00:13:21,000 --> 00:13:22,000
+has been configured.
+
+194
+00:13:22,000 --> 00:13:24,000
+Let's check the branch in the remote repository.
+
+195
+00:13:25,000 --> 00:13:27,000
+Let's open a search directory.
+
+196
+00:13:27,000 --> 00:13:33,000
+And here you can switch branches and we can see that on our new branch, we have new file.
+
+197
+00:13:36,000 --> 00:13:44,000
+Click on Inside Sidestep Select Network here, you can see its history and see that our new branch is
+
+198
+00:13:44,000 --> 00:13:49,000
+one committee ahead of Master Branch, OK, well on how to create branches.
+
+199
+00:13:49,000 --> 00:13:53,000
+But at the beginning of the lesson, we also created one branch.
+
+200
+00:13:53,000 --> 00:13:56,000
+Let me list all branches and get back one more time.
+
+201
+00:13:57,000 --> 00:14:01,000
+Get Branch was option A this task branch.
+
+202
+00:14:01,000 --> 00:14:06,000
+I want to remove how to remove branch get branch was option.
+
+203
+00:14:06,000 --> 00:14:09,000
+The D stands for delete and the branch name.
+
+204
+00:14:10,000 --> 00:14:16,000
+We can find message that branch has been deleted, and for the sake of example, let's pretend that
+
+205
+00:14:16,000 --> 00:14:20,000
+I want to remove the calculation branch from the remote to how to do that.
+
+206
+00:14:21,000 --> 00:14:26,000
+Yet push a region was option delete and specifies a branch name here.
+
+207
+00:14:27,000 --> 00:14:28,000
+Press enter.
+
+208
+00:14:30,000 --> 00:14:32,000
+Let me open my remote repository one more time.
+
+209
+00:14:34,000 --> 00:14:39,000
+And when I try to switch branch, you see that I can't find my new branch here anymore.
+
+210
+00:14:39,000 --> 00:14:43,000
+Now you know how to remove branch locally and in remote.
+
+211
+00:14:43,000 --> 00:14:49,000
+But for our next lesson, let me push our branch to region one more time, because already in the next
+
+212
+00:14:49,000 --> 00:14:54,000
+lesson, we are going to learn how to grade pull requests and how to merge branches together.
+
+213
+00:14:55,000 --> 00:14:58,000
+Yet push a region was option you for this contemplation branch.
+
+214
+00:14:59,000 --> 00:15:05,000
+The last but nonetheless, thing that I would like to mention today is that starting from the get version
+
+215
+00:15:05,000 --> 00:15:10,000
+two point twenty three onwards, instead of checkout command, new command is also available to use
+
+216
+00:15:11,000 --> 00:15:13,000
+get switch master.
+
+217
+00:15:13,000 --> 00:15:20,000
+In case you want to switch to the new branch, you have to use C option like this and get switch options.
+
+218
+00:15:20,000 --> 00:15:23,000
+See New Branch here.
+
+219
+00:15:23,000 --> 00:15:30,000
+C option stands for create to navigate back to the previous branch type, the following gate switch
+
+220
+00:15:30,000 --> 00:15:33,000
+and hyphen and then navigated back to the Master Branch.
+
+221
+00:15:34,000 --> 00:15:35,000
+To be honest, I didn't.
+
+222
+00:15:35,000 --> 00:15:41,000
+So engineers who are already actively used to each command because it is a big habit to use Check-Out
+
+223
+00:15:41,000 --> 00:15:46,000
+Command for branch navigation in the community of engineers introducing Gates, which command wasn't
+
+224
+00:15:46,000 --> 00:15:48,000
+done to confuse developers even more.
+
+225
+00:15:49,000 --> 00:15:55,000
+The thing is that Check-Out commands sometimes might be used to reverse modifications, so to clearly
+
+226
+00:15:55,000 --> 00:16:02,000
+separate commands, Newcomen to a single goal to switch branches gets which was introduced that it.
+
+227
+00:16:03,000 --> 00:16:09,000
+I believe right now, you know about branch navigation even more than some senior engineers, and right
+
+228
+00:16:09,000 --> 00:16:13,000
+now let's recap what we have learned today in this lesson.
+
+229
+00:16:13,000 --> 00:16:17,000
+You learned what the branches you understand how mechanism of branch works.
+
+230
+00:16:18,000 --> 00:16:20,000
+Well, what is Healthpoint in it?
+
+231
+00:16:21,000 --> 00:16:22,000
+After we learn theory?
+
+232
+00:16:22,000 --> 00:16:28,000
+I showed you a few ways how to create a new branch and get ready to commit with our changes on the new
+
+233
+00:16:28,000 --> 00:16:33,000
+branch, we understood how we can navigate between the branches and what the Dutch had state is.
+
+234
+00:16:33,000 --> 00:16:40,000
+Also in this lesson we learn how to remove branches and how to use gifts which command to navigate between
+
+235
+00:16:40,000 --> 00:16:40,000
+them.
+
+236
+00:16:40,000 --> 00:16:46,000
+During the lesson you learned basically Linux commands that allows us to navigate and filesystem, create
+
+237
+00:16:46,000 --> 00:16:48,000
+files and leased files in that directory.
+
+238
+00:16:49,000 --> 00:16:53,000
+Thanks a lot for your attention and see you in the next lesson.
+
diff --git a/17 - GIT/010 Pull Requests & Merge Requests_en.srt b/17 - GIT/010 Pull Requests & Merge Requests_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..bb86640c84a55dac8152edc8e884cd9a33a9f044
--- /dev/null
+++ b/17 - GIT/010 Pull Requests & Merge Requests_en.srt
@@ -0,0 +1,632 @@
+1
+00:00:05,000 --> 00:00:11,000
+Hello there, students today will learn with you what a pull request is and how to create one after
+
+2
+00:00:11,000 --> 00:00:13,000
+we'll understand the definition of PR.
+
+3
+00:00:13,000 --> 00:00:16,000
+I will show you how you can create your first pool request.
+
+4
+00:00:16,000 --> 00:00:20,000
+We'll learn what is the difference between pool request and Richard Quest.
+
+5
+00:00:20,000 --> 00:00:23,000
+In this lesson, we are going to learn how we can match.
+
+6
+00:00:23,000 --> 00:00:28,000
+Coming from different branches will learn the difference between different methods and strategies.
+
+7
+00:00:28,000 --> 00:00:31,000
+I will show you how to add collaborator's to your repository.
+
+8
+00:00:32,000 --> 00:00:36,000
+You'll add me as a collaborator so that I will be able to evaluate your code.
+
+9
+00:00:36,000 --> 00:00:42,000
+First of all, let's understand what is a pull request pull request as a method of submitting contributions
+
+10
+00:00:42,000 --> 00:00:43,000
+to a project.
+
+11
+00:00:43,000 --> 00:00:48,000
+Imagine that you wrote a few days and implementing logic of discount calculation for your users.
+
+12
+00:00:48,000 --> 00:00:50,000
+And finally, you completed your work.
+
+13
+00:00:51,000 --> 00:00:54,000
+Now you need to match your card with the latest version of the source code.
+
+14
+00:00:55,000 --> 00:00:59,000
+Literally, you have to much of yours with comments that were done by other developers.
+
+15
+00:01:00,000 --> 00:01:02,000
+Why is this method is called a pull request.
+
+16
+00:01:02,000 --> 00:01:06,000
+You can pull changes from one branch to update another branch.
+
+17
+00:01:06,000 --> 00:01:11,000
+And by submitting a budget request, you ask other people to review your changes and pull them into
+
+18
+00:01:11,000 --> 00:01:13,000
+another branch.
+
+19
+00:01:13,000 --> 00:01:14,000
+Does it make sense now?
+
+20
+00:01:14,000 --> 00:01:17,000
+Now words to request make more sense.
+
+21
+00:01:17,000 --> 00:01:22,000
+And by the way, we'll request the terminology of the GitHub and mid-market repositories.
+
+22
+00:01:22,000 --> 00:01:26,000
+Yet Lab uses another term to describe the same process merge request.
+
+23
+00:01:27,000 --> 00:01:28,000
+The idea is pretty similar.
+
+24
+00:01:29,000 --> 00:01:32,000
+We may want to merge two branches and merge.
+
+25
+00:01:32,000 --> 00:01:37,000
+Request means that you want to ask somebody to merge the changes with the other branch.
+
+26
+00:01:37,000 --> 00:01:42,000
+Both requests and merge requests use get pull and get merge commands.
+
+27
+00:01:42,000 --> 00:01:48,000
+We are going to learn these commands in the next lessons, but don't confuse this terminology.
+
+28
+00:01:48,000 --> 00:01:55,000
+PR and Anmar refers to a much broader topic, and I believe you understand that both of these terms
+
+29
+00:01:55,000 --> 00:01:57,000
+describe the same process.
+
+30
+00:01:57,000 --> 00:02:03,000
+Now, when you understood that, let's proceed with our demo on the previous lesson remerged.
+
+31
+00:02:03,000 --> 00:02:04,000
+Our branch does a remote repository.
+
+32
+00:02:05,000 --> 00:02:08,000
+We add new file added discount calculation service.
+
+33
+00:02:08,000 --> 00:02:11,000
+Let's also change existing file for the sake of the demo.
+
+34
+00:02:12,000 --> 00:02:15,000
+Let me add spaces here in the Hello World File.
+
+35
+00:02:17,000 --> 00:02:23,000
+And I save this file now, I will add changes to the staging area and we'll make a commit the spaces
+
+36
+00:02:23,000 --> 00:02:25,000
+were added to the hello world file.
+
+37
+00:02:33,000 --> 00:02:37,000
+After I created the command, I pushed it to the remote ranch.
+
+38
+00:02:40,000 --> 00:02:45,000
+To create a pull request, you have to have two branches, and right now we have massive branch and
+
+39
+00:02:45,000 --> 00:02:47,000
+our task branch nice.
+
+40
+00:02:48,000 --> 00:02:50,000
+There are a lot of different ways to create a pull request.
+
+41
+00:02:51,000 --> 00:02:52,000
+Let me show you one of them.
+
+42
+00:02:52,000 --> 00:02:54,000
+Click on Pull Request tab here.
+
+43
+00:02:54,000 --> 00:02:57,000
+Now click on the new pull request button.
+
+44
+00:02:57,000 --> 00:03:01,000
+And here you have to specify which branch you want to pull into which branch.
+
+45
+00:03:01,000 --> 00:03:07,000
+In our case, Master is a main development branch dependent on the branch and strategy that you are
+
+46
+00:03:07,000 --> 00:03:08,000
+going to have at your work.
+
+47
+00:03:09,000 --> 00:03:14,000
+You might have development branches and development branch and Master Branch will be used only for releases.
+
+48
+00:03:15,000 --> 00:03:19,000
+In our particular case, we want to merge Task One branch into master.
+
+49
+00:03:19,000 --> 00:03:24,000
+That's why here I select a task one and here I have Master Branch.
+
+50
+00:03:24,000 --> 00:03:28,000
+Here you will see the difference between the state of these two branches.
+
+51
+00:03:28,000 --> 00:03:30,000
+Let's create a pull request.
+
+52
+00:03:30,000 --> 00:03:35,000
+Additionally, you may specify pull request description here on the right.
+
+53
+00:03:35,000 --> 00:03:38,000
+You can specify, pull, request, review and request.
+
+54
+00:03:38,000 --> 00:03:40,000
+Ehsani What is a defense review?
+
+55
+00:03:41,000 --> 00:03:43,000
+What is someone you want to review the code?
+
+56
+00:03:43,000 --> 00:03:49,000
+And this can be the person who is not necessarily responsible for merging branches, probably colleagues
+
+57
+00:03:49,000 --> 00:03:52,000
+of yours or software engineers from another development team.
+
+58
+00:03:53,000 --> 00:03:55,000
+But who needs to be aware of changes in your project?
+
+59
+00:03:56,000 --> 00:04:01,000
+On the other hand, think is someone who is responsible for emergencies, quote, this can be a tech
+
+60
+00:04:01,000 --> 00:04:07,000
+lead on your project or owner of the repository who is in charge of margin call to the master branch
+
+61
+00:04:07,000 --> 00:04:08,000
+later today.
+
+62
+00:04:08,000 --> 00:04:16,000
+I will show you how you can add me as an EHSANI right now, just click, reply, request button and
+
+63
+00:04:16,000 --> 00:04:19,000
+pull request is created on this tab.
+
+64
+00:04:19,000 --> 00:04:21,000
+You can see what commands you have on your branch.
+
+65
+00:04:22,000 --> 00:04:27,000
+On this type, you can see what files were changed in comparison with the branch where you want to major
+
+66
+00:04:27,000 --> 00:04:28,000
+changes.
+
+67
+00:04:29,000 --> 00:04:31,000
+We can see that there are two changes.
+
+68
+00:04:31,000 --> 00:04:35,000
+New file is created and the spaces are added to the hello world file.
+
+69
+00:04:36,000 --> 00:04:43,000
+Azanian reviewers will go over all your changes to investigate what exactly is changed in your pull
+
+70
+00:04:43,000 --> 00:04:43,000
+request.
+
+71
+00:04:44,000 --> 00:04:47,000
+Review process can leave commands here and the specific lines of code.
+
+72
+00:04:48,000 --> 00:04:51,000
+For example, why so many spaces here?
+
+73
+00:04:52,000 --> 00:04:58,000
+And the discussions have to be resolved, all my students who works with me offline assigned me to the
+
+74
+00:04:58,000 --> 00:05:05,000
+airport requests and during the offline lessons we reuseable request together and discuss with the group
+
+75
+00:05:05,000 --> 00:05:06,000
+what can be improved.
+
+76
+00:05:06,000 --> 00:05:10,000
+Let me also teach you how to admit to your request as an EHSANI.
+
+77
+00:05:11,000 --> 00:05:16,000
+I don't guarantee that I will be able to check each year request because for homework verification,
+
+78
+00:05:16,000 --> 00:05:21,000
+I use special type of tasks, coding exercises that verifies your homework automatically.
+
+79
+00:05:22,000 --> 00:05:24,000
+But you can learn at least how to read me here.
+
+80
+00:05:24,000 --> 00:05:30,000
+As I say, click the settings button next click manage access.
+
+81
+00:05:30,000 --> 00:05:36,000
+You might be asked to enter your password and I believe you understood that this is project specific
+
+82
+00:05:36,000 --> 00:05:37,000
+settings.
+
+83
+00:05:37,000 --> 00:05:43,000
+So in case you want to add collaborator's to your another project, you should open settings of that
+
+84
+00:05:43,000 --> 00:05:44,000
+exact repository.
+
+85
+00:05:44,000 --> 00:05:47,000
+Let's add me as a collaborator to your repository.
+
+86
+00:05:47,000 --> 00:05:50,000
+Press this green button, invite a collaborator.
+
+87
+00:05:50,000 --> 00:05:54,000
+You can find me using my nickname and repetoire.
+
+88
+00:05:54,000 --> 00:05:59,000
+I can't find myself because this is against the rules and this doesn't make sense.
+
+89
+00:05:59,000 --> 00:06:01,000
+But I can find one of my friends.
+
+90
+00:06:02,000 --> 00:06:06,000
+For example, let me find a friend of mine with the nickname Sweater Matko.
+
+91
+00:06:07,000 --> 00:06:12,000
+Similarly, you have to find my picture, click on it and press green button.
+
+92
+00:06:12,000 --> 00:06:14,000
+That is the rule of the GitHub.
+
+93
+00:06:14,000 --> 00:06:16,000
+Always press the green button.
+
+94
+00:06:16,000 --> 00:06:17,000
+Just joking.
+
+95
+00:06:18,000 --> 00:06:24,000
+I will not add Anri because I don't want to spam him because after I press green button and we should
+
+96
+00:06:24,000 --> 00:06:31,000
+receive request to become a collaborator in my repository and he also has to approve this request and
+
+97
+00:06:31,000 --> 00:06:36,000
+only after he approved the request, only after that you will be able to find him in.
+
+98
+00:06:37,000 --> 00:06:42,000
+You drop down for your pull request to navigate back to your open request.
+
+99
+00:06:42,000 --> 00:06:44,000
+You can open pull requests tab.
+
+100
+00:06:44,000 --> 00:06:46,000
+And here is our fresh PR.
+
+101
+00:06:46,000 --> 00:06:50,000
+I can procedure, I can and assign this request to myself.
+
+102
+00:06:50,000 --> 00:06:52,000
+OK, let's proceed.
+
+103
+00:06:52,000 --> 00:06:58,000
+As I mentioned, reviewers and Ehsani check your piara and once all discussions are resolved as an emergency
+
+104
+00:06:59,000 --> 00:07:03,000
+request by pressing this button, this March button has three methods.
+
+105
+00:07:03,000 --> 00:07:05,000
+They are great American.
+
+106
+00:07:05,000 --> 00:07:09,000
+Commit squash and merge rebase and merge.
+
+107
+00:07:09,000 --> 00:07:14,000
+Keeping the clean data repository is one of the top priority tasks for all contributors.
+
+108
+00:07:14,000 --> 00:07:20,000
+That clean the tree can save you a lot of time when trying to track down comments related to embark
+
+109
+00:07:20,000 --> 00:07:24,000
+or issue the default option, which is create a much.
+
+110
+00:07:24,000 --> 00:07:29,000
+It will take all comments from the PR and add them to the master brunch with a new it.
+
+111
+00:07:30,000 --> 00:07:31,000
+Let's take a look at this slide.
+
+112
+00:07:32,000 --> 00:07:35,000
+Imagine that there is a main branch we have in it.
+
+113
+00:07:35,000 --> 00:07:37,000
+Commit and commit one and two.
+
+114
+00:07:38,000 --> 00:07:43,000
+You created your feature branch and that branch we created commits three and four.
+
+115
+00:07:44,000 --> 00:07:50,000
+You prepared to request and now we select default option from merging comments and you see that you
+
+116
+00:07:50,000 --> 00:07:57,000
+can it will be created on the master branch, the commit that you will look like this merge some specific
+
+117
+00:07:57,000 --> 00:07:57,000
+branch.
+
+118
+00:07:57,000 --> 00:07:58,000
+That's it.
+
+119
+00:07:59,000 --> 00:08:04,000
+The result message is not very helpful when you will try to understand what this comment is about.
+
+120
+00:08:04,000 --> 00:08:07,000
+That's why this is not a recommended option by many developers.
+
+121
+00:08:08,000 --> 00:08:13,000
+We want to keep our gate historically and imagine the same case, but this time we would select the
+
+122
+00:08:13,000 --> 00:08:15,000
+second possible option, which is squash and match.
+
+123
+00:08:16,000 --> 00:08:22,000
+What is going to happen in this case, commence three and four will be added to the master branch.
+
+124
+00:08:22,000 --> 00:08:29,000
+What will happen is that Cummins will become blind and any other commit message can be added comit four
+
+125
+00:08:29,000 --> 00:08:36,000
+will be squashed into three and we will give any message we like with the help of GitHub interface and
+
+126
+00:08:36,000 --> 00:08:39,000
+what will happen in case I will opt for the search option.
+
+127
+00:08:39,000 --> 00:08:46,000
+Ribis and merge neurons are based in our commands are put on top of the master branch like you see on
+
+128
+00:08:46,000 --> 00:08:47,000
+this slide.
+
+129
+00:08:47,000 --> 00:08:48,000
+Come in three and four.
+
+130
+00:08:48,000 --> 00:08:51,000
+I just put on the top of the Master Branch.
+
+131
+00:08:51,000 --> 00:08:53,000
+Definitely attack.
+
+132
+00:08:53,000 --> 00:08:55,000
+It will choose strategies that you have to follow.
+
+133
+00:08:55,000 --> 00:09:00,000
+But my personal preference is rebase and match is not squash and much.
+
+134
+00:09:01,000 --> 00:09:07,000
+I believe if a developer wants to squash Kummetz, he or she has to do that locally in the local repository
+
+135
+00:09:07,000 --> 00:09:11,000
+before even pushing branch to the remote repository, but not ask us.
+
+136
+00:09:11,000 --> 00:09:16,000
+I need to squash your comments, but I also met tech leads that would prefer squash and match.
+
+137
+00:09:16,000 --> 00:09:22,000
+Rather than teach engineers how to write Canete messages and how to do squash later in this course,
+
+138
+00:09:22,000 --> 00:09:24,000
+I will show you how you can squash Kummetz.
+
+139
+00:09:25,000 --> 00:09:31,000
+Being a project owner, you can disable much methods that you don't like to do that, click on the settings
+
+140
+00:09:31,000 --> 00:09:38,000
+button and scroll page to the bottom, find merge button and uncheck methods that you don't need.
+
+141
+00:09:43,000 --> 00:09:49,000
+And if I would open my paper one more time, I can see that I have only one option available.
+
+142
+00:09:49,000 --> 00:09:52,000
+Let me select the third method and close my pull request.
+
+143
+00:09:58,000 --> 00:09:58,000
+Awesome.
+
+144
+00:09:59,000 --> 00:10:05,000
+Now, you can delete the task branch because it is not needed anymore in remote repository, since you
+
+145
+00:10:05,000 --> 00:10:11,000
+have already merged into the master branch and to not confuse anyone, let's remove it.
+
+146
+00:10:16,000 --> 00:10:20,000
+You can see that there is no task branch anymore in our remote repository.
+
+147
+00:10:21,000 --> 00:10:26,000
+Now our request is closed and we can check our current history of the master branch.
+
+148
+00:10:27,000 --> 00:10:30,000
+Make sure you are on the master branch and click here on Kummetz.
+
+149
+00:10:31,000 --> 00:10:37,000
+And we see that no other comments from Ergin were created on the committees that were created by us.
+
+150
+00:10:38,000 --> 00:10:38,000
+Great.
+
+151
+00:10:39,000 --> 00:10:44,000
+I believe now we can recap everything, what we have learned today in this lesson, we learned what
+
+152
+00:10:44,000 --> 00:10:49,000
+a pull request is and what is the difference between a pull request and a magic quest.
+
+153
+00:10:49,000 --> 00:10:52,000
+Together, we created a pull request.
+
+154
+00:10:52,000 --> 00:10:57,000
+I showed you how you can add collaborator's to the repository and we discussed what is the difference
+
+155
+00:10:57,000 --> 00:11:00,000
+between us any and reviewer and two requests.
+
+156
+00:11:00,000 --> 00:11:05,000
+Also today, we learned different management strategies and understood the difference between them.
+
+157
+00:11:06,000 --> 00:11:07,000
+That's all for now.
+
+158
+00:11:07,000 --> 00:11:10,000
+Thanks a lot for your attention and see you in the next lesson.
+
diff --git a/17 - GIT/011 Updating local repository (fetch, merge, pull) & Team development demo_en.srt b/17 - GIT/011 Updating local repository (fetch, merge, pull) & Team development demo_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..c7186a367c92d785956d05806d15c15f48d94c6a
--- /dev/null
+++ b/17 - GIT/011 Updating local repository (fetch, merge, pull) & Team development demo_en.srt
@@ -0,0 +1,712 @@
+1
+00:00:06,000 --> 00:00:10,000
+Hello, dear students in this class, and I'll teach you how you can update your local repository.
+
+2
+00:00:10,000 --> 00:00:16,000
+Today, I will explain to you why we need to update our local repository, how often we have to do that
+
+3
+00:00:16,000 --> 00:00:17,000
+and what commands we have to use.
+
+4
+00:00:18,000 --> 00:00:23,000
+Today, I prepared a special demo with the and flow in which I will show you commands that you are going
+
+5
+00:00:23,000 --> 00:00:25,000
+to use in most cases at your work.
+
+6
+00:00:26,000 --> 00:00:30,000
+I will tell you today, more and more to get fetch, get Merche, get pool commands.
+
+7
+00:00:30,000 --> 00:00:33,000
+Also, I will explain what does Fastforward mean.
+
+8
+00:00:34,000 --> 00:00:36,000
+We are going to learn a lot today.
+
+9
+00:00:36,000 --> 00:00:42,000
+Let's start first of all, let's answer the question why we have to update our local repository.
+
+10
+00:00:42,000 --> 00:00:47,000
+We have to update our local repository because we want to be sure that the codes that we created will
+
+11
+00:00:47,000 --> 00:00:49,000
+work with other the court as expected.
+
+12
+00:00:49,000 --> 00:00:54,000
+That is the most important reason of updating local repository as often as we can.
+
+13
+00:00:54,000 --> 00:00:56,000
+To what situations?
+
+14
+00:00:56,000 --> 00:01:01,000
+When you work on some task for one week or two weeks and when you need to merge your code with Master
+
+15
+00:01:01,000 --> 00:01:04,000
+Branch, you discover multiple conflicts in your code.
+
+16
+00:01:04,000 --> 00:01:09,000
+Today, I will show you command and real examples how you can update your local repository.
+
+17
+00:01:09,000 --> 00:01:13,000
+In previous lesson, you learned how to prepare people request and merge changes.
+
+18
+00:01:13,000 --> 00:01:19,000
+Now let's imagine that you successfully completed your previous task and you are about to start your
+
+19
+00:01:19,000 --> 00:01:20,000
+work on the new task.
+
+20
+00:01:20,000 --> 00:01:24,000
+Right now, in my local repository, I I'm on the task branch.
+
+21
+00:01:24,000 --> 00:01:29,000
+We already know that to start work on the new task and to separate code one from another, I have to
+
+22
+00:01:29,000 --> 00:01:30,000
+create a new branch.
+
+23
+00:01:31,000 --> 00:01:35,000
+Usually I want to create a new branch from the latest version of the source code.
+
+24
+00:01:35,000 --> 00:01:37,000
+So let me switch the master branch.
+
+25
+00:01:38,000 --> 00:01:43,000
+OK, I'm on the master branch, but do I have the latest version of my code here?
+
+26
+00:01:44,000 --> 00:01:49,000
+Let me navigate the SASE folder and check whether I have all the latest updates on this branch.
+
+27
+00:01:49,000 --> 00:01:53,000
+To navigate to the SRT folder, I have to type CGY SAAC.
+
+28
+00:01:54,000 --> 00:02:03,000
+OK, now let's list all the files else that shall and you see that we don't have this calculation service
+
+29
+00:02:03,000 --> 00:02:08,000
+here, why I'm on the Master Branch and we merged our changes with the master branch.
+
+30
+00:02:08,000 --> 00:02:15,000
+And the previous lesson, let's not confuse two things Master Branch and a region master branch.
+
+31
+00:02:15,000 --> 00:02:20,000
+And previous lesson when the merged request was called to the region master branch.
+
+32
+00:02:21,000 --> 00:02:24,000
+But we didn't merge, got into our master branch.
+
+33
+00:02:24,000 --> 00:02:25,000
+So what to do now?
+
+34
+00:02:26,000 --> 00:02:32,000
+Now we are going to learn a few commands, get fetch what is good for each command.
+
+35
+00:02:32,000 --> 00:02:38,000
+This command fetches all changes from the remote repository and put it in your local repository one
+
+36
+00:02:38,000 --> 00:02:39,000
+more time.
+
+37
+00:02:39,000 --> 00:02:44,000
+Important thing to mention here is that changes are not matched to your local branches.
+
+38
+00:02:44,000 --> 00:02:51,000
+So in case some comments in the region Master Branch exist, which a local repository is not aware of,
+
+39
+00:02:51,000 --> 00:02:56,000
+PFEG Command will save information about these changes in your local repository.
+
+40
+00:02:56,000 --> 00:02:58,000
+Let me press enter now.
+
+41
+00:02:58,000 --> 00:03:03,000
+Based on the log messages here, we can conclude that some changes were downloaded from the remote.
+
+42
+00:03:04,000 --> 00:03:10,000
+OK, probably now I have all the latest changes in my branch, including new file, discount calculation
+
+43
+00:03:10,000 --> 00:03:13,000
+service and all the latest changes from the Hello World File.
+
+44
+00:03:13,000 --> 00:03:16,000
+Let me check it one more time as well.
+
+45
+00:03:17,000 --> 00:03:20,000
+And again, I don't have any latest updates.
+
+46
+00:03:20,000 --> 00:03:21,000
+Why?
+
+47
+00:03:21,000 --> 00:03:27,000
+Because I have just downloaded information about these changes, but I didn't actually merge these changes
+
+48
+00:03:27,000 --> 00:03:28,000
+in the local branch.
+
+49
+00:03:29,000 --> 00:03:31,000
+Then what is the purpose of this command at all?
+
+50
+00:03:32,000 --> 00:03:37,000
+Imagine that you are working on the new changes and I don't want to merge latest code into your branch.
+
+51
+00:03:37,000 --> 00:03:39,000
+Do not break anything.
+
+52
+00:03:39,000 --> 00:03:44,000
+And you would like to know whether there are any changes in remote branch that are needed to be merged.
+
+53
+00:03:45,000 --> 00:03:47,000
+One more use case of using it for each command.
+
+54
+00:03:48,000 --> 00:03:53,000
+You can fetch changes while sitting in the office and the security VPN connection and you can merge
+
+55
+00:03:53,000 --> 00:03:58,000
+carefully your code later when you want while sitting on your cozy chair at your home.
+
+56
+00:03:59,000 --> 00:04:02,000
+But what if I am already at my home sitting on the couch?
+
+57
+00:04:03,000 --> 00:04:04,000
+What do I have to do now?
+
+58
+00:04:05,000 --> 00:04:10,000
+Now I have to merge these changes into my local branch, so I'm doing it.
+
+59
+00:04:10,000 --> 00:04:12,000
+Merge command gate.
+
+60
+00:04:12,000 --> 00:04:12,000
+Merge.
+
+61
+00:04:13,000 --> 00:04:14,000
+Awesome.
+
+62
+00:04:14,000 --> 00:04:20,000
+It looks like some changes have been merged with my master branch, I see Fastforward message here.
+
+63
+00:04:21,000 --> 00:04:22,000
+What does that mean?
+
+64
+00:04:23,000 --> 00:04:29,000
+And fast forward is what it does when you merge or a base against a branch that is simply ahead, the
+
+65
+00:04:29,000 --> 00:04:30,000
+one you have checked out.
+
+66
+00:04:31,000 --> 00:04:38,000
+That means there was no branches and that is the new value of the branch is a direct descendant of the
+
+67
+00:04:38,000 --> 00:04:39,000
+prior values.
+
+68
+00:04:39,000 --> 00:04:46,000
+So we had a region master branch that contains commands that are descendant of our previous master branch.
+
+69
+00:04:46,000 --> 00:04:52,000
+That's why we call such merging as fast forward now when we have merged the latest updates.
+
+70
+00:04:52,000 --> 00:04:56,000
+Let me check list of files and dash I'll command.
+
+71
+00:04:57,000 --> 00:04:57,000
+Wow.
+
+72
+00:04:57,000 --> 00:05:01,000
+Finally, I have this calculation service file in my file system.
+
+73
+00:05:01,000 --> 00:05:05,000
+That is the latest changes that have emerged in the remote repository.
+
+74
+00:05:05,000 --> 00:05:07,000
+Let me also check that update from Hello.
+
+75
+00:05:07,000 --> 00:05:09,000
+World File is also in place.
+
+76
+00:05:09,000 --> 00:05:14,000
+And previously we updated Hillenburg file and put extra lines in it.
+
+77
+00:05:14,000 --> 00:05:17,000
+Let me open this file in a text editor.
+
+78
+00:05:17,000 --> 00:05:18,000
+Nana.
+
+79
+00:05:18,000 --> 00:05:20,000
+Hello, World Dodgeville.
+
+80
+00:05:20,000 --> 00:05:21,000
+Nice.
+
+81
+00:05:21,000 --> 00:05:24,000
+I see only one characters outplays place here.
+
+82
+00:05:24,000 --> 00:05:30,000
+Let me exit now Ed by pressing control and simultaneously as described here.
+
+83
+00:05:31,000 --> 00:05:38,000
+Now, I want you to learn one more command that is good, but what is it command essentially getable
+
+84
+00:05:38,000 --> 00:05:41,000
+is a combination of two actions, PFEG and March.
+
+85
+00:05:42,000 --> 00:05:47,000
+So in case you want to fetch all changes from the remote repository and at the same time merge them
+
+86
+00:05:47,000 --> 00:05:50,000
+into the branch you have to use to command.
+
+87
+00:05:50,000 --> 00:05:52,000
+You're our demo today.
+
+88
+00:05:52,000 --> 00:05:56,000
+I want to show you real life scenarios that will happen with you on your workplace.
+
+89
+00:05:56,000 --> 00:06:02,000
+I want you not to learn just commands, but understand how you will use it while working with steam.
+
+90
+00:06:02,000 --> 00:06:08,000
+The name of this I prepared enter and flow that will show you the full scenario of what we learned so
+
+91
+00:06:08,000 --> 00:06:08,000
+far.
+
+92
+00:06:09,000 --> 00:06:11,000
+And I want you to be ready.
+
+93
+00:06:11,000 --> 00:06:16,000
+I want you to understand how team development is happening together.
+
+94
+00:06:16,000 --> 00:06:18,000
+We're going to imitate the next generation.
+
+95
+00:06:19,000 --> 00:06:23,000
+Imagine that we work on the implementation of virtual card in our online shop.
+
+96
+00:06:24,000 --> 00:06:25,000
+We are working on this task.
+
+97
+00:06:26,000 --> 00:06:32,000
+At the same time, developer number two works on the implementation of service that will provide functionality
+
+98
+00:06:32,000 --> 00:06:33,000
+of stock management.
+
+99
+00:06:34,000 --> 00:06:38,000
+Both engineers created the branch from the same revision, from the same command.
+
+100
+00:06:39,000 --> 00:06:43,000
+After that we created bool request and our changes were successfully merged.
+
+101
+00:06:43,000 --> 00:06:49,000
+And after that, developer number two created Pulu request and his request was successfully matched.
+
+102
+00:06:49,000 --> 00:06:56,000
+After that, we want to proceed with implementation of the next task product preservation, let's say.
+
+103
+00:06:56,000 --> 00:07:02,000
+But before start work on the new task, we have to pull all the latest changes to create the branch
+
+104
+00:07:02,000 --> 00:07:03,000
+with the latest updates.
+
+105
+00:07:03,000 --> 00:07:06,000
+And we have to execute get command.
+
+106
+00:07:07,000 --> 00:07:11,000
+Hope you you're not confused, but I want you to be prepared for the real life.
+
+107
+00:07:11,000 --> 00:07:14,000
+And this is the easiest real life scenario with only two developers.
+
+108
+00:07:15,000 --> 00:07:18,000
+Let them together, try to reproduce this in error.
+
+109
+00:07:18,000 --> 00:07:21,000
+So we are going to have next steps.
+
+110
+00:07:21,000 --> 00:07:28,000
+Developer one and two created branches and the changes after that, both engineers created peers that
+
+111
+00:07:28,000 --> 00:07:31,000
+were a match to the original master branch developer.
+
+112
+00:07:31,000 --> 00:07:34,000
+One post latest changes to start work on the new task.
+
+113
+00:07:35,000 --> 00:07:35,000
+Let's start.
+
+114
+00:07:36,000 --> 00:07:38,000
+Here is what we are going to do on our book.
+
+115
+00:07:39,000 --> 00:07:41,000
+Let's check the status of the master branch.
+
+116
+00:07:42,000 --> 00:07:45,000
+So it is up to date with the region masterbrand.
+
+117
+00:07:45,000 --> 00:07:46,000
+Cool.
+
+118
+00:07:46,000 --> 00:07:55,000
+Now let me create a new branch gates, which was option C G, a three zero to virtual car with which
+
+119
+00:07:55,000 --> 00:07:56,000
+to the new branch.
+
+120
+00:07:57,000 --> 00:07:59,000
+Let's imitate implementation of this task.
+
+121
+00:07:59,000 --> 00:08:04,000
+I will create a special directory called Card and Mkdir Card.
+
+122
+00:08:06,000 --> 00:08:08,000
+Here is a command that creates a directory.
+
+123
+00:08:09,000 --> 00:08:13,000
+Now let's navigate into this directory, S.A.G. cars.
+
+124
+00:08:14,000 --> 00:08:19,000
+Now let's create card management service file and we will pretend that there is a task implemented in
+
+125
+00:08:19,000 --> 00:08:20,000
+this file.
+
+126
+00:08:21,000 --> 00:08:23,000
+Darch Card Management Service Dajarra.
+
+127
+00:08:24,000 --> 00:08:31,000
+By the way, you can't push and commit only folder's if you want to set some basic folder structure
+
+128
+00:08:31,000 --> 00:08:32,000
+for your program.
+
+129
+00:08:32,000 --> 00:08:34,000
+There should be files in these folders.
+
+130
+00:08:35,000 --> 00:08:40,000
+OK, now let's add this to Sustagen yet at DOT and commit this change.
+
+131
+00:08:41,000 --> 00:08:45,000
+Yet commit dash and card management is implemented.
+
+132
+00:08:50,000 --> 00:08:58,000
+OK, we have a comment now let's push it to our region, yet push the our region keets three zero to
+
+133
+00:08:58,000 --> 00:08:59,000
+your troll car.
+
+134
+00:09:03,000 --> 00:09:05,000
+We'll create a pull request now.
+
+135
+00:09:05,000 --> 00:09:10,000
+Give me a few seconds here, you already know how to create a PR from the previous lesson.
+
+136
+00:09:17,000 --> 00:09:20,000
+PR is created what we want merge, they scored so far.
+
+137
+00:09:21,000 --> 00:09:26,000
+Meanwhile, developer number two created a separate branch to implement stock management.
+
+138
+00:09:30,000 --> 00:09:37,000
+OK, the same as here developer number two and the master branch and in the SLC directory, he wants
+
+139
+00:09:37,000 --> 00:09:44,000
+to start work on the new task and create a new branch Gates, which is option C, a three zero three
+
+140
+00:09:44,000 --> 00:09:45,000
+stock management.
+
+141
+00:09:45,000 --> 00:09:50,000
+Let's create a new folder in the SAAC directory mkdir stock.
+
+142
+00:09:51,000 --> 00:09:54,000
+Right now I create a directory in the search folder.
+
+143
+00:09:54,000 --> 00:09:57,000
+Let me navigate their C.G. stock.
+
+144
+00:09:58,000 --> 00:10:00,000
+OK, I'm here now.
+
+145
+00:10:00,000 --> 00:10:08,000
+Let me create a file Derg Stock Management Service Dot Java cuz that and this file to the staging area
+
+146
+00:10:09,000 --> 00:10:16,000
+get at dot and now let's commit yet command dash and stock management is implemented.
+
+147
+00:10:18,000 --> 00:10:25,000
+And let's push it to the remote, get push there for you, originally, a three zero three stock management.
+
+148
+00:10:27,000 --> 00:10:30,000
+Now I have to create a request for this change.
+
+149
+00:10:39,000 --> 00:10:41,000
+Let us manage to pull requests now.
+
+150
+00:10:58,000 --> 00:11:05,000
+And you see that quote in Monster is updated in caves during the new task, implementation you would
+
+151
+00:11:05,000 --> 00:11:08,000
+need is a correct management service or stock management service.
+
+152
+00:11:08,000 --> 00:11:14,000
+It is better for you to learn it earlier, because, first of all, probably you're going to use this
+
+153
+00:11:14,000 --> 00:11:18,000
+court or this court might break your court anyway.
+
+154
+00:11:19,000 --> 00:11:25,000
+It is better to have all changes from all developers on place in your local repository before start
+
+155
+00:11:25,000 --> 00:11:26,000
+any new work.
+
+156
+00:11:26,000 --> 00:11:31,000
+And finally, we return to the main branch and want to start work on the new task.
+
+157
+00:11:32,000 --> 00:11:37,000
+But right now, we have to make sure that we have the latest changes in the master branch before create
+
+158
+00:11:37,000 --> 00:11:38,000
+a new branch.
+
+159
+00:11:39,000 --> 00:11:45,000
+OK, what we have to do now, probably you would say get pfeg and get merge, but let's execute git
+
+160
+00:11:45,000 --> 00:11:46,000
+pull command.
+
+161
+00:11:48,000 --> 00:11:55,000
+Awesome, we pulled our changes and we are ready to work on the new task you see here, I pulled card
+
+162
+00:11:55,000 --> 00:12:00,000
+management service and stock management service and you see that we don't necessarily have to do get
+
+163
+00:12:00,000 --> 00:12:01,000
+pfeg.
+
+164
+00:12:01,000 --> 00:12:02,000
+And after that it gets merged.
+
+165
+00:12:02,000 --> 00:12:06,000
+Command get combines these two commands into one.
+
+166
+00:12:06,000 --> 00:12:11,000
+I can check my card and stock directory and find files there, you see.
+
+167
+00:12:12,000 --> 00:12:18,000
+We finished our practice exercise, Holmes's A Small Demo will help you to understand how we can use
+
+168
+00:12:18,000 --> 00:12:18,000
+it.
+
+169
+00:12:18,000 --> 00:12:21,000
+You're the game collaboration and new task implementation.
+
+170
+00:12:22,000 --> 00:12:24,000
+Let's recap what we have learned today.
+
+171
+00:12:25,000 --> 00:12:28,000
+Today, we learned why we need to update our local repository.
+
+172
+00:12:28,000 --> 00:12:32,000
+We also learned to get Fairgate marriage and get boogerman.
+
+173
+00:12:32,000 --> 00:12:38,000
+Now you know that you have to update your master branch before you start working on each new task.
+
+174
+00:12:38,000 --> 00:12:44,000
+You also understand the difference between a get FEG marriage and pull commence today.
+
+175
+00:12:44,000 --> 00:12:50,000
+So what is fastforward in it and at the end of the lesson I showed you and flow of how team development
+
+176
+00:12:50,000 --> 00:12:52,000
+is look like with the help of the get.
+
+177
+00:12:53,000 --> 00:12:54,000
+Thanks a lot for your attention.
+
+178
+00:12:55,000 --> 00:12:57,000
+See you in the next lesson.
+
diff --git a/17 - GIT/012 Merge Conflicts_en.srt b/17 - GIT/012 Merge Conflicts_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..d9daa9c7bc44f52c895c1d9ff382b8febe3befd8
--- /dev/null
+++ b/17 - GIT/012 Merge Conflicts_en.srt
@@ -0,0 +1,796 @@
+1
+00:00:06,000 --> 00:00:11,000
+Hello, yes, students, in this lesson, you learn what most conflicts are in simple words, I will
+
+2
+00:00:11,000 --> 00:00:17,000
+explain in one, much conflicts could appear together, will reproduce real life scenarios, merge conflict.
+
+3
+00:00:17,000 --> 00:00:23,000
+And what is even more interesting, I will tell you how to solve major conflicts together during the
+
+4
+00:00:23,000 --> 00:00:23,000
+drama.
+
+5
+00:00:23,000 --> 00:00:28,000
+We are going to solve much conflict that will appear during the pulling from the remote repository.
+
+6
+00:00:28,000 --> 00:00:32,000
+And as usual, let's together give a definition to the conflict.
+
+7
+00:00:33,000 --> 00:00:39,000
+The conflict is a specific event that takes place when it is unable to resolve differences in code between
+
+8
+00:00:39,000 --> 00:00:40,000
+two commits automatically.
+
+9
+00:00:41,000 --> 00:00:45,000
+This is a event which we can't avoid during the development in the team.
+
+10
+00:00:45,000 --> 00:00:49,000
+Usually it may happen when two developers change in the same line of code.
+
+11
+00:00:49,000 --> 00:00:50,000
+How it can be.
+
+12
+00:00:50,000 --> 00:00:54,000
+For example, imagine that in our project we have some web page and developer.
+
+13
+00:00:54,000 --> 00:00:59,000
+No one worked on the task to implement login button and added some styles.
+
+14
+00:00:59,000 --> 00:01:06,000
+She included these styles into our HTML page and developing a number to work on the task for implementing
+
+15
+00:01:06,000 --> 00:01:08,000
+carcel on the home page.
+
+16
+00:01:08,000 --> 00:01:15,000
+Engineer number two also had to do adjustments in the home page because he wanted to include his custom
+
+17
+00:01:15,000 --> 00:01:18,000
+styles and adjust page markup a bit.
+
+18
+00:01:18,000 --> 00:01:21,000
+First, Engineer pushed his code to his original branch.
+
+19
+00:01:22,000 --> 00:01:25,000
+He also created a pool request that was successfully merged.
+
+20
+00:01:25,000 --> 00:01:28,000
+But one second engineer tried to create a pool request.
+
+21
+00:01:28,000 --> 00:01:31,000
+He received an error that there are no conflicts.
+
+22
+00:01:31,000 --> 00:01:32,000
+Why?
+
+23
+00:01:32,000 --> 00:01:38,000
+Because two engineers and they did the same file home that each demo and most likely in the same lines
+
+24
+00:01:38,000 --> 00:01:39,000
+of code.
+
+25
+00:01:39,000 --> 00:01:47,000
+And you can't understand what version of code is the latest one and the proper one, yet can't match
+
+26
+00:01:47,000 --> 00:01:48,000
+this code automatically.
+
+27
+00:01:48,000 --> 00:01:51,000
+This situation is called much conflict.
+
+28
+00:01:52,000 --> 00:01:53,000
+What to do in this case?
+
+29
+00:01:53,000 --> 00:01:56,000
+In this case, conflict should be resolved manually.
+
+30
+00:01:56,000 --> 00:02:02,000
+Engineer number two has to pull all the latest changes into his branch, investigate where exactly this
+
+31
+00:02:02,000 --> 00:02:06,000
+conflict is appeared and resolve it by saying resolve it.
+
+32
+00:02:06,000 --> 00:02:11,000
+I mean change source code and create a command that will be approved to the gate that these changes
+
+33
+00:02:11,000 --> 00:02:16,000
+are created intentionally and well reviewed by some engineer after much conflict.
+
+34
+00:02:16,000 --> 00:02:19,000
+As a result, the file can be merged to the master branch.
+
+35
+00:02:19,000 --> 00:02:25,000
+So today we are going to review the example, how this much conflict is created and how to solve it.
+
+36
+00:02:25,000 --> 00:02:31,000
+Let's start to start with I'd like to inform you that for the sake of the demo before this lesson,
+
+37
+00:02:31,000 --> 00:02:36,000
+I created this home, the HTML file in the Web content directory.
+
+38
+00:02:36,000 --> 00:02:37,000
+Let's take a look at it.
+
+39
+00:02:39,000 --> 00:02:46,000
+As you can see, this is the simplest possible HTML file with an overall text in it, nothing special
+
+40
+00:02:46,000 --> 00:02:48,000
+to not lose focus from the goal of our lesson.
+
+41
+00:02:49,000 --> 00:02:53,000
+This file was created in the separate branch and merged with the remote repository.
+
+42
+00:02:53,000 --> 00:02:55,000
+You already know how to do that.
+
+43
+00:02:55,000 --> 00:02:57,000
+Now imagine the developer.
+
+44
+00:02:57,000 --> 00:03:02,000
+One wanted to create styles for login button and pop up on the homepage.
+
+45
+00:03:02,000 --> 00:03:04,000
+Let's create a new branch for that.
+
+46
+00:03:04,000 --> 00:03:10,000
+Yes, which was option C Geet three zero four login styling.
+
+47
+00:03:11,000 --> 00:03:16,000
+Just for the sake of example, let's imagine that we have some styles folder where Altius has files
+
+48
+00:03:16,000 --> 00:03:19,000
+should be stored for those who are not aware.
+
+49
+00:03:19,000 --> 00:03:25,000
+Files with the Texas extension are used for styling your elements on the HTML pages.
+
+50
+00:03:25,000 --> 00:03:28,000
+This stands for Cascadian Stylesheets.
+
+51
+00:03:28,000 --> 00:03:32,000
+OK, let me create Styles folder in my SAAC directory.
+
+52
+00:03:33,000 --> 00:03:34,000
+Mkdir Styles.
+
+53
+00:03:35,000 --> 00:03:40,000
+Now let's imagine that during the task implementation developer, no one created Neuters as file was
+
+54
+00:03:40,000 --> 00:03:46,000
+description of custom styles touch styles again nauseousness.
+
+55
+00:03:46,000 --> 00:03:55,000
+Also Injinoo number one adjusted Holmwood HTML file to include this style there to reproduce the steps
+
+56
+00:03:55,000 --> 00:03:56,000
+that I did in this lesson.
+
+57
+00:03:56,000 --> 00:03:59,000
+You can use any text or code editor you would like.
+
+58
+00:03:59,000 --> 00:04:05,000
+For the sake of the demo, I will use Nano text editor to save time on switching between different screens.
+
+59
+00:04:05,000 --> 00:04:14,000
+Let me open home e-mail file to adjusted nano web content slash hamdard HDMI.
+
+60
+00:04:15,000 --> 00:04:20,000
+Just to remind you, I always use that key for auto completion internal according to rules.
+
+61
+00:04:20,000 --> 00:04:27,000
+I can include TSF style on this page like this and the hat that I should put my link back with.
+
+62
+00:04:27,000 --> 00:04:38,000
+The path to the text file had a link rel stylesheet HSF double dot slash styles slash again not to assess
+
+63
+00:04:39,000 --> 00:04:42,000
+and clotheslined attack and had attack is closed.
+
+64
+00:04:43,000 --> 00:04:45,000
+This is not a tumultuous assess.
+
+65
+00:04:45,000 --> 00:04:48,000
+That's why I won't stop on the things I wrote.
+
+66
+00:04:48,000 --> 00:04:52,000
+But I would like to draw attention to the lines which we changed.
+
+67
+00:04:53,000 --> 00:04:55,000
+We changed line three, four and five.
+
+68
+00:04:56,000 --> 00:04:57,000
+Remember this.
+
+69
+00:04:57,000 --> 00:05:00,000
+This is important for understanding of the conflict topic.
+
+70
+00:05:00,000 --> 00:05:03,000
+I access this file and save it now.
+
+71
+00:05:03,000 --> 00:05:08,000
+Add everything to the staging area, create and commit and push it to the original branch.
+
+72
+00:05:09,000 --> 00:05:12,000
+Those are the things that we have already learned in the previous lessons.
+
+73
+00:05:12,000 --> 00:05:14,000
+Give me a few seconds here.
+
+74
+00:05:15,000 --> 00:05:25,000
+Get at not yet committed again and again yet Bush with option you originally a three zero for Logan
+
+75
+00:05:25,000 --> 00:05:26,000
+stylin.
+
+76
+00:05:27,000 --> 00:05:33,000
+Also, I can create pool requests, but the important thing right now is not to match your pool request.
+
+77
+00:05:33,000 --> 00:05:36,000
+Why we need to imitate case one.
+
+78
+00:05:36,000 --> 00:05:42,000
+Developer number two started implementation of his task without knowing about changes in the home.
+
+79
+00:05:42,000 --> 00:05:44,000
+Each team will understand.
+
+80
+00:05:44,000 --> 00:05:47,000
+Right now, let's pretend that we as the other engineer.
+
+81
+00:05:48,000 --> 00:05:54,000
+Let me let me get back to the massive branch and create new branch for my task from it gets which M.
+
+82
+00:05:55,000 --> 00:05:59,000
+Gates, which was option C, a three zero five homecourt.
+
+83
+00:05:59,000 --> 00:06:01,000
+So nice.
+
+84
+00:06:02,000 --> 00:06:04,000
+Now I have to create my own styles for Carasso.
+
+85
+00:06:05,000 --> 00:06:09,000
+Let me create file in styles directory take into account with each branch.
+
+86
+00:06:09,000 --> 00:06:11,000
+I don't have styles directory.
+
+87
+00:06:11,000 --> 00:06:13,000
+Here, let me show you this.
+
+88
+00:06:14,000 --> 00:06:19,000
+It is optional and you can see that Styles directory is not created yet on this branch.
+
+89
+00:06:20,000 --> 00:06:23,000
+Let me quickly created mkdir styles.
+
+90
+00:06:23,000 --> 00:06:32,000
+Now I can create miticides, file touch styles Carasso not to assess and now let me adjust home html
+
+91
+00:06:32,000 --> 00:06:33,000
+file.
+
+92
+00:06:34,000 --> 00:06:40,000
+None of content slash home dot HMO, I will put reference to my sister's file here.
+
+93
+00:06:41,000 --> 00:06:48,000
+At least, Carol Stylesheet, a triple double dose slash style slash carrousel, not Ceressus, and
+
+94
+00:06:48,000 --> 00:06:49,000
+close the attack.
+
+95
+00:06:50,000 --> 00:06:52,000
+Attack is also closed.
+
+96
+00:06:53,000 --> 00:07:00,000
+And you can notice that I changed lines number three, four and five, the same lines that as a developer
+
+97
+00:07:00,000 --> 00:07:01,000
+changed.
+
+98
+00:07:01,000 --> 00:07:02,000
+This is important.
+
+99
+00:07:03,000 --> 00:07:05,000
+Let me close and save this file.
+
+100
+00:07:06,000 --> 00:07:09,000
+I'm going to add all changes to the staging area.
+
+101
+00:07:09,000 --> 00:07:11,000
+Come in then and push to the remote repository.
+
+102
+00:07:12,000 --> 00:07:13,000
+Give me a few seconds here.
+
+103
+00:07:14,000 --> 00:07:15,000
+Get at DOT.
+
+104
+00:07:15,000 --> 00:07:18,000
+You'd commit option and carrousel on the home page.
+
+105
+00:07:19,000 --> 00:07:23,000
+Get push resorption you a region key, a three zero five home Carasso.
+
+106
+00:07:24,000 --> 00:07:30,000
+Now imagine that during implementation of the home Carasso task pool request for logging's talent was
+
+107
+00:07:30,000 --> 00:07:31,000
+matched by a technique.
+
+108
+00:07:32,000 --> 00:07:33,000
+Let me merge it.
+
+109
+00:07:35,000 --> 00:07:38,000
+OK, it is merged and nothing bad happened.
+
+110
+00:07:39,000 --> 00:07:42,000
+Now let me create a pool request for carrousel implementation.
+
+111
+00:07:46,000 --> 00:07:53,000
+First of all, I see here warning that this branch can't be automatically merged, but still I can create
+
+112
+00:07:53,000 --> 00:07:53,000
+a pull request.
+
+113
+00:07:54,000 --> 00:08:00,000
+And after I created a request, I see that my emerge button is disabled because of the conflicts you
+
+114
+00:08:00,000 --> 00:08:06,000
+can see in here that you can solve conflicts in the Web editor, while this can be an option in case
+
+115
+00:08:06,000 --> 00:08:08,000
+of the resolving of the small conflict.
+
+116
+00:08:08,000 --> 00:08:10,000
+This is not an option for the most cases.
+
+117
+00:08:11,000 --> 00:08:11,000
+Why?
+
+118
+00:08:12,000 --> 00:08:13,000
+Because of the few reasons.
+
+119
+00:08:14,000 --> 00:08:20,000
+Reason number one, most likely you have more complicated conflicts than we have now here.
+
+120
+00:08:20,000 --> 00:08:26,000
+And this is not convenient to change it in Web editor reason number two, after resolving conflicts,
+
+121
+00:08:26,000 --> 00:08:30,000
+you want to be sure that you didn't break anything for this?
+
+122
+00:08:30,000 --> 00:08:37,000
+You have to have your code on your local machine to run unit tests or integration tests on case HDMI
+
+123
+00:08:37,000 --> 00:08:42,000
+additon to open each HTML page to make sure that everything is OK with your markup.
+
+124
+00:08:42,000 --> 00:08:46,000
+So I will show you how you can solve conflicts on your local machine.
+
+125
+00:08:46,000 --> 00:08:48,000
+Let me get back to the Kit Bash.
+
+126
+00:08:48,000 --> 00:08:55,000
+I'm on my task home carrousel branch, as you can see here, to resolve the conflicts, I have to merge
+
+127
+00:08:55,000 --> 00:08:57,000
+a region master branch into the current branch.
+
+128
+00:08:57,000 --> 00:08:59,000
+You already know that.
+
+129
+00:08:59,000 --> 00:09:01,000
+Merge command, merge different branches.
+
+130
+00:09:01,000 --> 00:09:07,000
+But let me show you how you can merge remote branch into the current one yet pull a region master.
+
+131
+00:09:08,000 --> 00:09:13,000
+You also learned in previous lessons that pull command, merge changes into the branch.
+
+132
+00:09:14,000 --> 00:09:18,000
+And here you can see the message that there is a conflict in this file.
+
+133
+00:09:18,000 --> 00:09:20,000
+Automatic merge is failed.
+
+134
+00:09:20,000 --> 00:09:22,000
+Let resolve conflicts.
+
+135
+00:09:22,000 --> 00:09:26,000
+I have to open in any code ed file where I have conflicts.
+
+136
+00:09:27,000 --> 00:09:28,000
+For the sake of the demo.
+
+137
+00:09:28,000 --> 00:09:31,000
+I will use Nnenna Ed in this lesson now.
+
+138
+00:09:31,000 --> 00:09:35,000
+No map content egholm not HMO.
+
+139
+00:09:35,000 --> 00:09:39,000
+And here you can find different symbols that get added to our file.
+
+140
+00:09:40,000 --> 00:09:42,000
+That is how it shows the conflicts.
+
+141
+00:09:42,000 --> 00:09:48,000
+You already know that hat is a pointer to the place where you are currently in your working directory.
+
+142
+00:09:48,000 --> 00:09:50,000
+So here you can see our version of code.
+
+143
+00:09:51,000 --> 00:09:57,000
+We want to insert carrousel to assess and here changes from the master branch that were merged after
+
+144
+00:09:57,000 --> 00:09:59,000
+implementation of task by the world number one.
+
+145
+00:10:00,000 --> 00:10:01,000
+And check some of that comment.
+
+146
+00:10:02,000 --> 00:10:06,000
+We have to adjust file after some analysis.
+
+147
+00:10:06,000 --> 00:10:10,000
+I understood that in this particular case, I want to keep my changes and changes of developer.
+
+148
+00:10:10,000 --> 00:10:13,000
+No one will see that line.
+
+149
+00:10:13,000 --> 00:10:18,000
+Three and five were the same in two versions of code, but only in line number four was different.
+
+150
+00:10:19,000 --> 00:10:21,000
+We used different sets, file names here.
+
+151
+00:10:22,000 --> 00:10:24,000
+Let me add just markup accordingly.
+
+152
+00:10:25,000 --> 00:10:28,000
+After I'm done with changes, I exit and save this file.
+
+153
+00:10:29,000 --> 00:10:35,000
+Here in parentheses, you see mansions that I'm in the process of merging two branches also.
+
+154
+00:10:35,000 --> 00:10:39,000
+You can see that suggested to me to create the once conflicts are resolved.
+
+155
+00:10:40,000 --> 00:10:42,000
+Let's follow this advice and create a committee.
+
+156
+00:10:43,000 --> 00:10:49,000
+If you would check status with get status comment, then we would see that new file logging success
+
+157
+00:10:49,000 --> 00:10:51,000
+is already added to the staging area.
+
+158
+00:10:52,000 --> 00:10:55,000
+That's the one from the master branch where we don't have any conflicts.
+
+159
+00:10:56,000 --> 00:10:59,000
+And here is the file where we had a conflict.
+
+160
+00:10:59,000 --> 00:11:07,000
+Let me add it to the staging area yet at not now let's check status and we can see that all files are
+
+161
+00:11:07,000 --> 00:11:08,000
+in the staging area.
+
+162
+00:11:08,000 --> 00:11:12,000
+Now, let's create a climate gate comment.
+
+163
+00:11:12,000 --> 00:11:18,000
+I will skip the message now because for such cases get already stolen message for me, the message that
+
+164
+00:11:18,000 --> 00:11:21,000
+states that must branch is merged into the task branch.
+
+165
+00:11:22,000 --> 00:11:27,000
+Let's close this text editor and we can see that we successfully merged changes.
+
+166
+00:11:27,000 --> 00:11:31,000
+Now we need to update our branch in remote repository.
+
+167
+00:11:31,000 --> 00:11:32,000
+Let's push our changes.
+
+168
+00:11:33,000 --> 00:11:34,000
+Get Bush.
+
+169
+00:11:36,000 --> 00:11:39,000
+Now, let me refresh page with my pool request.
+
+170
+00:11:42,000 --> 00:11:50,000
+I can't rebase and merge, and I will explain why in the next lesson, but I can merge with creating
+
+171
+00:11:50,000 --> 00:11:51,000
+a new command.
+
+172
+00:11:52,000 --> 00:11:57,000
+And if you remember that in previous lesson I showed you different margined strategies and how to allow
+
+173
+00:11:57,000 --> 00:12:02,000
+different merging strategies here in the settings and the merge button section.
+
+174
+00:12:02,000 --> 00:12:06,000
+Congratulations yourself, your first merge conflict.
+
+175
+00:12:06,000 --> 00:12:08,000
+But unfortunately, we are not falling right now.
+
+176
+00:12:08,000 --> 00:12:11,000
+Best practices of keeping it historically.
+
+177
+00:12:12,000 --> 00:12:12,000
+Why?
+
+178
+00:12:13,000 --> 00:12:17,000
+Because first of all, we created separate committees during the merger and Origin Master Branch was
+
+179
+00:12:17,000 --> 00:12:23,000
+our task branch and right now we are under the risk to create one more committee for merging branches.
+
+180
+00:12:24,000 --> 00:12:28,000
+Can you imagine how our history tree will look like after all of this?
+
+181
+00:12:29,000 --> 00:12:31,000
+Your tax rate will be disappointed.
+
+182
+00:12:31,000 --> 00:12:33,000
+Just joking in the next lessons.
+
+183
+00:12:33,000 --> 00:12:37,000
+I will show you how to avoid this and how to keep your tax rate happy.
+
+184
+00:12:38,000 --> 00:12:42,000
+But still to understand the next lessons, you had to understand this lesson.
+
+185
+00:12:42,000 --> 00:12:47,000
+And why pull an origin master into your branch to resolve conflicts is not the best approach.
+
+186
+00:12:48,000 --> 00:12:53,000
+While this approach is still valid in some companies and in some development teams, that is not the
+
+187
+00:12:53,000 --> 00:12:57,000
+approach which I would approve in my development team and in my company.
+
+188
+00:12:57,000 --> 00:13:02,000
+Probably already aware that I am CEO of my own software development company.
+
+189
+00:13:02,000 --> 00:13:08,000
+And when I interviewed engineers, I paid extra attention to the experience of working with it, because
+
+190
+00:13:08,000 --> 00:13:14,000
+during the development of complex projects and cross-functional teams, these skills are very important.
+
+191
+00:13:14,000 --> 00:13:19,000
+I am going to create top notch software engineers from you during this course.
+
+192
+00:13:19,000 --> 00:13:22,000
+That's why I will run as a way to solve financial conflicts.
+
+193
+00:13:22,000 --> 00:13:27,000
+OK, and if we are good for the day, let's recap what we have learned today.
+
+194
+00:13:28,000 --> 00:13:34,000
+In this lesson, you learned what marriage conflicts are more over together, even we produce much conflict
+
+195
+00:13:34,000 --> 00:13:35,000
+in real life.
+
+196
+00:13:35,000 --> 00:13:41,000
+Example, you learned how to resolve marriage conflicts locally and how to manage a region must rush
+
+197
+00:13:41,000 --> 00:13:43,000
+into a task branch.
+
+198
+00:13:43,000 --> 00:13:45,000
+Thanks a lot for your attention.
+
+199
+00:13:45,000 --> 00:13:47,000
+See you in the next lesson.
+
diff --git a/17 - GIT/013 Git Rebasing & Force Update of remote repository_en.srt b/17 - GIT/013 Git Rebasing & Force Update of remote repository_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..3839d224412653e065a829aa5e097014fba9d881
--- /dev/null
+++ b/17 - GIT/013 Git Rebasing & Force Update of remote repository_en.srt
@@ -0,0 +1,968 @@
+1
+00:00:06,000 --> 00:00:11,000
+Hello, dear students, in this lesson, we'll learn what a great rebellion is and what for some day
+
+2
+00:00:11,000 --> 00:00:11,000
+it is.
+
+3
+00:00:12,000 --> 00:00:14,000
+I will show you how and when you can apply.
+
+4
+00:00:14,000 --> 00:00:15,000
+Get your base command.
+
+5
+00:00:15,000 --> 00:00:18,000
+I will explain what rebase actually means.
+
+6
+00:00:18,000 --> 00:00:23,000
+Also, I will explain the difference between good marriage and get to base after.
+
+7
+00:00:23,000 --> 00:00:24,000
+We will understand Ceri.
+
+8
+00:00:24,000 --> 00:00:30,000
+We'll take a look at real example and we'll learn how we can use our base command on a daily basis.
+
+9
+00:00:31,000 --> 00:00:35,000
+You're going to see how to keep your military clean during the lesson.
+
+10
+00:00:35,000 --> 00:00:39,000
+You're going to learn how to solve conflicts that could appear during the invasion.
+
+11
+00:00:39,000 --> 00:00:45,000
+On the other branch, on real examples, I will show you what gets replaced with option continue means
+
+12
+00:00:46,000 --> 00:00:47,000
+and how to complete the remaining process.
+
+13
+00:00:48,000 --> 00:00:53,000
+After we change the local comment history, I will show you what force of date is and how force with
+
+14
+00:00:53,000 --> 00:00:55,000
+lease option may help us.
+
+15
+00:00:55,000 --> 00:01:01,000
+And at the end of the lesson I'm going to share with you four Rules of Happy Perquisite by Peter.
+
+16
+00:01:02,000 --> 00:01:03,000
+Just jokin is always.
+
+17
+00:01:04,000 --> 00:01:09,000
+And to start with, let's discuss the problem which we faced during the previous lesson, if we resolved
+
+18
+00:01:09,000 --> 00:01:16,000
+conflicts with Bookham and you saw that one more comment was created and you also saw that I can't merge
+
+19
+00:01:16,000 --> 00:01:20,000
+with the best strategy to M. I can only merge with new command.
+
+20
+00:01:20,000 --> 00:01:27,000
+So our problem is how to get his territory clean, the presidential and union commands.
+
+21
+00:01:27,000 --> 00:01:30,000
+Let's understand first what our base is and how it works.
+
+22
+00:01:30,000 --> 00:01:35,000
+In general, there are two main ways to integrate changes from one branch into another.
+
+23
+00:01:35,000 --> 00:01:38,000
+Zaya Yes, merge and military base.
+
+24
+00:01:38,000 --> 00:01:42,000
+We already learned in previous lessons more about Gaete merging branches.
+
+25
+00:01:43,000 --> 00:01:47,000
+Now let's understand on the high level what is a rebase let's recall an example.
+
+26
+00:01:47,000 --> 00:01:52,000
+When we had the branches, the easiest way to synchronize the branches is to merge them.
+
+27
+00:01:53,000 --> 00:01:58,000
+So to merge C3 and C4 snapshots, we have to create one more snapshot.
+
+28
+00:01:58,000 --> 00:01:59,000
+Thus one more comment.
+
+29
+00:01:59,000 --> 00:02:00,000
+C five.
+
+30
+00:02:01,000 --> 00:02:04,000
+This option works just fine and we saw how it works.
+
+31
+00:02:05,000 --> 00:02:10,000
+But do we have another option that will not create additional senseless commit?
+
+32
+00:02:11,000 --> 00:02:12,000
+Yes, we do.
+
+33
+00:02:12,000 --> 00:02:15,000
+Based on the awesome branch, what does that mean?
+
+34
+00:02:15,000 --> 00:02:20,000
+We can take changes that we have in C four commit and put them on top of C three.
+
+35
+00:02:21,000 --> 00:02:27,000
+That mean you can take changes that were done on one branch and apply those changes on the other branch.
+
+36
+00:02:28,000 --> 00:02:33,000
+In our example, I can execute Command Guitry Bassmaster while being on the experiment branch.
+
+37
+00:02:34,000 --> 00:02:38,000
+This will lead us to the good history that you can see on this slide.
+
+38
+00:02:38,000 --> 00:02:42,000
+You can see that C snapshot is going right after C three.
+
+39
+00:02:43,000 --> 00:02:48,000
+This will allow the great pull request and merge branches and help with the and strategy.
+
+40
+00:02:48,000 --> 00:02:54,000
+In this particular scenario, we can switch back to the Master Branch and do fastforward much like it
+
+41
+00:02:54,000 --> 00:02:55,000
+has shown on the slide.
+
+42
+00:02:56,000 --> 00:03:02,000
+And in this case, you can see that there are no any other comments from Najin branches and we have
+
+43
+00:03:02,000 --> 00:03:03,000
+Coingate history.
+
+44
+00:03:04,000 --> 00:03:09,000
+We're also going to have lessons about interactive freebase a bit later in this course, where I will
+
+45
+00:03:09,000 --> 00:03:14,000
+show you how you can use reverse command to combine commands or to change commit messages.
+
+46
+00:03:15,000 --> 00:03:20,000
+But in this lesson, we'll run the rebels command only from the point of margin changes from different
+
+47
+00:03:20,000 --> 00:03:20,000
+branches.
+
+48
+00:03:21,000 --> 00:03:26,000
+On the previous slide, you saw base command to replace changes from another branch.
+
+49
+00:03:26,000 --> 00:03:31,000
+But in real life example, later today we are going to use a bit another variation of this command,
+
+50
+00:03:31,000 --> 00:03:33,000
+get ball with a base option.
+
+51
+00:03:34,000 --> 00:03:38,000
+So what is the difference between a military base and pool with a base option?
+
+52
+00:03:38,000 --> 00:03:43,000
+Using base command replaces the branch which we want get bored with.
+
+53
+00:03:43,000 --> 00:03:48,000
+The base option can be treated as shorthand for git fetch and then get through base command.
+
+54
+00:03:48,000 --> 00:03:54,000
+You will be able to fetch all the latest changes from the remote repository prior to revising our code
+
+55
+00:03:54,000 --> 00:03:54,000
+on top of it.
+
+56
+00:03:55,000 --> 00:04:01,000
+Because if I would just use Guitry Bassmaster Command, it would only take into account what local repository
+
+57
+00:04:01,000 --> 00:04:05,000
+is already aware of, but not the changes from the remote repository.
+
+58
+00:04:05,000 --> 00:04:07,000
+This is very important, practical tip.
+
+59
+00:04:08,000 --> 00:04:13,000
+That's why this video, of course, is so valuable to all my students, because even if you would read
+
+60
+00:04:13,000 --> 00:04:17,000
+documentation and use it to base, you wouldn't read the expected goal.
+
+61
+00:04:17,000 --> 00:04:20,000
+And it is not clear that Boogerman has a base option.
+
+62
+00:04:20,000 --> 00:04:23,000
+If only you read all your documentation.
+
+63
+00:04:23,000 --> 00:04:30,000
+Probably by this very moment of our lesson, you are wondering what is better get much or get base?
+
+64
+00:04:31,000 --> 00:04:34,000
+Which one should I use to give you the full answer?
+
+65
+00:04:34,000 --> 00:04:39,000
+I'd like you to understand one more time what repositories history means from different point of use.
+
+66
+00:04:40,000 --> 00:04:43,000
+Repository history is the records of what actually happened.
+
+67
+00:04:44,000 --> 00:04:51,000
+From this point of view, it might seem like not a good idea to change history from this angle.
+
+68
+00:04:51,000 --> 00:04:56,000
+Using the base is similar to lying about what actually happened in your repository.
+
+69
+00:04:56,000 --> 00:05:01,000
+But is this valid comment all the times or there are some exceptions?
+
+70
+00:05:01,000 --> 00:05:07,000
+What if there are a series of large companies that brings us almost zero information about conversion
+
+71
+00:05:07,000 --> 00:05:08,000
+improvements?
+
+72
+00:05:08,000 --> 00:05:12,000
+That brings us information that branches remerged OK?
+
+73
+00:05:12,000 --> 00:05:17,000
+And what that is logical is that branches should be merged at some point.
+
+74
+00:05:17,000 --> 00:05:24,000
+But I am more interested in the functionality of the specific version of code rather than the fact that
+
+75
+00:05:24,000 --> 00:05:25,000
+there was not much.
+
+76
+00:05:25,000 --> 00:05:29,000
+That is the point of view on what repositories history means.
+
+77
+00:05:30,000 --> 00:05:35,000
+My personal opinion is that we should treat our history as a story of how our project was made.
+
+78
+00:05:35,000 --> 00:05:40,000
+If we are writing a story, there is no harm in doing side notes and tracking each step.
+
+79
+00:05:41,000 --> 00:05:46,000
+But when times come to release the story and show it to the world, I want to tell more coherent story
+
+80
+00:05:46,000 --> 00:05:48,000
+without all my drafts.
+
+81
+00:05:48,000 --> 00:05:49,000
+And that didn't pass.
+
+82
+00:05:50,000 --> 00:05:55,000
+But despite my personal opinion, I believe you understood that there is no right answer which approach
+
+83
+00:05:55,000 --> 00:05:56,000
+is better.
+
+84
+00:05:56,000 --> 00:06:02,000
+And just keep in mind that all projects are different and there is no silver bullet for each project.
+
+85
+00:06:02,000 --> 00:06:04,000
+There is no one size fits all approach.
+
+86
+00:06:05,000 --> 00:06:09,000
+But being a true professional, you have to be aware about different points of view.
+
+87
+00:06:09,000 --> 00:06:13,000
+That's why I believe it is important for me to share this with you.
+
+88
+00:06:14,000 --> 00:06:20,000
+OK, now, when you understood the theory of revision, I suggest looking at our practical example.
+
+89
+00:06:21,000 --> 00:06:26,000
+Keen to understand the damage in this lesson, you have to understand the drama from previous lesson
+
+90
+00:06:26,000 --> 00:06:32,000
+because we have the same context as in previous lesson will proceed from the point where we finished
+
+91
+00:06:32,000 --> 00:06:32,000
+previous time.
+
+92
+00:06:33,000 --> 00:06:37,000
+Let me call Gitlow command of last's recommits gridlock.
+
+93
+00:06:37,000 --> 00:06:39,000
+Dash three here.
+
+94
+00:06:39,000 --> 00:06:43,000
+You can see that I have not commit one result together.
+
+95
+00:06:43,000 --> 00:06:44,000
+Much conflict.
+
+96
+00:06:44,000 --> 00:06:50,000
+You can see here that this much coming of this Ansar's Kummetz, you can check, check, checksum here.
+
+97
+00:06:51,000 --> 00:06:53,000
+And here's a reference to Logan pop up.
+
+98
+00:06:53,000 --> 00:06:54,000
+You're in Logan Command.
+
+99
+00:06:55,000 --> 00:06:59,000
+That is command that emerged from a three zero four branch.
+
+100
+00:06:59,000 --> 00:07:06,000
+And we see in parentheses that it is from a region master branch and we have our own command, which
+
+101
+00:07:06,000 --> 00:07:12,000
+we did, and scope of this branch gursel on the home page and then Miyu another option of handling much
+
+102
+00:07:12,000 --> 00:07:13,000
+conflict.
+
+103
+00:07:13,000 --> 00:07:19,000
+And to them or a base to you, I suggest we said in our state to the state of this comit carrousel on
+
+104
+00:07:19,000 --> 00:07:24,000
+the home page before we even did a good pull origin master command.
+
+105
+00:07:25,000 --> 00:07:30,000
+Right now you are going to get reset command, which we are going to learn in the separate lesson.
+
+106
+00:07:30,000 --> 00:07:36,000
+I have to use it in this lesson so that you would keep track of all my changes in the git repository.
+
+107
+00:07:36,000 --> 00:07:42,000
+I believe that showing all my actions and to you is the best way to learn such a powerful tool as good.
+
+108
+00:07:43,000 --> 00:07:50,000
+I will perform the next command and I will explain in short what it does get reset.
+
+109
+00:07:50,000 --> 00:07:56,000
+This command can reset state of your file system to the specific revision option.
+
+110
+00:07:56,000 --> 00:08:02,000
+Hard reset command has different modes will learn all possible modes in the separate lesson.
+
+111
+00:08:03,000 --> 00:08:09,000
+Heart means that files from the other region will be restored and all changes from other revisions will
+
+112
+00:08:09,000 --> 00:08:10,000
+be removed.
+
+113
+00:08:11,000 --> 00:08:13,000
+Had had is appointed as a current place.
+
+114
+00:08:13,000 --> 00:08:17,000
+And yet that is our last comment to the one.
+
+115
+00:08:17,000 --> 00:08:22,000
+This means reset state of our file system to the state that was one commit ago.
+
+116
+00:08:22,000 --> 00:08:26,000
+That is right before we pulled changes from the original Master Branch.
+
+117
+00:08:26,000 --> 00:08:30,000
+Let's press enter and here we are on the castle on the home page.
+
+118
+00:08:30,000 --> 00:08:32,000
+Commit, let's check.
+
+119
+00:08:32,000 --> 00:08:33,000
+Commit history now.
+
+120
+00:08:33,000 --> 00:08:35,000
+Get locked command.
+
+121
+00:08:36,000 --> 00:08:36,000
+Awesome.
+
+122
+00:08:37,000 --> 00:08:39,000
+We can even check our file system.
+
+123
+00:08:39,000 --> 00:08:45,000
+Let me show you that we don't have Logan says says file from another branch, said Stiles.
+
+124
+00:08:47,000 --> 00:08:54,000
+And residential, and you can see that we only have Gursel to file and we don't have any logins, he
+
+125
+00:08:54,000 --> 00:08:55,000
+says file here.
+
+126
+00:08:56,000 --> 00:08:56,000
+Cool.
+
+127
+00:08:56,000 --> 00:09:00,000
+Let's get back to the SASE directory, Siggie double dot.
+
+128
+00:09:01,000 --> 00:09:04,000
+And now, instead of doing it, pull origin master.
+
+129
+00:09:04,000 --> 00:09:07,000
+Let me execute another commands that we have learned today.
+
+130
+00:09:08,000 --> 00:09:11,000
+Get was optional base a region master.
+
+131
+00:09:12,000 --> 00:09:18,000
+This was expected in case we wouldn't have any major conflicts, rebates would be very smooth, but
+
+132
+00:09:18,000 --> 00:09:20,000
+that is way too easy for you.
+
+133
+00:09:20,000 --> 00:09:23,000
+Let me show you how to resolve NAHJ conflicts during the invasion.
+
+134
+00:09:24,000 --> 00:09:30,000
+I believe you remember that we expect much conflict in home, not HTML file, but this time we have
+
+135
+00:09:30,000 --> 00:09:32,000
+a bit different message.
+
+136
+00:09:32,000 --> 00:09:38,000
+We see that error happened during the invasion and commit could not be applied here.
+
+137
+00:09:38,000 --> 00:09:41,000
+It leaves a hint for you what to do in this case.
+
+138
+00:09:41,000 --> 00:09:44,000
+We have to resolve all conflicts manually.
+
+139
+00:09:44,000 --> 00:09:50,000
+After that, we have to either add or remove files to the staging area and execute rebels continued
+
+140
+00:09:50,000 --> 00:09:51,000
+command.
+
+141
+00:09:52,000 --> 00:09:58,000
+I don't recommend this keep this coming like it is shown here, because our goal is to resolve conflicts
+
+142
+00:09:58,000 --> 00:09:59,000
+and finish freebasing.
+
+143
+00:10:00,000 --> 00:10:05,000
+In case you understand that it is a mistake and something is going wrong, you can execute Guitry base
+
+144
+00:10:05,000 --> 00:10:07,000
+with abort option.
+
+145
+00:10:07,000 --> 00:10:13,000
+By the way, here in parentheses, you can see indications that we are in the process of revision right
+
+146
+00:10:13,000 --> 00:10:15,000
+now, but let us resolve conflicts.
+
+147
+00:10:16,000 --> 00:10:19,000
+Nano web content slash home, not HDMI.
+
+148
+00:10:20,000 --> 00:10:22,000
+Let me quickly resolve these conflicts.
+
+149
+00:10:23,000 --> 00:10:27,000
+After conflicts are resolved, I close and save this file.
+
+150
+00:10:28,000 --> 00:10:36,000
+Now, as it was said before, I have to add files to the staging area yet at DOD and now we can proceed
+
+151
+00:10:36,000 --> 00:10:41,000
+our amazing database, continue to get offers me to adjust my message.
+
+152
+00:10:41,000 --> 00:10:45,000
+But I want to keep it the same cursor on the homepage.
+
+153
+00:10:45,000 --> 00:10:47,000
+That sounds just perfect.
+
+154
+00:10:48,000 --> 00:10:54,000
+So I just closed the file and I see a message that I was successfully based on the other branch.
+
+155
+00:10:55,000 --> 00:10:59,000
+Now let me update my branch in remote repository to update my poll request.
+
+156
+00:11:00,000 --> 00:11:01,000
+Get Bush.
+
+157
+00:11:02,000 --> 00:11:04,000
+Oh, I see error here.
+
+158
+00:11:05,000 --> 00:11:06,000
+Those were rejected.
+
+159
+00:11:07,000 --> 00:11:07,000
+Why?
+
+160
+00:11:07,000 --> 00:11:14,000
+Because I already had a ranch in the remote repository, my region, a three zero five home carousel
+
+161
+00:11:14,000 --> 00:11:17,000
+branch, has different comment history rather than my local branch.
+
+162
+00:11:17,000 --> 00:11:24,000
+Now, because the base command changes get history and it is not smart enough to understand this.
+
+163
+00:11:25,000 --> 00:11:27,000
+Forget it is just looks like a mess.
+
+164
+00:11:27,000 --> 00:11:31,000
+Now, our local branch and their branch has a different history of comments.
+
+165
+00:11:31,000 --> 00:11:35,000
+Let's take a look one more time at the history of Cummins of the remote branch.
+
+166
+00:11:36,000 --> 00:11:37,000
+Can you see these two comments?
+
+167
+00:11:38,000 --> 00:11:40,000
+And you can see comments, checksum.
+
+168
+00:11:40,000 --> 00:11:45,000
+Now let's return to get Bush and check Commissaire git log.
+
+169
+00:11:45,000 --> 00:11:47,000
+Deshotel, can I see this?
+
+170
+00:11:48,000 --> 00:11:52,000
+We put our cursor on the homepage comit right on top of the massive branch.
+
+171
+00:11:53,000 --> 00:11:58,000
+That is actually what we base does and pay attention to check some here.
+
+172
+00:11:58,000 --> 00:11:59,000
+Can I see that?
+
+173
+00:11:59,000 --> 00:12:02,000
+It was the same message has different checks.
+
+174
+00:12:03,000 --> 00:12:07,000
+OK, well understood that our committee history is different on different branches.
+
+175
+00:12:07,000 --> 00:12:08,000
+But what to do now?
+
+176
+00:12:08,000 --> 00:12:11,000
+I need to tell you which version is correct.
+
+177
+00:12:12,000 --> 00:12:18,000
+I know that my current branch is the most relevant branch, so I have to update my original branch so
+
+178
+00:12:18,000 --> 00:12:21,000
+that it would have the same comment history as my local branch.
+
+179
+00:12:21,000 --> 00:12:26,000
+To do this, I need to perform the next command, get Bush with option F.
+
+180
+00:12:27,000 --> 00:12:29,000
+F stands for Force Update.
+
+181
+00:12:30,000 --> 00:12:37,000
+Be extra careful when you do this, because force update will erase changes that are currently present
+
+182
+00:12:37,000 --> 00:12:41,000
+in the remote repository in this branch if you are going to use from base command.
+
+183
+00:12:41,000 --> 00:12:45,000
+That means sometimes you would need to use force update option.
+
+184
+00:12:45,000 --> 00:12:47,000
+But one more time.
+
+185
+00:12:48,000 --> 00:12:49,000
+Be extra careful.
+
+186
+00:12:50,000 --> 00:12:57,000
+Use this option only with your branches, only with branches that only you are aware of, because in
+
+187
+00:12:57,000 --> 00:13:03,000
+case somebody created the branch from your branch and you change history and your branch was merged,
+
+188
+00:13:03,000 --> 00:13:08,000
+that will cause extra efforts for the engineer who created the branch from your branch.
+
+189
+00:13:08,000 --> 00:13:15,000
+Real life example, KYAY automation engineer who is going to help you with writing your tests for your
+
+190
+00:13:15,000 --> 00:13:16,000
+home.
+
+191
+00:13:16,000 --> 00:13:23,000
+Carasso created his own branch from your branch, your updated comment history and merge it to the master
+
+192
+00:13:23,000 --> 00:13:25,000
+key engineer can't match.
+
+193
+00:13:25,000 --> 00:13:32,000
+Mostly his branch needs that your branch needs to master right now without freebasing and solving conflicts
+
+194
+00:13:32,000 --> 00:13:33,000
+one more time.
+
+195
+00:13:33,000 --> 00:13:39,000
+Or imagine that key engineer merged his or her changes into your branch.
+
+196
+00:13:39,000 --> 00:13:46,000
+And by applying for update, he overrides those changes and the documents were lost.
+
+197
+00:13:46,000 --> 00:13:51,000
+This even sounds complicated, so please try to avoid this.
+
+198
+00:13:52,000 --> 00:13:58,000
+Today, we're going to create a few rules that will save you a ton of time and your nerves in the future.
+
+199
+00:13:58,000 --> 00:14:01,000
+I call this rules for rules of happy workwise.
+
+200
+00:14:01,000 --> 00:14:03,000
+Get by and repeat the rule.
+
+201
+00:14:03,000 --> 00:14:09,000
+Number one, always create branches from the master branch, but not from the other development branches.
+
+202
+00:14:10,000 --> 00:14:18,000
+Rule number two, force update only your own branches that you can be sure nobody using because of the
+
+203
+00:14:18,000 --> 00:14:21,000
+risk of losing data force is very risky mode.
+
+204
+00:14:22,000 --> 00:14:27,000
+What is less risky is the rule of thumb is using force with less option.
+
+205
+00:14:27,000 --> 00:14:35,000
+What is this about force, which is a safer option that will not override any work on the remote branch
+
+206
+00:14:35,000 --> 00:14:39,000
+if more comments were added to the remote branch by another team member.
+
+207
+00:14:39,000 --> 00:14:42,000
+Based on this, let's make rule number three.
+
+208
+00:14:42,000 --> 00:14:47,000
+When you need to use force update, always use force with less option.
+
+209
+00:14:47,000 --> 00:14:52,000
+I can't even count how much time this simple rule saves me tons of time.
+
+210
+00:14:53,000 --> 00:14:56,000
+So we use force with this option.
+
+211
+00:14:56,000 --> 00:14:57,000
+Let's press enter button.
+
+212
+00:14:58,000 --> 00:15:04,000
+Take into account no update in my branch, I successfully updated my branch in the remote repository
+
+213
+00:15:04,000 --> 00:15:07,000
+and my request let's check my power now.
+
+214
+00:15:08,000 --> 00:15:09,000
+Can you see this?
+
+215
+00:15:09,000 --> 00:15:15,000
+I have one comment instead of two and also check some of the comment, carrousel on the home page is
+
+216
+00:15:15,000 --> 00:15:16,000
+changed.
+
+217
+00:15:17,000 --> 00:15:19,000
+Now I can use Rebase and my strategy.
+
+218
+00:15:20,000 --> 00:15:21,000
+That is awesome.
+
+219
+00:15:21,000 --> 00:15:25,000
+We did this together and now it is time for the rule number four.
+
+220
+00:15:26,000 --> 00:15:29,000
+Rule number four always are based on a region.
+
+221
+00:15:29,000 --> 00:15:31,000
+Must have brunch before creating a comet.
+
+222
+00:15:32,000 --> 00:15:34,000
+Now you know how to replace and M..
+
+223
+00:15:35,000 --> 00:15:41,000
+I would even say that this is a best practice to rule based on the region master as often as you can
+
+224
+00:15:41,000 --> 00:15:47,000
+to fix conflicts gradually and to test your implementation on the latest version of the code during
+
+225
+00:15:47,000 --> 00:15:50,000
+the development to not spend a lot of time.
+
+226
+00:15:50,000 --> 00:15:56,000
+When you worked one week on your task and after solving all conflicts, you realized that feature doesn't
+
+227
+00:15:56,000 --> 00:15:57,000
+work as expected.
+
+228
+00:15:57,000 --> 00:16:00,000
+OK, which is really a lot today.
+
+229
+00:16:00,000 --> 00:16:02,000
+Let's recap what we have learned today.
+
+230
+00:16:03,000 --> 00:16:04,000
+In this lesson.
+
+231
+00:16:04,000 --> 00:16:09,000
+We learned what the basis we understood the difference between merge and rebase.
+
+232
+00:16:09,000 --> 00:16:15,000
+We tried to answer the question, what is better to use it, merge or get rebates from different points
+
+233
+00:16:15,000 --> 00:16:15,000
+of view?
+
+234
+00:16:16,000 --> 00:16:19,000
+One real example, you saw how a command works.
+
+235
+00:16:19,000 --> 00:16:22,000
+You know, when you need to execute, get from base, continued command.
+
+236
+00:16:23,000 --> 00:16:27,000
+Also Villon, when we need to use force update mode.
+
+237
+00:16:27,000 --> 00:16:31,000
+And how fast was this option can help us to not override other comments.
+
+238
+00:16:32,000 --> 00:16:36,000
+And at the end of the lesson we reviewed for roles, have happy work with it.
+
+239
+00:16:36,000 --> 00:16:38,000
+We learned a lot today.
+
+240
+00:16:38,000 --> 00:16:40,000
+I'm really happy you saw this lesson.
+
+241
+00:16:41,000 --> 00:16:42,000
+Thanks a lot for your attention.
+
+242
+00:16:42,000 --> 00:16:46,000
+The students have agreed the rest of the day and see you in the next lesson.
+
diff --git a/17 - GIT/014 Git Interactive Rebase_en.srt b/17 - GIT/014 Git Interactive Rebase_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..ef394d9cfb4aecf3813b0457841a2653dcc74c9e
--- /dev/null
+++ b/17 - GIT/014 Git Interactive Rebase_en.srt
@@ -0,0 +1,540 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello, Jim.
+
+2
+00:00:06,000 --> 00:00:10,000
+In this lesson, I'm going to show you how interactive remise works.
+
+3
+00:00:10,000 --> 00:00:15,000
+Today, I will show you when and how you can use interactive free based on real examples.
+
+4
+00:00:15,000 --> 00:00:20,000
+I will show you how you can change any message from your repository history and we'll show you how to
+
+5
+00:00:20,000 --> 00:00:22,000
+combine to commit into one.
+
+6
+00:00:22,000 --> 00:00:25,000
+After this lesson, you learn how to squash it.
+
+7
+00:00:26,000 --> 00:00:30,000
+I will share with you best practices of working with give and keep good history clean.
+
+8
+00:00:31,000 --> 00:00:35,000
+Let's start and we will start from the example that we had in previous lesson.
+
+9
+00:00:35,000 --> 00:00:40,000
+Imagine that the men on the task branch, you understood that you have to do one more comment.
+
+10
+00:00:41,000 --> 00:00:43,000
+Probably you forgot to add some styles.
+
+11
+00:00:43,000 --> 00:00:50,000
+For the sake of example, let me adjust carousel to assess file nonhostile slash carousel dot to assess.
+
+12
+00:00:51,000 --> 00:00:55,000
+I will just put new ones here to not spend a lot of time on modifying this file.
+
+13
+00:00:56,000 --> 00:01:03,000
+I add these changes to the staging area get at DOT and now you need to include latest changes into your
+
+14
+00:01:03,000 --> 00:01:03,000
+branch.
+
+15
+00:01:03,000 --> 00:01:04,000
+What you can do.
+
+16
+00:01:05,000 --> 00:01:09,000
+The first option, which we have already learned, and which I want to remind you is to amend the last
+
+17
+00:01:09,000 --> 00:01:11,000
+commit like this yet come.
+
+18
+00:01:11,000 --> 00:01:15,000
+It was optional and was optional added.
+
+19
+00:01:15,000 --> 00:01:19,000
+This will allow you to change your latest commit without changing commit message.
+
+20
+00:01:19,000 --> 00:01:25,000
+But let's pretend you didn't want to amend commit for some reasons and want to create one more comment.
+
+21
+00:01:26,000 --> 00:01:30,000
+When you're dealing with comments that were merged into your branch by a colleague of yours who doesn't
+
+22
+00:01:30,000 --> 00:01:32,000
+know, get as good as you are.
+
+23
+00:01:32,000 --> 00:01:35,000
+And that's why you have Xhaka credit for this change.
+
+24
+00:01:36,000 --> 00:01:37,000
+Let me create a committee now.
+
+25
+00:01:38,000 --> 00:01:41,000
+You can meet with Option M to assess class for homecare.
+
+26
+00:01:41,000 --> 00:01:46,000
+So Slider is added, OK, and now you have to comments on your branch.
+
+27
+00:01:46,000 --> 00:01:48,000
+Let's add one more comment.
+
+28
+00:01:48,000 --> 00:01:51,000
+We need this to have at least three comments to play with on our branch.
+
+29
+00:01:52,000 --> 00:01:55,000
+That is for the sake of the demo, the same as before.
+
+30
+00:01:55,000 --> 00:02:03,000
+I will quickly adjust our two file and I will create one more snapshot nonhostile slash Carasso dot
+
+31
+00:02:03,000 --> 00:02:05,000
+to assess engine your lines here.
+
+32
+00:02:07,000 --> 00:02:13,000
+You'd commit dash a dash and one Monticello's glass for home Kurzel Slider is added.
+
+33
+00:02:16,000 --> 00:02:18,000
+OK, now we have three comments.
+
+34
+00:02:19,000 --> 00:02:23,000
+Imagine that you are not happy with Canet message and want to change it.
+
+35
+00:02:23,000 --> 00:02:25,000
+What options do you have to adjust?
+
+36
+00:02:25,000 --> 00:02:32,000
+Can it get can it was option amand but what if you don't want to change economic message for the latest
+
+37
+00:02:32,000 --> 00:02:32,000
+comment?
+
+38
+00:02:33,000 --> 00:02:37,000
+What if you want to change economic message that goes right before the last one?
+
+39
+00:02:37,000 --> 00:02:39,000
+Interactive information will help you with this.
+
+40
+00:02:40,000 --> 00:02:42,000
+What is interactive freebase?
+
+41
+00:02:42,000 --> 00:02:44,000
+Interactive Freebasing?
+
+42
+00:02:44,000 --> 00:02:49,000
+It makes it easy to clean up your comments before they get based or moved onto another branch.
+
+43
+00:02:50,000 --> 00:02:59,000
+Military base was option I had to the three I stands for interactive free base, we want to proceed
+
+44
+00:02:59,000 --> 00:03:02,000
+with interactive rebates for last's recommits.
+
+45
+00:03:02,000 --> 00:03:04,000
+That's why I wrote Hand.
+
+46
+00:03:04,000 --> 00:03:06,000
+That is a pointer to our current state.
+
+47
+00:03:06,000 --> 00:03:07,000
+Delusory.
+
+48
+00:03:08,000 --> 00:03:10,000
+That means recommits back from the current one.
+
+49
+00:03:11,000 --> 00:03:12,000
+Lets press enter now.
+
+50
+00:03:13,000 --> 00:03:13,000
+Awesome.
+
+51
+00:03:14,000 --> 00:03:19,000
+Here we see our three last Kummetz starting from the latest to the newest.
+
+52
+00:03:19,000 --> 00:03:25,000
+And I see that the change message I have to write are letter near the camp where I want to change cammed
+
+53
+00:03:25,000 --> 00:03:31,000
+message and I want to change not the last message but commit message that goes before the last one.
+
+54
+00:03:32,000 --> 00:03:38,000
+So I put our letter next to the USS Glassful home carrousel is added commit message.
+
+55
+00:03:39,000 --> 00:03:46,000
+I say file by pressing control and s and close the text editor in this window we can change comit message
+
+56
+00:03:46,000 --> 00:03:47,000
+as we wish.
+
+57
+00:03:47,000 --> 00:03:54,000
+Let's add more details to first class for scrolling Carasso on the home page is added.
+
+58
+00:03:55,000 --> 00:04:01,000
+Now, let's save this file and close the text editor here, you can see notification that we successfully
+
+59
+00:04:01,000 --> 00:04:02,000
+based and updated the branch.
+
+60
+00:04:03,000 --> 00:04:06,000
+Let's check in with history, long story.
+
+61
+00:04:07,000 --> 00:04:14,000
+And we can see that my message for this CANET and check some of this can it was changed grade after
+
+62
+00:04:14,000 --> 00:04:15,000
+we changed the message for comment.
+
+63
+00:04:15,000 --> 00:04:21,000
+We took a look at our branch history one more time and realize that it is way too many comments about
+
+64
+00:04:21,000 --> 00:04:22,000
+the same thing.
+
+65
+00:04:22,000 --> 00:04:26,000
+We have three comments right now for the one single piece of functionality.
+
+66
+00:04:27,000 --> 00:04:32,000
+We know that in case we would put this change to the remote repository, our tech might be disappointed.
+
+67
+00:04:32,000 --> 00:04:33,000
+Why?
+
+68
+00:04:33,000 --> 00:04:37,000
+Because was the one single task grade style and focus on the home page.
+
+69
+00:04:38,000 --> 00:04:40,000
+We have three committees right now.
+
+70
+00:04:40,000 --> 00:04:46,000
+Instead of having one single command, your tablet might ask you to squash comments in order to keep
+
+71
+00:04:46,000 --> 00:04:47,000
+Guitry clean.
+
+72
+00:04:47,000 --> 00:04:48,000
+What does squash mean?
+
+73
+00:04:49,000 --> 00:04:55,000
+In other words, you can combine two or more commands into the one to ensure clean good history.
+
+74
+00:04:55,000 --> 00:05:02,000
+You can mount Kummetz so they would disappear, but not the changes which were done in scope of these
+
+75
+00:05:02,000 --> 00:05:03,000
+snapshots.
+
+76
+00:05:04,000 --> 00:05:09,000
+Let's imagine the case that during the development of your task, you get multiple commands and after
+
+77
+00:05:09,000 --> 00:05:14,000
+that you realized that it would be better to have either one commit a group, commit in a different
+
+78
+00:05:14,000 --> 00:05:16,000
+manner how to do this.
+
+79
+00:05:17,000 --> 00:05:20,000
+Interactive rebase will help us also with this task.
+
+80
+00:05:20,000 --> 00:05:22,000
+Guitry base was option.
+
+81
+00:05:22,000 --> 00:05:24,000
+I had killed the three.
+
+82
+00:05:25,000 --> 00:05:26,000
+You're already familiar with this command.
+
+83
+00:05:27,000 --> 00:05:31,000
+You can specify as many comments backwards as you want instead of three.
+
+84
+00:05:31,000 --> 00:05:36,000
+I am specifying only three right now because we all remember four rules of happy work with Gaete.
+
+85
+00:05:36,000 --> 00:05:42,000
+From the previous lesson, I can modify only commands that are on my branch but not commit that already
+
+86
+00:05:42,000 --> 00:05:48,000
+exist and must have branch I press and at the same time in history, as we already saw today, was ablated
+
+87
+00:05:48,000 --> 00:05:49,000
+commit message.
+
+88
+00:05:50,000 --> 00:05:54,000
+We can see that to combine commands we can use either squash or fix up.
+
+89
+00:05:54,000 --> 00:05:56,000
+Will you squash one.
+
+90
+00:05:56,000 --> 00:05:58,000
+We want to change it message and fix up one.
+
+91
+00:05:58,000 --> 00:05:59,000
+We want to keep coming.
+
+92
+00:05:59,000 --> 00:06:01,000
+The message of the first command.
+
+93
+00:06:02,000 --> 00:06:07,000
+Most likely if you combine multiple commands, you want to reflect this in the correct message.
+
+94
+00:06:07,000 --> 00:06:11,000
+That's why more often you're going to squash rather than fix.
+
+95
+00:06:11,000 --> 00:06:15,000
+An important thing to mention here, you can squash the first commit in the list.
+
+96
+00:06:16,000 --> 00:06:23,000
+In other words, here in the first row, you should have to be able to squash all the comments I wrote
+
+97
+00:06:23,000 --> 00:06:27,000
+as letter near to commit s stands for squash.
+
+98
+00:06:28,000 --> 00:06:30,000
+And in case you forgot, you can find other shorthands here.
+
+99
+00:06:31,000 --> 00:06:38,000
+I press control and ask to save the file and close it now and ask my I to address commit message.
+
+100
+00:06:39,000 --> 00:06:42,000
+I see the command lines and commit messages of my other comments.
+
+101
+00:06:43,000 --> 00:06:47,000
+Let me clean this up a bit and leave the one message which I'd like to keep.
+
+102
+00:06:47,000 --> 00:06:51,000
+In addition to this one I want to add a few words is styled.
+
+103
+00:06:52,000 --> 00:06:54,000
+I save the file and close it.
+
+104
+00:06:54,000 --> 00:06:56,000
+I see a message that I successfully replaced.
+
+105
+00:06:57,000 --> 00:06:59,000
+What else potentially might happen here?
+
+106
+00:06:59,000 --> 00:07:06,000
+Potentially you can see a message about much conflict during are basin similar to the one you saw in
+
+107
+00:07:06,000 --> 00:07:07,000
+previous lesson.
+
+108
+00:07:07,000 --> 00:07:13,000
+Take into account you combine comments that might be merged conflicts, but you don't really know how
+
+109
+00:07:13,000 --> 00:07:15,000
+to deal with conflicts during the invasion.
+
+110
+00:07:15,000 --> 00:07:20,000
+Since we showed this in the previous lesson, let's check our command history now.
+
+111
+00:07:20,000 --> 00:07:22,000
+Get log dash three.
+
+112
+00:07:23,000 --> 00:07:27,000
+Great, you can see our comment was updated message and pay attention.
+
+113
+00:07:27,000 --> 00:07:34,000
+You took some if checksum is different, your you know, that pushed the remote repository will be rejected.
+
+114
+00:07:34,000 --> 00:07:39,000
+Beside our audit committee here, you can see all the comments from the remote master branch.
+
+115
+00:07:39,000 --> 00:07:45,000
+And we can see here our chametz, where we adjusted Susanne's file because they're mounted.
+
+116
+00:07:45,000 --> 00:07:47,000
+But the changes are in place.
+
+117
+00:07:47,000 --> 00:07:55,000
+We can open our chasez file just to check this Nuna styles, Desh, Castle, Dot to assess and find
+
+118
+00:07:55,000 --> 00:07:56,000
+that newlines.
+
+119
+00:07:56,000 --> 00:08:00,000
+Edit editing first commit and new line so that you're in the second place.
+
+120
+00:08:00,000 --> 00:08:04,000
+We can count number of new lines, but I believe it is even visually obvious.
+
+121
+00:08:05,000 --> 00:08:10,000
+We did all we wanted and you already know that in case there is a difference between comment history
+
+122
+00:08:10,000 --> 00:08:16,000
+and my local branch and remote branch, we need to for update our remote repository and unpressed lesson
+
+123
+00:08:16,000 --> 00:08:18,000
+learned best practices.
+
+124
+00:08:18,000 --> 00:08:23,000
+And we are going to use force with at least now used brute force with less.
+
+125
+00:08:23,000 --> 00:08:28,000
+We added additional changes and combine them in one snapshot and updated our budget request.
+
+126
+00:08:29,000 --> 00:08:33,000
+This will make you happy on your future project, I promise you.
+
+127
+00:08:33,000 --> 00:08:36,000
+Now let's recap what we have learned today.
+
+128
+00:08:36,000 --> 00:08:39,000
+In this lesson we learned what interactive rebase is.
+
+129
+00:08:39,000 --> 00:08:42,000
+You learn how to start interactive replays.
+
+130
+00:08:42,000 --> 00:08:48,000
+You saw how you can change any commitments that in your repository after this lesson, you also know
+
+131
+00:08:48,000 --> 00:08:50,000
+how to combine few comments together.
+
+132
+00:08:51,000 --> 00:08:54,000
+We learned best practices of working with Gaede today.
+
+133
+00:08:55,000 --> 00:08:56,000
+That's all for now.
+
+134
+00:08:56,000 --> 00:08:58,000
+Thanks a lot for your attention.
+
+135
+00:08:58,000 --> 00:08:59,000
+See you in the next lesson.
+
diff --git a/17 - GIT/015 Git reset_en.srt b/17 - GIT/015 Git reset_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..d40cd31b554814f4fa785d1df9ea2398e9e3573f
--- /dev/null
+++ b/17 - GIT/015 Git reset_en.srt
@@ -0,0 +1,656 @@
+1
+00:00:06,000 --> 00:00:10,000
+Hello, dear students, in this lesson, we are going to learn in detail what is Guter said command
+
+2
+00:00:10,000 --> 00:00:12,000
+and how we can use it.
+
+3
+00:00:12,000 --> 00:00:17,000
+We'll start from the problem statement and when we might want to use it afterwards.
+
+4
+00:00:17,000 --> 00:00:21,000
+We'll learn in theory how it works to understand how users networks will.
+
+5
+00:00:21,000 --> 00:00:29,000
+Compared with Check-Out Command, we'll use three different modes how to reset my work served mixed
+
+6
+00:00:29,000 --> 00:00:29,000
+and hard.
+
+7
+00:00:30,000 --> 00:00:31,000
+Besides a series overview.
+
+8
+00:00:31,000 --> 00:00:32,000
+One real example.
+
+9
+00:00:32,000 --> 00:00:36,000
+I'm going to show you how you might use this command in your repository.
+
+10
+00:00:36,000 --> 00:00:37,000
+Let's start.
+
+11
+00:00:38,000 --> 00:00:41,000
+So why do you need to use get reset command, get reset.
+
+12
+00:00:41,000 --> 00:00:45,000
+Command is a really powerful tool that will help you to undo changes.
+
+13
+00:00:46,000 --> 00:00:52,000
+It might happen that you created snapshots that you don't need anymore, or probably for some reasons
+
+14
+00:00:52,000 --> 00:00:57,000
+you want to remove commands from your local branch, but you don't want to remove changes from your
+
+15
+00:00:57,000 --> 00:01:00,000
+working directory for such cases.
+
+16
+00:01:00,000 --> 00:01:00,000
+Get reset.
+
+17
+00:01:00,000 --> 00:01:02,000
+Command might be used.
+
+18
+00:01:03,000 --> 00:01:05,000
+You can find tutorials on the Internet.
+
+19
+00:01:05,000 --> 00:01:10,000
+But in my opinion, they're really hard to understand for the people who have never had experience with
+
+20
+00:01:10,000 --> 00:01:10,000
+it.
+
+21
+00:01:11,000 --> 00:01:16,000
+That's why in this lesson, I will try to explain this topic from the practical point of view to help
+
+22
+00:01:16,000 --> 00:01:20,000
+you understand the topic better to understand how to reset command work.
+
+23
+00:01:20,000 --> 00:01:22,000
+Let's compare it with Check-Out Command.
+
+24
+00:01:23,000 --> 00:01:29,000
+Here's our Master Branch and here's our head pointer that points to the latest snapshot on this branch.
+
+25
+00:01:29,000 --> 00:01:35,000
+So what happened when we call you checkout command, when we try to switch to another commit?
+
+26
+00:01:36,000 --> 00:01:41,000
+We can execute Gitche called command with the region, checksum where we want to switch our head pointer
+
+27
+00:01:42,000 --> 00:01:48,000
+in this particular scenario, if checksum is me, then I can move head pointer by executing command
+
+28
+00:01:48,000 --> 00:01:53,000
+Check-Out B But the master branch is still pointing out to the latest command here.
+
+29
+00:01:54,000 --> 00:01:59,000
+If you remember, during one of our lessons we discussed Detached Heads State.
+
+30
+00:01:59,000 --> 00:02:02,000
+This is exactly the scenario of detached head.
+
+31
+00:02:02,000 --> 00:02:06,000
+So what does research come and do that is different from Chicot?
+
+32
+00:02:06,000 --> 00:02:07,000
+Come on.
+
+33
+00:02:08,000 --> 00:02:10,000
+In the case I will use gets reset command.
+
+34
+00:02:10,000 --> 00:02:16,000
+We check some of the specific revision that will move both head pointer and current branch pointer to
+
+35
+00:02:16,000 --> 00:02:17,000
+the specific revision.
+
+36
+00:02:18,000 --> 00:02:19,000
+That's what it always does.
+
+37
+00:02:19,000 --> 00:02:22,000
+No matter what option will be used with reset command.
+
+38
+00:02:23,000 --> 00:02:25,000
+Can you see the difference on this visualization?
+
+39
+00:02:26,000 --> 00:02:29,000
+Hope it is clear now what reset command does.
+
+40
+00:02:29,000 --> 00:02:36,000
+But besides updating of command pointers like head pointer and branch pointer, reset command will also
+
+41
+00:02:36,000 --> 00:02:40,000
+update the state of our staging area and update the state of our country.
+
+42
+00:02:40,000 --> 00:02:42,000
+That is our files in our file system.
+
+43
+00:02:43,000 --> 00:02:48,000
+Updates in the staging area and our country will be different depending on what mode of reset we are
+
+44
+00:02:48,000 --> 00:02:51,000
+going to use as a result from agenda.
+
+45
+00:02:51,000 --> 00:02:55,000
+There are three possible modes soft, mixed and hard.
+
+46
+00:02:56,000 --> 00:03:00,000
+Let's learn right now what will happen in case we reset in soft mode.
+
+47
+00:03:00,000 --> 00:03:06,000
+If we use get reset with soft option, we still move ahead and branch pointers to the specific region
+
+48
+00:03:06,000 --> 00:03:07,000
+and that's it.
+
+49
+00:03:07,000 --> 00:03:13,000
+Nice and above that changes from your working tree will be there and in the staging area.
+
+50
+00:03:14,000 --> 00:03:20,000
+In simple words, the changes that you did in files before reset and commit these changes, you will
+
+51
+00:03:20,000 --> 00:03:22,000
+be present in files of your project.
+
+52
+00:03:22,000 --> 00:03:28,000
+Moreover, these changes will be in the staging area in case after asset in soft mode.
+
+53
+00:03:28,000 --> 00:03:30,000
+You would call your status command.
+
+54
+00:03:30,000 --> 00:03:34,000
+You would find all your changes added to the staging area in green color.
+
+55
+00:03:35,000 --> 00:03:40,000
+Execution of command is going to lead you directly to the state where you were before 7:00.
+
+56
+00:03:41,000 --> 00:03:46,000
+Here on this slide, you can see that soft mode keeps all changes in the staging area.
+
+57
+00:03:46,000 --> 00:03:50,000
+In case you are going to use mixed option, it is similar to softwoods.
+
+58
+00:03:50,000 --> 00:03:57,000
+Only one difference changes still will be present in the working directory, but they won't be present
+
+59
+00:03:57,000 --> 00:03:58,000
+in the staging area.
+
+60
+00:03:58,000 --> 00:04:04,000
+In simple words, you still will be able to find the changes in files, but when you will call git status,
+
+61
+00:04:05,000 --> 00:04:08,000
+you're going to see that all changes are not added to the staging area.
+
+62
+00:04:09,000 --> 00:04:15,000
+You would need to perform it add and after that you commit command in case you want to restore the state
+
+63
+00:04:15,000 --> 00:04:20,000
+before setting the previous two options you might want to use when you kind of okay with changes that
+
+64
+00:04:20,000 --> 00:04:21,000
+you have done.
+
+65
+00:04:21,000 --> 00:04:24,000
+But you have to do some modifications in the good history.
+
+66
+00:04:24,000 --> 00:04:26,000
+The first option for that is really hard.
+
+67
+00:04:27,000 --> 00:04:32,000
+This is the most direct and dangerous option that is frequently used after executing this reset.
+
+68
+00:04:32,000 --> 00:04:34,000
+Command was a hard option.
+
+69
+00:04:34,000 --> 00:04:41,000
+Get will make sure that your staging area and are working very much that of the specific commit in simple
+
+70
+00:04:41,000 --> 00:04:48,000
+words, your file system will be the same as it was after which you specified in reset command when
+
+71
+00:04:48,000 --> 00:04:49,000
+this mode is needed.
+
+72
+00:04:49,000 --> 00:04:55,000
+Personally, I used this command a lot when I realized that I messed up completely the state of my files
+
+73
+00:04:55,000 --> 00:04:59,000
+and I want to get everything back as it was when it worked, at least somehow.
+
+74
+00:05:00,000 --> 00:05:03,000
+Sometimes you might want to reset the state of some specific revision.
+
+75
+00:05:04,000 --> 00:05:09,000
+Probably you want to reset state of your local repository to the state that you have in the remote repository.
+
+76
+00:05:09,000 --> 00:05:12,000
+You might want to do so in case something went wrong.
+
+77
+00:05:12,000 --> 00:05:15,000
+During The Amazing today you're in the demo.
+
+78
+00:05:15,000 --> 00:05:18,000
+I will show you how to reset your changes in different modes.
+
+79
+00:05:19,000 --> 00:05:24,000
+Now, when you understood the theory, let's practice a bit and I'll show you how you can use gets reset
+
+80
+00:05:24,000 --> 00:05:25,000
+command in different modes.
+
+81
+00:05:26,000 --> 00:05:27,000
+We are on the Master Branch.
+
+82
+00:05:27,000 --> 00:05:32,000
+Let's check our gate history gate log dash three.
+
+83
+00:05:32,000 --> 00:05:35,000
+Here is a command that we did during this course.
+
+84
+00:05:35,000 --> 00:05:39,000
+You remember we added stock management service and created separate snapshots for that.
+
+85
+00:05:40,000 --> 00:05:44,000
+Afterwards we credit card management service file and created separate snapshots for that.
+
+86
+00:05:45,000 --> 00:05:53,000
+And after that I did create HTML file homeport HTML for our lessons to understand much conflict topic.
+
+87
+00:05:53,000 --> 00:05:54,000
+Remember that.
+
+88
+00:05:54,000 --> 00:06:00,000
+Let me show you, for example, that after soft reset to the state of the Stock Management Command Card
+
+89
+00:06:00,000 --> 00:06:06,000
+Management Service and home e-mail are still present in the country, but the state of the branch and
+
+90
+00:06:06,000 --> 00:06:07,000
+head pointer is different.
+
+91
+00:06:08,000 --> 00:06:17,000
+Guter said was option soft e 71, A five, b, I entered first characters of this commit and press enter.
+
+92
+00:06:17,000 --> 00:06:21,000
+Let's check our comment history to understand where we are now.
+
+93
+00:06:21,000 --> 00:06:22,000
+Get lost there.
+
+94
+00:06:22,000 --> 00:06:28,000
+Three You see here in parenthesis that our head and master pointers are on this comment.
+
+95
+00:06:29,000 --> 00:06:36,000
+Let me check its status and its status and you can see the two files from the documents are present
+
+96
+00:06:36,000 --> 00:06:42,000
+in my file system and automatically added to the staging area to return my project to the state where
+
+97
+00:06:42,000 --> 00:06:43,000
+it was before the reset.
+
+98
+00:06:43,000 --> 00:06:50,000
+But with a new command, I have to come them one more time, get command with option and court management
+
+99
+00:06:50,000 --> 00:06:51,000
+and home HMO.
+
+100
+00:06:52,000 --> 00:06:55,000
+And we created new command with these changes.
+
+101
+00:06:55,000 --> 00:07:02,000
+Now I want to demo to you makes the more me find commands that we recently used and just change it a
+
+102
+00:07:02,000 --> 00:07:02,000
+bit.
+
+103
+00:07:03,000 --> 00:07:03,000
+Here it is.
+
+104
+00:07:04,000 --> 00:07:07,000
+Let me removed soft here, by the way.
+
+105
+00:07:07,000 --> 00:07:08,000
+Mixed mode is a default.
+
+106
+00:07:09,000 --> 00:07:12,000
+That means you shouldn't necessarily write me here.
+
+107
+00:07:13,000 --> 00:07:15,000
+You can just remove any options here.
+
+108
+00:07:15,000 --> 00:07:18,000
+That would mean resetting in the default mixed mode.
+
+109
+00:07:18,000 --> 00:07:22,000
+Let me check it lock now it log Destry.
+
+110
+00:07:22,000 --> 00:07:28,000
+I'm on the committee where I wanted to be and like check status now get status.
+
+111
+00:07:28,000 --> 00:07:33,000
+And you can see that files are present in my work entry in my file system, but they are not in the
+
+112
+00:07:33,000 --> 00:07:34,000
+staging area.
+
+113
+00:07:35,000 --> 00:07:38,000
+Can you understand the difference between soft and mixed mode now?
+
+114
+00:07:39,000 --> 00:07:44,000
+The return the previous state I should execute get at DOD command and after that it changes.
+
+115
+00:07:45,000 --> 00:07:48,000
+Let's use the same messages previously for the sake of the demo.
+
+116
+00:07:49,000 --> 00:07:56,000
+Awesome, and let me show you the last but not the least option, hard lessons said enhancement to this
+
+117
+00:07:56,000 --> 00:07:59,000
+commit spaces are added to the hello world.
+
+118
+00:07:59,000 --> 00:08:06,000
+While we should see how the state of our file system will be different from that e-mail, card management
+
+119
+00:08:06,000 --> 00:08:09,000
+servers and stock management service files would disappear.
+
+120
+00:08:10,000 --> 00:08:14,000
+Let's reset resorption heart two six seven two six F..
+
+121
+00:08:15,000 --> 00:08:16,000
+Let's check in with history now.
+
+122
+00:08:17,000 --> 00:08:18,000
+Get logged three.
+
+123
+00:08:19,000 --> 00:08:25,000
+OK, our head pointer and branch are pointing to the committee that we expect, but what is with our
+
+124
+00:08:25,000 --> 00:08:26,000
+filesystem now?
+
+125
+00:08:27,000 --> 00:08:34,000
+It's status and we can see that there is nothing to commit, and that is my voluntary claim, I'm in
+
+126
+00:08:34,000 --> 00:08:36,000
+the Israeli folder right now.
+
+127
+00:08:36,000 --> 00:08:44,000
+Let me check the state of the file system unless there shall we can see that I have only discount completion
+
+128
+00:08:44,000 --> 00:08:45,000
+service and hello, world file.
+
+129
+00:08:45,000 --> 00:08:50,000
+I do not have Nasacort nor stock folders where my other files were stored.
+
+130
+00:08:51,000 --> 00:08:54,000
+Now you can see how it was that was hard option, Kenora said.
+
+131
+00:08:54,000 --> 00:08:56,000
+The state of the file system.
+
+132
+00:08:56,000 --> 00:08:59,000
+One more trick, probably in some lessons.
+
+133
+00:08:59,000 --> 00:09:05,000
+You saw that I researched state of the branch without reference to the specific checks, but using relative
+
+134
+00:09:05,000 --> 00:09:07,000
+navigation from the head pointer.
+
+135
+00:09:07,000 --> 00:09:09,000
+Let me show you one more time.
+
+136
+00:09:10,000 --> 00:09:14,000
+Get reset with option heart had to the three.
+
+137
+00:09:14,000 --> 00:09:20,000
+You can see how I can move that Anabranch pointer to three cm is back from the point where I was.
+
+138
+00:09:20,000 --> 00:09:21,000
+This is pretty convenient.
+
+139
+00:09:21,000 --> 00:09:25,000
+As for me, probably you would also use this variation of reset command.
+
+140
+00:09:26,000 --> 00:09:33,000
+And one more real life scenario, imagine that you wanted either to squash commits or a message or something
+
+141
+00:09:33,000 --> 00:09:36,000
+else went wrong during the invasion or during the development.
+
+142
+00:09:36,000 --> 00:09:41,000
+And you want to reset the state of your working tree, your file system, as it is in a remote repository
+
+143
+00:09:41,000 --> 00:09:42,000
+right now.
+
+144
+00:09:43,000 --> 00:09:49,000
+What I recommend you to do, the first thing that I always do is execution of each command with option
+
+145
+00:09:49,000 --> 00:09:52,000
+like this need fetch resorption.
+
+146
+00:09:52,000 --> 00:09:59,000
+All this is just to make sure that you fetch the latest state of the remote repository after that reset
+
+147
+00:09:59,000 --> 00:10:02,000
+with the hard option to the State of Origin branch.
+
+148
+00:10:03,000 --> 00:10:09,000
+In this particular case, we played with our master branch and I want to restore the state of our region.
+
+149
+00:10:09,000 --> 00:10:14,000
+Must have branch reset with option, heart or region slash master.
+
+150
+00:10:14,000 --> 00:10:17,000
+And you can see that I'm on the latest commit right now.
+
+151
+00:10:18,000 --> 00:10:20,000
+So there you saw that in reset command.
+
+152
+00:10:20,000 --> 00:10:26,000
+You can use chametz checksum, relative amount of comments from the head pointer and even specific branch,
+
+153
+00:10:27,000 --> 00:10:27,000
+I believe.
+
+154
+00:10:27,000 --> 00:10:31,000
+Now you know about reset command even more than some senior software engineers.
+
+155
+00:10:32,000 --> 00:10:33,000
+Hope you enjoyed the lesson.
+
+156
+00:10:34,000 --> 00:10:36,000
+Let's recap what we have learned today.
+
+157
+00:10:37,000 --> 00:10:40,000
+Today, we learned what is a good reset command and when we can use it.
+
+158
+00:10:41,000 --> 00:10:44,000
+We understand the difference between reaching out and gives reset command.
+
+159
+00:10:45,000 --> 00:10:51,000
+You learn three modes of reset command, soft, mixed and hard on the real example.
+
+160
+00:10:51,000 --> 00:10:55,000
+You saw how to reset state of the branch if you coming back from the head pointer or to the specific
+
+161
+00:10:55,000 --> 00:10:56,000
+command.
+
+162
+00:10:56,000 --> 00:11:01,000
+Also, you learned how to reset state of the branch to the state of the branch in the remote repository.
+
+163
+00:11:02,000 --> 00:11:05,000
+That's all what I planned to talk about in this lesson with you.
+
+164
+00:11:05,000 --> 00:11:08,000
+Thanks a lot for your attention and see you in the next lesson.
+
diff --git a/17 - GIT/016 Git stash_en.srt b/17 - GIT/016 Git stash_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..5e46f9a6bbc35a630ffd6b5949ce0feda784a550
--- /dev/null
+++ b/17 - GIT/016 Git stash_en.srt
@@ -0,0 +1,728 @@
+1
+00:00:06,000 --> 00:00:09,000
+Hello there, students in this class and we are going to lunch with you get Stasch command.
+
+2
+00:00:09,000 --> 00:00:12,000
+I'm going to tell you when you might need to use it.
+
+3
+00:00:12,000 --> 00:00:16,000
+You'll understand how to reapply changes from your stash on real examples.
+
+4
+00:00:16,000 --> 00:00:21,000
+I will show you how to manage multiple stashes and even how to create a branch from your stash.
+
+5
+00:00:21,000 --> 00:00:25,000
+And also, we are going to run different commands that will allow you to clean your stash and to perform
+
+6
+00:00:25,000 --> 00:00:27,000
+as operations with it.
+
+7
+00:00:27,000 --> 00:00:33,000
+Let's start first of all, let's understand potential problems at stash command may help us to resolve.
+
+8
+00:00:33,000 --> 00:00:39,000
+Imagine that you are sitting at your computer and work on some task and all of a sudden you receive
+
+9
+00:00:39,000 --> 00:00:40,000
+a call from your manager.
+
+10
+00:00:40,000 --> 00:00:46,000
+Your manager screams that you urgently need to fix some other thing or you have to start work on the
+
+11
+00:00:46,000 --> 00:00:47,000
+other task immediately.
+
+12
+00:00:47,000 --> 00:00:49,000
+But it didn't finish your current task.
+
+13
+00:00:49,000 --> 00:00:53,000
+Your manager told you that you have to give up everything and start work on the new task.
+
+14
+00:00:54,000 --> 00:00:59,000
+The state of a file system doesn't allow you to create a committee right now, probably because you
+
+15
+00:00:59,000 --> 00:01:04,000
+even can't build your project successfully or you are just in the middle of something important to finish.
+
+16
+00:01:04,000 --> 00:01:09,000
+And it looks like that you have to put all your changes aside to get back to them later.
+
+17
+00:01:10,000 --> 00:01:15,000
+Hope that you understood the problem and real life case that might happen with you almost on a daily
+
+18
+00:01:15,000 --> 00:01:15,000
+basis.
+
+19
+00:01:16,000 --> 00:01:23,000
+But how to address this issue with the help of the Get Eustache Command will help us with this station.
+
+20
+00:01:23,000 --> 00:01:30,000
+Take the state of a working directory that is humidified direct files, stage changes and saves it on
+
+21
+00:01:30,000 --> 00:01:35,000
+a stack of unfinished changes that you can apply at any time, even on different branch.
+
+22
+00:01:36,000 --> 00:01:37,000
+What a staircase.
+
+23
+00:01:37,000 --> 00:01:38,000
+I will explain a bit later.
+
+24
+00:01:39,000 --> 00:01:39,000
+Nonwork.
+
+25
+00:01:40,000 --> 00:01:45,000
+I believe that the best way to understand how Eustache Command works is to show it to you in it.
+
+26
+00:01:45,000 --> 00:01:49,000
+But I am a master branch right now and my work in tree is clean.
+
+27
+00:01:49,000 --> 00:01:53,000
+Let's imagine I'm in the process of implementation of some important task.
+
+28
+00:01:53,000 --> 00:02:00,000
+I create a new branch and get to reach resorption c a three zero six important task.
+
+29
+00:02:00,000 --> 00:02:08,000
+OK, and being on this branch in SASE folder, I modified home HTML file to not switch the windows between
+
+30
+00:02:08,000 --> 00:02:09,000
+different code editors.
+
+31
+00:02:09,000 --> 00:02:15,000
+Let me do small changes right here in the terminal using nano text editor nano web content slash home
+
+32
+00:02:15,000 --> 00:02:17,000
+dot html.
+
+33
+00:02:17,000 --> 00:02:19,000
+I added some important changes here.
+
+34
+00:02:20,000 --> 00:02:24,000
+Be some important line tag is closed.
+
+35
+00:02:24,000 --> 00:02:31,000
+After I did all my changes, I saved a file and now I received a message from my manager who is in panic
+
+36
+00:02:31,000 --> 00:02:34,000
+and asks me to start work on the super important task.
+
+37
+00:02:35,000 --> 00:02:39,000
+I don't need changes from home HTML file that we have just created.
+
+38
+00:02:39,000 --> 00:02:41,000
+Deunan another task implementation.
+
+39
+00:02:42,000 --> 00:02:50,000
+Let me check the status of my branch, get status and you can see I have one file modified and currently
+
+40
+00:02:50,000 --> 00:02:53,000
+it is in the state one creating snapshot with it doesn't make a lot of sense.
+
+41
+00:02:54,000 --> 00:02:56,000
+So I will put a temporary in my stash.
+
+42
+00:02:57,000 --> 00:02:59,000
+How simply by executing the next command.
+
+43
+00:03:00,000 --> 00:03:02,000
+Eustache Great.
+
+44
+00:03:02,000 --> 00:03:04,000
+Now our changes are in Stasch.
+
+45
+00:03:04,000 --> 00:03:09,000
+Let's check status one more time and you can see that right now it is nothing to commit.
+
+46
+00:03:10,000 --> 00:03:13,000
+But now I can be sure that my changes won't disappear.
+
+47
+00:03:14,000 --> 00:03:18,000
+I'm returning to the Master Branch to create the new branch uSwitch Dash.
+
+48
+00:03:19,000 --> 00:03:25,000
+Here I create a new branch, uSwitch, which resorption CGA three 07.
+
+49
+00:03:25,000 --> 00:03:26,000
+Super important task.
+
+50
+00:03:27,000 --> 00:03:31,000
+OK, and now I can continue work on my new important task.
+
+51
+00:03:31,000 --> 00:03:34,000
+My changes that are currently in Stasch are not present on this branch.
+
+52
+00:03:34,000 --> 00:03:35,000
+Let me show you this.
+
+53
+00:03:36,000 --> 00:03:39,000
+None of Condon's home, not HTML.
+
+54
+00:03:39,000 --> 00:03:48,000
+And we can find our important line here cuz now let's imagine that you realize that you need those changes
+
+55
+00:03:48,000 --> 00:03:49,000
+here and you need them back.
+
+56
+00:03:50,000 --> 00:03:52,000
+How get your changes back from Stasch.
+
+57
+00:03:52,000 --> 00:03:56,000
+You need to apply changes from your stash to do this.
+
+58
+00:03:56,000 --> 00:03:57,000
+Let's use the next command.
+
+59
+00:03:57,000 --> 00:03:59,000
+Eustache apply.
+
+60
+00:03:59,000 --> 00:04:06,000
+And instantly you see the status of the branch and indications and home e-mail file is modified, let
+
+61
+00:04:06,000 --> 00:04:07,000
+me open it to double check.
+
+62
+00:04:08,000 --> 00:04:11,000
+Yes, I see my important line here.
+
+63
+00:04:11,000 --> 00:04:12,000
+Awesome.
+
+64
+00:04:13,000 --> 00:04:18,000
+Now, important information about Stasch, this command, great stack of changes.
+
+65
+00:04:18,000 --> 00:04:21,000
+They understand how a stack of changes may look like.
+
+66
+00:04:21,000 --> 00:04:22,000
+Let me show you quickly.
+
+67
+00:04:23,000 --> 00:04:30,000
+In computer science, tech is an abstract data type that serves as a collection of elements, it works
+
+68
+00:04:30,000 --> 00:04:31,000
+according to leave for principle.
+
+69
+00:04:32,000 --> 00:04:35,000
+One more fancy word what does leave or stand for?
+
+70
+00:04:36,000 --> 00:04:39,000
+Leifur is an acronym from Last In, First Out.
+
+71
+00:04:40,000 --> 00:04:45,000
+This is a method of storing data in data structures, according to which the last element get into the
+
+72
+00:04:45,000 --> 00:04:48,000
+container, leaves the containers the first.
+
+73
+00:04:48,000 --> 00:04:51,000
+And on the screen you can see visualization of Steck.
+
+74
+00:04:51,000 --> 00:04:55,000
+Imagine that each element here is a separate batch of changes.
+
+75
+00:04:56,000 --> 00:05:00,000
+When you use Stasch command, your changes are on the bottom of this container.
+
+76
+00:05:01,000 --> 00:05:06,000
+When you use against apply command, the changes from top of the stack apply to your branch.
+
+77
+00:05:07,000 --> 00:05:12,000
+And if you use git stash command multiple times, the new changes will be on top.
+
+78
+00:05:13,000 --> 00:05:14,000
+Does it make sense?
+
+79
+00:05:15,000 --> 00:05:21,000
+Now imagine that you used Stasch command multiple times and you have a lot of changes in your Stasch
+
+80
+00:05:21,000 --> 00:05:24,000
+stack, how to view all changes that you have in your stack of changes.
+
+81
+00:05:25,000 --> 00:05:27,000
+Let me show you the list.
+
+82
+00:05:27,000 --> 00:05:28,000
+All the changes that you have in your stack.
+
+83
+00:05:28,000 --> 00:05:31,000
+Use the next command git stash list.
+
+84
+00:05:32,000 --> 00:05:36,000
+And specially for this lesson, I prepared a few items to have multiple elements here.
+
+85
+00:05:37,000 --> 00:05:41,000
+You can see that our last stash has index zero and it is on the top of our stack.
+
+86
+00:05:42,000 --> 00:05:48,000
+That means you can apply it on different branches, but probably you might be wondering how to apply.
+
+87
+00:05:48,000 --> 00:05:51,000
+Are the changes from the stack for the sake of the demo?
+
+88
+00:05:51,000 --> 00:05:52,000
+Let me apply changes from this stack.
+
+89
+00:05:52,000 --> 00:05:59,000
+Was the indexed One Eustache apply and after that I will use the name of the stash that is specified
+
+90
+00:05:59,000 --> 00:06:03,000
+here, stash add and one in curly brackets.
+
+91
+00:06:04,000 --> 00:06:10,000
+Before I press and I want to warn you that you're going to see error message hypocenter.
+
+92
+00:06:10,000 --> 00:06:13,000
+And as I promised, here is the error.
+
+93
+00:06:13,000 --> 00:06:16,000
+Don't worry, everything is under control.
+
+94
+00:06:16,000 --> 00:06:21,000
+I did this on purpose to show you this error message that you may see some time get.
+
+95
+00:06:21,000 --> 00:06:26,000
+Sometimes we'll show you this message to warn you that your changes might be overwritten after some
+
+96
+00:06:26,000 --> 00:06:27,000
+specific operation.
+
+97
+00:06:27,000 --> 00:06:31,000
+And this is one more case to Eustache as a temporary storage for your changes.
+
+98
+00:06:32,000 --> 00:06:34,000
+I already have these changes in my stash.
+
+99
+00:06:34,000 --> 00:06:39,000
+So let me just come in, then get dash a dash and commit.
+
+100
+00:06:40,000 --> 00:06:45,000
+Sorry about this message, just don't want to spend time on the details that we already discussed.
+
+101
+00:06:46,000 --> 00:06:50,000
+Hope you understand that such a meaningful message is not the best practice.
+
+102
+00:06:50,000 --> 00:06:54,000
+And I use it only for the sake of the drama to not lose the focus from the Stasch.
+
+103
+00:06:54,000 --> 00:06:56,000
+Come on now.
+
+104
+00:06:56,000 --> 00:07:00,000
+When I created the snapshot, let me try to apply one more time.
+
+105
+00:07:00,000 --> 00:07:04,000
+Are the changes from the Stasch and you see that some changes were applied here.
+
+106
+00:07:05,000 --> 00:07:11,000
+Namely, Log-in says, as file was removed and changes in home each time on file were also applied.
+
+107
+00:07:12,000 --> 00:07:16,000
+There is even a conflict in this file since it was modified in different versions.
+
+108
+00:07:17,000 --> 00:07:21,000
+You just have to open this file and to resolve conflicts for the sake of the demo.
+
+109
+00:07:21,000 --> 00:07:27,000
+Let me reset the state of the current branch to its original state, yet reset resorption heart to the
+
+110
+00:07:27,000 --> 00:07:28,000
+head pointer.
+
+111
+00:07:29,000 --> 00:07:31,000
+Let's talk about another problem.
+
+112
+00:07:31,000 --> 00:07:33,000
+Do you remember what is in my stash list?
+
+113
+00:07:33,000 --> 00:07:36,000
+Let me show it one more time yet stash lists.
+
+114
+00:07:37,000 --> 00:07:42,000
+How do you think will I remember that that changes and how much time I'll file in the stash tomorrow
+
+115
+00:07:43,000 --> 00:07:44,000
+or in a month.
+
+116
+00:07:44,000 --> 00:07:48,000
+That's why it usually does a good practice to give a name to each stash.
+
+117
+00:07:49,000 --> 00:07:51,000
+Let me do some changes in the repository.
+
+118
+00:07:51,000 --> 00:07:59,000
+For example, let me remove login scissors file ram style slash logging that says there is a standard
+
+119
+00:07:59,000 --> 00:08:02,000
+command in Linux terminals to remove files.
+
+120
+00:08:03,000 --> 00:08:10,000
+Let me stash my current changes with a specific message you'd stash safe logins, he says is removed
+
+121
+00:08:11,000 --> 00:08:12,000
+and lets presenta.
+
+122
+00:08:12,000 --> 00:08:18,000
+Now, when I will see the stash in the future in my specialist, I will instantly understand what changes
+
+123
+00:08:18,000 --> 00:08:20,000
+it contains existentialists.
+
+124
+00:08:21,000 --> 00:08:25,000
+And here I can see my last stash and it is on the top of the stack.
+
+125
+00:08:25,000 --> 00:08:26,000
+Great.
+
+126
+00:08:27,000 --> 00:08:33,000
+OK, now let me explain you one more thing, probably you noticed that I applied different stashes,
+
+127
+00:08:33,000 --> 00:08:39,000
+but they're still in my stack how to apply stash and remove it from the stack for doing this.
+
+128
+00:08:39,000 --> 00:08:42,000
+You have to use Bob Camonte instead of apply like this.
+
+129
+00:08:42,000 --> 00:08:48,000
+Eustache Pop, we see that I applied my last stash and login success is removed.
+
+130
+00:08:48,000 --> 00:08:50,000
+Let me check my specialist now.
+
+131
+00:08:51,000 --> 00:08:54,000
+And now you can see that it has disappeared from here.
+
+132
+00:08:55,000 --> 00:08:56,000
+Let's move on.
+
+133
+00:08:56,000 --> 00:09:02,000
+One more thing that we didn't discuss yet is that you can stash only changes that are in the staging
+
+134
+00:09:02,000 --> 00:09:06,000
+area or changes that were done in files that are tracked by it.
+
+135
+00:09:07,000 --> 00:09:10,000
+Imagine that we created a file and after that we were interrupted.
+
+136
+00:09:11,000 --> 00:09:12,000
+We have to stash it.
+
+137
+00:09:12,000 --> 00:09:19,000
+Let me quickly create a file here, touch some important file dot java right now.
+
+138
+00:09:19,000 --> 00:09:21,000
+This file isn't tracked by yet.
+
+139
+00:09:21,000 --> 00:09:22,000
+Let me show you this.
+
+140
+00:09:23,000 --> 00:09:23,000
+It's status.
+
+141
+00:09:24,000 --> 00:09:29,000
+And in case I would try to suggest changes on the removal of Logan's SS will be stored.
+
+142
+00:09:30,000 --> 00:09:32,000
+Let me prove you this, Eustache.
+
+143
+00:09:33,000 --> 00:09:40,000
+And now let's check your status one more time and see that my new file is still in Ontrack State and
+
+144
+00:09:40,000 --> 00:09:43,000
+is not in the Stasch, how to add it to the stash?
+
+145
+00:09:44,000 --> 00:09:46,000
+We have to use a special option for that.
+
+146
+00:09:46,000 --> 00:09:49,000
+Let me show you need Stasch with option U.
+
+147
+00:09:50,000 --> 00:09:52,000
+U stands for untracked files.
+
+148
+00:09:52,000 --> 00:09:54,000
+Instead of you, you can use a option.
+
+149
+00:09:55,000 --> 00:09:58,000
+A stands for all besides untracked files.
+
+150
+00:09:58,000 --> 00:10:02,000
+It would also stash files that are ignored according to our Getting Your File.
+
+151
+00:10:03,000 --> 00:10:07,000
+But I doubt that you would ever want it to include ignored files to your stash.
+
+152
+00:10:07,000 --> 00:10:08,000
+That's why.
+
+153
+00:10:08,000 --> 00:10:12,000
+Let's use you option here, Hypocenter.
+
+154
+00:10:13,000 --> 00:10:16,000
+Let me check your status now, your status.
+
+155
+00:10:17,000 --> 00:10:17,000
+Awesome.
+
+156
+00:10:18,000 --> 00:10:24,000
+Finally, it looks like our new file was stashed, and now imagine that you want to create a branch
+
+157
+00:10:24,000 --> 00:10:25,000
+from your stash.
+
+158
+00:10:25,000 --> 00:10:31,000
+Imagine that when you finished work on the super important task, you already removed all old branches
+
+159
+00:10:31,000 --> 00:10:32,000
+and you have to create a new one.
+
+160
+00:10:33,000 --> 00:10:41,000
+How to create a new branch from Stash use the next command, Eustache Branch, a three zero seven new.
+
+161
+00:10:42,000 --> 00:10:46,000
+You can specify here any Stasha you would like without specifying Stasha.
+
+162
+00:10:47,000 --> 00:10:53,000
+The first stash from the stack will be used and you see that I have new untracked file on my new branch
+
+163
+00:10:54,000 --> 00:10:56,000
+that also moved me to the new branch.
+
+164
+00:10:57,000 --> 00:11:03,000
+You can see it here in parentheses and what to do in case you don't want to apply your stash, but you
+
+165
+00:11:03,000 --> 00:11:08,000
+just want to remove it, use the next command, get stash, drop.
+
+166
+00:11:08,000 --> 00:11:10,000
+You can specify any stash.
+
+167
+00:11:10,000 --> 00:11:14,000
+I here, for example, stash at zero.
+
+168
+00:11:14,000 --> 00:11:18,000
+Now let's check stash list, new stash list.
+
+169
+00:11:18,000 --> 00:11:22,000
+And you see that our first stash in stack was removed by us.
+
+170
+00:11:25,000 --> 00:11:31,000
+In case you want to clear all stack of stashes, use the next command, get Stasch clear.
+
+171
+00:11:32,000 --> 00:11:38,000
+And in case we would check our specialists, now we are going to see nothing and here is empty list,
+
+172
+00:11:38,000 --> 00:11:39,000
+nothing is here.
+
+173
+00:11:40,000 --> 00:11:44,000
+Great, it looks like that is all what I plan to share with you in this lesson.
+
+174
+00:11:44,000 --> 00:11:46,000
+Let's recap what we have learned today.
+
+175
+00:11:47,000 --> 00:11:50,000
+So today we learned what the stashes now we know how to use stash.
+
+176
+00:11:50,000 --> 00:11:52,000
+Come on, on real examples.
+
+177
+00:11:52,000 --> 00:11:54,000
+We learned how to manage multiple stashes.
+
+178
+00:11:55,000 --> 00:11:59,000
+We learned how to stash direct files and how to clear your stash if needed.
+
+179
+00:11:59,000 --> 00:12:04,000
+We also learned what is the difference between stash supply and stash pop.
+
+180
+00:12:04,000 --> 00:12:05,000
+That's all for now.
+
+181
+00:12:06,000 --> 00:12:07,000
+Thanks a lot for your attention.
+
+182
+00:12:07,000 --> 00:12:09,000
+See you in the next lesson.
+
diff --git a/17 - GIT/017 Restoring lost snapshots in Git git reflog_en.srt b/17 - GIT/017 Restoring lost snapshots in Git git reflog_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..f889bcbd14fdc8c2c148171d0c0864d7595a64a9
--- /dev/null
+++ b/17 - GIT/017 Restoring lost snapshots in Git git reflog_en.srt
@@ -0,0 +1,412 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello, Jim.
+
+2
+00:00:06,000 --> 00:00:11,000
+Today, we're going to have super interesting topic and this last one, I'll show you how you can restore
+
+3
+00:00:11,000 --> 00:00:12,000
+literally everything.
+
+4
+00:00:12,000 --> 00:00:18,000
+What was ever present in any snapshot in it, even if it was overwritten, is by force push or hard
+
+5
+00:00:18,000 --> 00:00:19,000
+reset.
+
+6
+00:00:19,000 --> 00:00:22,000
+But I will run such command as gets where flock.
+
+7
+00:00:22,000 --> 00:00:25,000
+We're going to understand when and why we have to use.
+
+8
+00:00:25,000 --> 00:00:30,000
+It will imitate cases when we lost some changes and we need to restore them.
+
+9
+00:00:30,000 --> 00:00:35,000
+After this lesson, you will be able to use reflood command with different options and variations.
+
+10
+00:00:35,000 --> 00:00:42,000
+Like a pro, you are going to learn how to restore lost command in the new branch or reset current branch
+
+11
+00:00:42,000 --> 00:00:43,000
+to the committees that were lost.
+
+12
+00:00:44,000 --> 00:00:49,000
+Let's understand first, why do we need to use lock and what problem it may help us to solve?
+
+13
+00:00:50,000 --> 00:00:55,000
+It may happen that at some point during your journey you may accidentally lose a command.
+
+14
+00:00:55,000 --> 00:01:00,000
+Like I told you before, it may happen during the force delete of your work or during the hard reset
+
+15
+00:01:01,000 --> 00:01:06,000
+or you use interactive rebate's to squash commands and the resolving of conflicts during the invasion
+
+16
+00:01:06,000 --> 00:01:08,000
+went wrong and some changes were lost.
+
+17
+00:01:08,000 --> 00:01:16,000
+So how to get those changes back in if something were ever committed, might be restored, yet won't
+
+18
+00:01:16,000 --> 00:01:21,000
+be able to restore files that were never in the staging area and were never committed before.
+
+19
+00:01:22,000 --> 00:01:26,000
+I suggest that a lot of the kids were locked directly from the practical exercise.
+
+20
+00:01:27,000 --> 00:01:30,000
+Let's start to show you how to restore changes.
+
+21
+00:01:30,000 --> 00:01:32,000
+Let me intentionally lose some data.
+
+22
+00:01:32,000 --> 00:01:34,000
+I'm on the master branch.
+
+23
+00:01:34,000 --> 00:01:35,000
+Let me show you.
+
+24
+00:01:35,000 --> 00:01:38,000
+Let latest Kummetz gate log dash three.
+
+25
+00:01:39,000 --> 00:01:47,000
+Let me Hardell said Doulos commits yet reset hard had yielded to OK the branches reset.
+
+26
+00:01:48,000 --> 00:01:51,000
+Let's check commit history Dedlock.
+
+27
+00:01:52,000 --> 00:01:59,000
+Now we can say that we lost to commit, OK, there is no harm for me to restore the changes from the
+
+28
+00:01:59,000 --> 00:02:05,000
+region branch, but it might happen that a regional branch was also accidentally overwritten or completely
+
+29
+00:02:05,000 --> 00:02:05,000
+removed.
+
+30
+00:02:06,000 --> 00:02:08,000
+You won't believe me, but such cases may happen.
+
+31
+00:02:09,000 --> 00:02:14,000
+At the first glance, it looks like that I only need to remember to check some of the lost comments,
+
+32
+00:02:14,000 --> 00:02:16,000
+but we didn't memorize them.
+
+33
+00:02:16,000 --> 00:02:19,000
+Agree the most complicated in this task to learn.
+
+34
+00:02:19,000 --> 00:02:21,000
+Check some of those comments.
+
+35
+00:02:21,000 --> 00:02:25,000
+And the easiest thing to answer this question is to call it red flag.
+
+36
+00:02:25,000 --> 00:02:27,000
+Come on, what is a red flag?
+
+37
+00:02:28,000 --> 00:02:32,000
+As we are working with gait and movement pointers get silently records.
+
+38
+00:02:32,000 --> 00:02:35,000
+What is our head pointer and how does it look like?
+
+39
+00:02:36,000 --> 00:02:42,000
+That means that each time we are creating a new snapshot or switching branches, the red flag is updated.
+
+40
+00:02:43,000 --> 00:02:49,000
+You can investigate the history of all changes in your repository by executing the next command gateway
+
+41
+00:02:49,000 --> 00:02:49,000
+flock.
+
+42
+00:02:50,000 --> 00:02:56,000
+We can see information about each operation that was done here about each commit, each research on
+
+43
+00:02:56,000 --> 00:02:57,000
+the region must have branch.
+
+44
+00:02:58,000 --> 00:03:02,000
+You can find information here about different branches by the reference in the parentheses.
+
+45
+00:03:02,000 --> 00:03:06,000
+Also, you may find checksum of each state right here.
+
+46
+00:03:06,000 --> 00:03:08,000
+By the way, this is the last program.
+
+47
+00:03:08,000 --> 00:03:13,000
+This is a program for text terminals, for Unix like systems to close it.
+
+48
+00:03:13,000 --> 00:03:16,000
+Just press Kyuki to remember it.
+
+49
+00:03:16,000 --> 00:03:18,000
+Q stands for it.
+
+50
+00:03:18,000 --> 00:03:20,000
+Here, let me press Q.
+
+51
+00:03:21,000 --> 00:03:22,000
+OK, Hillary.
+
+52
+00:03:22,000 --> 00:03:26,000
+So where's the place where you can get check some of the comments that you want to restore?
+
+53
+00:03:26,000 --> 00:03:31,000
+I know that for some students, the way our flag looks like is not very informative.
+
+54
+00:03:32,000 --> 00:03:38,000
+We can't see the detailed content messages we may find on the description of the operation, but not
+
+55
+00:03:38,000 --> 00:03:39,000
+the details about the commit.
+
+56
+00:03:40,000 --> 00:03:47,000
+What would I suggest to you is to use the next command get look with option G here you may find a list
+
+57
+00:03:47,000 --> 00:03:49,000
+of all commits was a red flag reference.
+
+58
+00:03:50,000 --> 00:03:52,000
+Here is our committee that we have lost.
+
+59
+00:03:53,000 --> 00:03:56,000
+Let me create a new branch with the state of that snapshot.
+
+60
+00:03:57,000 --> 00:03:59,000
+Yet Branch lost changes.
+
+61
+00:04:00,000 --> 00:04:08,000
+And now I have to specify, commit checks that I want to restore E 50, be a D great.
+
+62
+00:04:09,000 --> 00:04:13,000
+Now let's check commit history, get log last changes.
+
+63
+00:04:14,000 --> 00:04:19,000
+Just to remind you to check the current history of the specific branch, we should specify branch name
+
+64
+00:04:19,000 --> 00:04:25,000
+next to log command and we can see that our new branch contains commands that were lost.
+
+65
+00:04:26,000 --> 00:04:31,000
+So as far as you may understand, you can restore, Anderson, what was present in any committee in
+
+66
+00:04:31,000 --> 00:04:37,000
+your local repository or anything where hat pointer of your local repository ever pointed to.
+
+67
+00:04:37,000 --> 00:04:40,000
+Also, one more important note.
+
+68
+00:04:40,000 --> 00:04:44,000
+By default, information in red flag is stored for 90 days.
+
+69
+00:04:44,000 --> 00:04:45,000
+Usually it is enough.
+
+70
+00:04:46,000 --> 00:04:52,000
+It is very unlikely that you lived your happy life for 91 days and after that realized that you need
+
+71
+00:04:52,000 --> 00:04:53,000
+to restore some lost command.
+
+72
+00:04:54,000 --> 00:04:57,000
+Let me show you one more Syntex of restoring changes.
+
+73
+00:04:58,000 --> 00:05:03,000
+I'm on the massive branch and I didn't switch to the new branch with the name lost changes that we created
+
+74
+00:05:03,000 --> 00:05:06,000
+with the last comment on the massive branch.
+
+75
+00:05:06,000 --> 00:05:10,000
+I still don't have my last comments after the hard reset.
+
+76
+00:05:11,000 --> 00:05:13,000
+Let me reset was hard to Morcom.
+
+77
+00:05:13,000 --> 00:05:19,000
+It's back here is our leaders had hard to prove that we really moved a few comments back and that we
+
+78
+00:05:19,000 --> 00:05:21,000
+have lost even more comments.
+
+79
+00:05:21,000 --> 00:05:23,000
+Let me show you commit history.
+
+80
+00:05:23,000 --> 00:05:29,000
+You'd log that story and you can see that we lost our five zero beard commit.
+
+81
+00:05:30,000 --> 00:05:34,000
+Let me show you one more time that shows a whole raft.
+
+82
+00:05:34,000 --> 00:05:36,000
+Look, let me show you the flag.
+
+83
+00:05:36,000 --> 00:05:42,000
+Only for the past one hour traffic was option since equals to one our.
+
+84
+00:05:43,000 --> 00:05:48,000
+And I see limited amount of red flag you can use day instead of hours if you wish.
+
+85
+00:05:48,000 --> 00:05:52,000
+So here is a state of our head pointer before I set it.
+
+86
+00:05:52,000 --> 00:05:55,000
+Has Index had at nine and two.
+
+87
+00:05:56,000 --> 00:06:02,000
+That's the sad state of the current branch to the opposition leader, said resorption, hard hat and
+
+88
+00:06:03,000 --> 00:06:04,000
+to unlet.
+
+89
+00:06:04,000 --> 00:06:08,000
+Check our comment history one more time gridlock.
+
+90
+00:06:08,000 --> 00:06:09,000
+And here we are.
+
+91
+00:06:10,000 --> 00:06:13,000
+We successfully restored state of our filesystem and state of our branch.
+
+92
+00:06:13,000 --> 00:06:15,000
+That was before the last reset.
+
+93
+00:06:16,000 --> 00:06:19,000
+I believe this information will help you a lot in the future.
+
+94
+00:06:20,000 --> 00:06:22,000
+That's all what I planned to share with you today.
+
+95
+00:06:22,000 --> 00:06:24,000
+Let's recap what we have learned today.
+
+96
+00:06:25,000 --> 00:06:28,000
+So today we learned what a leader travelogue is.
+
+97
+00:06:28,000 --> 00:06:31,000
+Now you know how to use this command during the lesson.
+
+98
+00:06:31,000 --> 00:06:37,000
+We restore our lost commits by creating a branch from then lost it all by yourself in the current branch
+
+99
+00:06:37,000 --> 00:06:40,000
+to the previous state before some comments were lost.
+
+100
+00:06:40,000 --> 00:06:44,000
+Also, we learned how to show red filtered by time passed.
+
+101
+00:06:45,000 --> 00:06:47,000
+That's all what we have for today.
+
+102
+00:06:47,000 --> 00:06:48,000
+Thanks a lot for your attention.
+
+103
+00:06:49,000 --> 00:06:50,000
+See you in the next lesson.
+
diff --git a/17 - GIT/018 Git cherry-pick moving commits between branches_en.srt b/17 - GIT/018 Git cherry-pick moving commits between branches_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..5b9422416a96727039cdfe844011f23532afd1d5
--- /dev/null
+++ b/17 - GIT/018 Git cherry-pick moving commits between branches_en.srt
@@ -0,0 +1,592 @@
+1
+00:00:06,000 --> 00:00:10,000
+Hello, Jim, today we're going to discuss with you one more important command that may help you to
+
+2
+00:00:10,000 --> 00:00:13,000
+modify comit history, then we'll talk about cherrypick.
+
+3
+00:00:13,000 --> 00:00:20,000
+Come on, as usual, we'll discuss when we need to use this command after we'll understand when we need
+
+4
+00:00:20,000 --> 00:00:20,000
+to use cherrypick.
+
+5
+00:00:20,000 --> 00:00:25,000
+Command will proceed with our practice exercise to understand how we can use it.
+
+6
+00:00:25,000 --> 00:00:31,000
+In this lesson, I will share with you my experience of using cherrypick and I will tell you why this
+
+7
+00:00:31,000 --> 00:00:33,000
+command is not considered as a best practice.
+
+8
+00:00:33,000 --> 00:00:37,000
+And even despite that, why we may need to use this command some time.
+
+9
+00:00:38,000 --> 00:00:43,000
+I'm going to teach you how to cherrypick multiple commands at once and how to resolve conflicts during
+
+10
+00:00:43,000 --> 00:00:43,000
+cherrypicking.
+
+11
+00:00:44,000 --> 00:00:48,000
+And at the end of the lesson, I will share with you best practices of using cherrypick.
+
+12
+00:00:49,000 --> 00:00:55,000
+So when we have to use cherrypick, there are different cases when you might want to use cherrypick
+
+13
+00:00:55,000 --> 00:00:56,000
+command.
+
+14
+00:00:56,000 --> 00:01:01,000
+Some of them deliver hotfix to the end user as fast as possible.
+
+15
+00:01:02,000 --> 00:01:04,000
+Imagine that you created Reles Branch.
+
+16
+00:01:04,000 --> 00:01:09,000
+Rie's branch should contain only source code that is going to be part of the built of your application
+
+17
+00:01:09,000 --> 00:01:14,000
+that is going to be deployed on your production environment where it will be available to the end user.
+
+18
+00:01:15,000 --> 00:01:20,000
+And imagine that you realize that you're basing on merging of the latest changes before creation of
+
+19
+00:01:20,000 --> 00:01:21,000
+the release branch.
+
+20
+00:01:21,000 --> 00:01:25,000
+You missed important change and now you have a defect in the release branch.
+
+21
+00:01:26,000 --> 00:01:30,000
+The fix for this defect is present in the snapshot in your feature branch.
+
+22
+00:01:31,000 --> 00:01:32,000
+It was tested.
+
+23
+00:01:32,000 --> 00:01:33,000
+It was approved.
+
+24
+00:01:33,000 --> 00:01:39,000
+So the only thing that you have to do is to move the committee from the feature branch to your branch
+
+25
+00:01:39,000 --> 00:01:42,000
+and to move one snapshot from one branch to another.
+
+26
+00:01:42,000 --> 00:01:49,000
+We have to use the feature command or imagine another case and doing changes and restoring lost Kummetz.
+
+27
+00:01:50,000 --> 00:01:56,000
+Not all branches are merged into the master branch and some chametz might be lost using letterer floor
+
+28
+00:01:56,000 --> 00:01:57,000
+command.
+
+29
+00:01:57,000 --> 00:02:01,000
+You may find snapshots that you need and cherrypick it into your branch.
+
+30
+00:02:01,000 --> 00:02:08,000
+One more scenario, regular time collaboration in case you and team members work on the same feature
+
+31
+00:02:08,000 --> 00:02:13,000
+and you have some shared functionality, you might want to test something on your branch that includes
+
+32
+00:02:13,000 --> 00:02:14,000
+other changes.
+
+33
+00:02:14,000 --> 00:02:21,000
+For example, backend engineers created a data structure that Fronton team also needs to use, and Fronton
+
+34
+00:02:21,000 --> 00:02:26,000
+developers may use cherrypick command to get those changes into their branch.
+
+35
+00:02:26,000 --> 00:02:31,000
+Probably during the life of the developer, you will find other real life cases when you may use to
+
+36
+00:02:31,000 --> 00:02:36,000
+be command, but I believe you understand why you may want to use it.
+
+37
+00:02:36,000 --> 00:02:38,000
+And now attention.
+
+38
+00:02:38,000 --> 00:02:41,000
+I don't want you to share with attack tactless information.
+
+39
+00:02:41,000 --> 00:02:44,000
+That and reporter had told you that using of cherrypick is a best practice.
+
+40
+00:02:45,000 --> 00:02:51,000
+I want to say that cherrypick command usually consider is not a good practice and regular mergers are
+
+41
+00:02:51,000 --> 00:02:53,000
+preferred instead when it is possible.
+
+42
+00:02:54,000 --> 00:03:01,000
+But sometimes you might want to use this command while you Topeka's consider it is not a best practice
+
+43
+00:03:01,000 --> 00:03:02,000
+notice.
+
+44
+00:03:02,000 --> 00:03:08,000
+I said literally consider it not as a best practice, but not necessarily the bad thing.
+
+45
+00:03:09,000 --> 00:03:12,000
+To understand this, let's review how Get-Rich-Quick works.
+
+46
+00:03:12,000 --> 00:03:15,000
+It creates a tension separate come.
+
+47
+00:03:15,000 --> 00:03:20,000
+It was different hash and has no reference to original comment.
+
+48
+00:03:21,000 --> 00:03:27,000
+Content of command will be fully duplicated, but it will consider Newcome it an original one as two
+
+49
+00:03:27,000 --> 00:03:28,000
+different commands.
+
+50
+00:03:28,000 --> 00:03:34,000
+That's why some developers may consider cherrypick as a bad thing because it may cause problems like
+
+51
+00:03:34,000 --> 00:03:38,000
+having duplicate commands and multiple branches messing up with a good history and others.
+
+52
+00:03:39,000 --> 00:03:43,000
+But in case you are using this command attentively, there is no harm in that.
+
+53
+00:03:44,000 --> 00:03:50,000
+For example, there might be cases when you can't merge some branch because it contains a lot of other
+
+54
+00:03:50,000 --> 00:03:52,000
+changes that are not needed anymore.
+
+55
+00:03:52,000 --> 00:03:56,000
+And at some specific moment of time, you need only one single command.
+
+56
+00:03:56,000 --> 00:04:02,000
+That's where cherrypick command may help you so used cherrypick with caution.
+
+57
+00:04:02,000 --> 00:04:07,000
+At the end of the lesson, we are going to summarize rules that you have to follow during the cherrypicking.
+
+58
+00:04:08,000 --> 00:04:14,000
+Now let me show you the real example of cherrypicking the head for this lesson for the sake of the Dharma
+
+59
+00:04:14,000 --> 00:04:16,000
+Abbotabad branch was fuken its.
+
+60
+00:04:16,000 --> 00:04:21,000
+Let me briefly explain to you the state of my current repository so that you would understand the example.
+
+61
+00:04:22,000 --> 00:04:27,000
+Imagine that I am working on the implementation of LOG-IN functionality and I create a separate branch
+
+62
+00:04:27,000 --> 00:04:30,000
+for that was the name Keet three zero eight log.
+
+63
+00:04:30,000 --> 00:04:33,000
+Again, you can see that I am currently on it.
+
+64
+00:04:34,000 --> 00:04:37,000
+Let me show you the history of what I have already done.
+
+65
+00:04:38,000 --> 00:04:41,000
+This log was option one line necessary.
+
+66
+00:04:41,000 --> 00:04:46,000
+Option one line allows me to format output in a bit different ways than usual.
+
+67
+00:04:46,000 --> 00:04:51,000
+I press enter here what I have already done while being on this branch.
+
+68
+00:04:52,000 --> 00:04:54,000
+I implement in styles for login bottom.
+
+69
+00:04:54,000 --> 00:04:58,000
+Also I implement and backend part of login feature.
+
+70
+00:04:58,000 --> 00:05:01,000
+And here's a snapshot of the original master branch.
+
+71
+00:05:01,000 --> 00:05:03,000
+And imagine that during the.
+
+72
+00:05:03,000 --> 00:05:09,000
+Essence of my work quality assurance engineers found a lot of defects, and we are not in the position
+
+73
+00:05:09,000 --> 00:05:16,000
+to match my branch to a three zero eight into the master branch, but everybody really liked the style
+
+74
+00:05:16,000 --> 00:05:21,000
+of my login button and product on requested to have the other buttons in the same style.
+
+75
+00:05:22,000 --> 00:05:28,000
+That's why I want to prepare pool requests for only styles of my button and we'll merge that branch
+
+76
+00:05:28,000 --> 00:05:33,000
+into the master so that other developers also will be able to pick up the changes.
+
+77
+00:05:33,000 --> 00:05:36,000
+While I will be fixing all the defects.
+
+78
+00:05:36,000 --> 00:05:38,000
+Was back in court for the next week or two.
+
+79
+00:05:39,000 --> 00:05:41,000
+Just joking, you know that I would fix it faster.
+
+80
+00:05:42,000 --> 00:05:48,000
+But just as an example, this shouldn't be a problem because I will rebase my branch with the back and
+
+81
+00:05:48,000 --> 00:05:55,000
+quote on the master before merging or even just remove Starlin snapshot from the current branch to understand
+
+82
+00:05:55,000 --> 00:05:56,000
+the real life case.
+
+83
+00:05:57,000 --> 00:05:59,000
+Let me now show you how to do that.
+
+84
+00:05:59,000 --> 00:06:03,000
+First of all, let me create the branch from the latest master branch.
+
+85
+00:06:04,000 --> 00:06:05,000
+Good switch, master.
+
+86
+00:06:06,000 --> 00:06:10,000
+Nudes, which resorption CGA three zero nine modern styles.
+
+87
+00:06:12,000 --> 00:06:19,000
+OK, I'm on the new branch and imagine that I did some changes in the log into this House file, just
+
+88
+00:06:19,000 --> 00:06:25,000
+did any random changes, Nonno style slash log in order to assess.
+
+89
+00:06:25,000 --> 00:06:29,000
+Let me write here some text, some changes.
+
+90
+00:06:30,000 --> 00:06:37,000
+And save it now, let me come in this year to commit with option A and resorption and subcamp.
+
+91
+00:06:39,000 --> 00:06:47,000
+Hypocenter and now being on this branch, I have to cherry pick this game, it was Jackson E, C, six,
+
+92
+00:06:47,000 --> 00:06:52,000
+B, five, E, C, two copies that come in and apply it on my new branch.
+
+93
+00:06:52,000 --> 00:06:54,000
+Let me execute the next command.
+
+94
+00:06:55,000 --> 00:06:57,000
+Get cherrypick E, C six.
+
+95
+00:06:57,000 --> 00:06:58,000
+B, five.
+
+96
+00:06:58,000 --> 00:06:59,000
+E, c.
+
+97
+00:07:00,000 --> 00:07:06,000
+In case we wouldn't adjust the says as file, we want to see conflicts here and your it would be applied,
+
+98
+00:07:07,000 --> 00:07:09,000
+but that is way too easy for you.
+
+99
+00:07:10,000 --> 00:07:16,000
+I wanted to imitate state of the conflict during the cherrypicking to show you the process of the conflict
+
+100
+00:07:16,000 --> 00:07:17,000
+resolving during the cherrypick.
+
+101
+00:07:18,000 --> 00:07:24,000
+You see that it indicates that we are in the process of the cherry picking and gives us advice to resolve
+
+102
+00:07:24,000 --> 00:07:26,000
+conflicts and add files to the staging area.
+
+103
+00:07:27,000 --> 00:07:28,000
+Let me check your status.
+
+104
+00:07:29,000 --> 00:07:37,000
+And see here in the but it is said that there is a conflict in Logan says file, so let's open it in
+
+105
+00:07:37,000 --> 00:07:40,000
+the editor and let's resolve the conflicts now.
+
+106
+00:07:41,000 --> 00:07:47,000
+No styles log into SS will imitate the fact that we resolved all conflicts.
+
+107
+00:07:49,000 --> 00:07:53,000
+Now, let's mark this file as a result, get at DOT.
+
+108
+00:07:53,000 --> 00:08:01,000
+Now, let's continue our cherry picking process to do this, let's perform the next command, get cherrypick
+
+109
+00:08:01,000 --> 00:08:07,000
+with option continue and it allows us to adjust, commit message by default.
+
+110
+00:08:07,000 --> 00:08:10,000
+It keeps the region commit message of the previous commit.
+
+111
+00:08:11,000 --> 00:08:16,000
+Let's save and close this file and we can see that we applied our changes here.
+
+112
+00:08:16,000 --> 00:08:18,000
+Let's check our current history.
+
+113
+00:08:19,000 --> 00:08:21,000
+Good luck with option one line.
+
+114
+00:08:21,000 --> 00:08:22,000
+That's three.
+
+115
+00:08:23,000 --> 00:08:28,000
+And here's our new comment and attention, in case you would compare, check some of this comet and
+
+116
+00:08:28,000 --> 00:08:34,000
+check some of original comet from a three zero eight range, you're going to find that they are different.
+
+117
+00:08:35,000 --> 00:08:38,000
+That means that these two are not the same comet.
+
+118
+00:08:39,000 --> 00:08:42,000
+This one is just a copy of the first one.
+
+119
+00:08:42,000 --> 00:08:49,000
+And now a few more important variations and options of cherrypick command in case something went wrong
+
+120
+00:08:49,000 --> 00:08:50,000
+during the conflict resolution.
+
+121
+00:08:50,000 --> 00:08:56,000
+You can just abort the process of cherrypicking like this, get cherrypick with option abort.
+
+122
+00:08:57,000 --> 00:09:01,000
+Also, if you wish, you may cherry pick multiple comets at once.
+
+123
+00:09:01,000 --> 00:09:02,000
+To do this.
+
+124
+00:09:02,000 --> 00:09:08,000
+You have specified checksum of all comets separated by space like this year.
+
+125
+00:09:08,000 --> 00:09:15,000
+Cherrypick E, C six B five e C and three F three one six six six.
+
+126
+00:09:16,000 --> 00:09:17,000
+Those are two comets from our damos.
+
+127
+00:09:18,000 --> 00:09:22,000
+Now when you know how to use cherrypick, let's talk about the best practices.
+
+128
+00:09:24,000 --> 00:09:30,000
+The rule number one, if it's not critical and you can apply necessary changes with much opt for much
+
+129
+00:09:30,000 --> 00:09:37,000
+option, it is considered to be a general practice to prefer much option of a cherrypick rule number
+
+130
+00:09:37,000 --> 00:09:44,000
+to avoid creating any duplication by using cherrypick if you cherry picked commands and removed all
+
+131
+00:09:44,000 --> 00:09:46,000
+branch or just reset the old branch.
+
+132
+00:09:46,000 --> 00:09:47,000
+That's fine.
+
+133
+00:09:47,000 --> 00:09:49,000
+And this will not lead to any issues.
+
+134
+00:09:50,000 --> 00:09:54,000
+Potential issues may happen in case you keep two branches and have duplicated Kummetz.
+
+135
+00:09:55,000 --> 00:10:01,000
+Rule number three, sometimes it is considered as a good practice during the cherrypick to specify the
+
+136
+00:10:01,000 --> 00:10:07,000
+hash code or the original commit, it may help you to do this in case you will use exception like this.
+
+137
+00:10:07,000 --> 00:10:10,000
+Get your pick was option X.
+
+138
+00:10:10,000 --> 00:10:16,000
+This option will automatically adds information about the regional committee into your new one.
+
+139
+00:10:16,000 --> 00:10:20,000
+And here on the screenshot, you may see how your comit message will look like.
+
+140
+00:10:21,000 --> 00:10:26,000
+You learned a lot today about cherrypick, let's recap what we have learned today.
+
+141
+00:10:27,000 --> 00:10:32,000
+Now, you know when you might need to apply cherrypick command, because we discussed with you different
+
+142
+00:10:32,000 --> 00:10:34,000
+cases when this command will help you.
+
+143
+00:10:35,000 --> 00:10:39,000
+Also, you understood why cherrypick is not considered to be as a good practice.
+
+144
+00:10:39,000 --> 00:10:43,000
+One real example, you saw how to resolve conflicts during cherrypicking.
+
+145
+00:10:44,000 --> 00:10:47,000
+Now you know how to cherrypick multiple Kummetz at once.
+
+146
+00:10:47,000 --> 00:10:52,000
+And at the end of the lesson, we learned best practices of using cherrypick command.
+
+147
+00:10:52,000 --> 00:10:54,000
+That's all for today.
+
+148
+00:10:54,000 --> 00:10:57,000
+Thanks a lot for your attention and see you in the next lesson.
+
diff --git a/17 - GIT/019 Cloning remote repository git clone.html b/17 - GIT/019 Cloning remote repository git clone.html
new file mode 100644
index 0000000000000000000000000000000000000000..d5e09ae2c85e5ae7e935f1c8e12c23c95545417d
--- /dev/null
+++ b/17 - GIT/019 Cloning remote repository git clone.html
@@ -0,0 +1,69 @@
+
+
+
To clone remote repository, please, follow next steps:
- 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
- On the github, find green button with the 'Code' text on it. - 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.
- copy the string with address to the clipboard.
- navigate in your filesystem where you want to clone your repository - open gitbash in that directory and type the next:
git clone <HERE PASTE THE STATE OF YOUR CLIPBOARD>
Take a look at the screenshot:
- Press enter button
- Congratulations! You have just cloned the remote repository!
+
+
+
+
diff --git a/17 - GIT/020 Git and Eclipse integration_en.srt b/17 - GIT/020 Git and Eclipse integration_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..ac001306014f5bb81a056e30a8d01ce0b5596351
--- /dev/null
+++ b/17 - GIT/020 Git and Eclipse integration_en.srt
@@ -0,0 +1,832 @@
+1
+00:00:06,000 --> 00:00:10,000
+And now the students in this class and we are going to discuss the topic that will be interesting for
+
+2
+00:00:10,000 --> 00:00:16,000
+developers who work in such integrated development environment as Eclipse, we're going to learn today
+
+3
+00:00:16,000 --> 00:00:22,000
+how to integrate it with eclipse for development come for besides buttons and widgets that will configure
+
+4
+00:00:22,000 --> 00:00:24,000
+an eclipse during the lesson.
+
+5
+00:00:24,000 --> 00:00:30,000
+I will show you how you can use get Bush directly from the eclipse together on real example.
+
+6
+00:00:30,000 --> 00:00:33,000
+We are going to learn how to execute basic operations from Eclipse.
+
+7
+00:00:34,000 --> 00:00:40,000
+I make overview of widgets that will allow you to see good history navigate between branches, push
+
+8
+00:00:40,000 --> 00:00:43,000
+and pull changes from the remote repository.
+
+9
+00:00:43,000 --> 00:00:48,000
+After this lesson, you will learn how you can resolve conflicts in eclipse interface.
+
+10
+00:00:49,000 --> 00:00:51,000
+Let's start and turn the topic.
+
+11
+00:00:51,000 --> 00:00:53,000
+I said just jump into the practice.
+
+12
+00:00:53,000 --> 00:00:55,000
+Here's my Eclipse workspace.
+
+13
+00:00:55,000 --> 00:01:00,000
+I created a completely new workspace and reset perspective for you to default to configure it with you
+
+14
+00:01:00,000 --> 00:01:01,000
+from scratch.
+
+15
+00:01:01,000 --> 00:01:07,000
+I have Empathies Java Project, which we did together during the learning of the get in the workspace.
+
+16
+00:01:07,000 --> 00:01:09,000
+How to Impact Projects into Eclipse.
+
+17
+00:01:09,000 --> 00:01:11,000
+I'm going to show you in the separate lesson.
+
+18
+00:01:11,000 --> 00:01:14,000
+Do not lose focus from the topic right now.
+
+19
+00:01:15,000 --> 00:01:22,000
+When I in the Project Eclipse automatically recognised that there is a git repository and you see that
+
+20
+00:01:22,000 --> 00:01:25,000
+in square brackets, it is even specifying my current branch.
+
+21
+00:01:26,000 --> 00:01:31,000
+But nevertheless, I will show you how that you get repository to eclipse manually just in case.
+
+22
+00:01:32,000 --> 00:01:35,000
+First of all, let's add all views here that we need.
+
+23
+00:01:36,000 --> 00:01:38,000
+Click on Window Show.
+
+24
+00:01:38,000 --> 00:01:43,000
+You are the one here git folder or use search bar to find it faster.
+
+25
+00:01:44,000 --> 00:01:47,000
+I would say that you'd stadion and git repositories.
+
+26
+00:01:47,000 --> 00:01:48,000
+Those are tools that you need.
+
+27
+00:01:48,000 --> 00:01:49,000
+One hundred percent.
+
+28
+00:01:50,000 --> 00:01:56,000
+Well, at least in my opinion, I'm holding control button and with a mouse left click select the options
+
+29
+00:01:56,000 --> 00:01:57,000
+that I need.
+
+30
+00:01:58,000 --> 00:02:04,000
+Let's also select get lock and it is good that we have learned how to work with Gatins again.
+
+31
+00:02:04,000 --> 00:02:08,000
+But at least now you already understand what all these views are about.
+
+32
+00:02:09,000 --> 00:02:13,000
+You already know what is a staging area, what is a good red flag.
+
+33
+00:02:13,000 --> 00:02:19,000
+You already know what they're getting directed for basis after we selected all use we need.
+
+34
+00:02:19,000 --> 00:02:20,000
+Let's press open button.
+
+35
+00:02:22,000 --> 00:02:30,000
+Nice views were opened just to remind you that you can move these views wherever you like them most
+
+36
+00:02:30,000 --> 00:02:32,000
+here in the clips, for example.
+
+37
+00:02:32,000 --> 00:02:36,000
+Let me move git repositories widget here at the bottom with other views.
+
+38
+00:02:36,000 --> 00:02:41,000
+And you can see that my clips recognized each repository in my project automatically.
+
+39
+00:02:42,000 --> 00:02:47,000
+But just for the future and just in case, I want you to know how to add the existing repository to
+
+40
+00:02:47,000 --> 00:02:53,000
+their clips, because it might be that the clips will not automatically recognize that you have not
+
+41
+00:02:53,000 --> 00:02:54,000
+get folder in your project.
+
+42
+00:02:54,000 --> 00:02:57,000
+And in this case you have to edit manually.
+
+43
+00:02:58,000 --> 00:03:03,000
+For the sake of example, let me remove the digital repository from this view in the clips mouse right.
+
+44
+00:03:03,000 --> 00:03:11,000
+Click remove repository from you because I want to remove git repository only from eclipse view and
+
+45
+00:03:11,000 --> 00:03:17,000
+I don't want to remove the don't get folder from the file system and I don't want to remove the project
+
+46
+00:03:17,000 --> 00:03:20,000
+and eclipse associated with this git repository.
+
+47
+00:03:20,000 --> 00:03:23,000
+I want to keep project in my workspace for you.
+
+48
+00:03:23,000 --> 00:03:25,000
+That's why I press this button.
+
+49
+00:03:26,000 --> 00:03:27,000
+Awesome.
+
+50
+00:03:27,000 --> 00:03:30,000
+Now we don't have any repository here.
+
+51
+00:03:30,000 --> 00:03:32,000
+You can create a new repository if you wish.
+
+52
+00:03:33,000 --> 00:03:35,000
+That is similar to executing Mutiny's.
+
+53
+00:03:35,000 --> 00:03:35,000
+Come on.
+
+54
+00:03:36,000 --> 00:03:40,000
+You might also an existing repository with the help of the eclipse wizard.
+
+55
+00:03:40,000 --> 00:03:45,000
+And in case you already have git repository in your computer, you can just add it to the workspace.
+
+56
+00:03:46,000 --> 00:03:51,000
+I believe there is no need to go over each of this option in detail because creating a good repository
+
+57
+00:03:51,000 --> 00:03:56,000
+is just specifying directory where you want to create don't get older and present.
+
+58
+00:03:56,000 --> 00:04:02,000
+Great Bottom Clonan Repository is just specifying the past as a repository and your credentials in case
+
+59
+00:04:02,000 --> 00:04:05,000
+you want a repository with the help of a HTTPS protocol.
+
+60
+00:04:06,000 --> 00:04:13,000
+But from my experience, this option at an existing local repository is used most of the times by me,
+
+61
+00:04:14,000 --> 00:04:19,000
+and I don't know why, probably because I don't rely on the eclipse tools to manage Mangat repository.
+
+62
+00:04:19,000 --> 00:04:26,000
+Usually I fetch all projects with a simple git clone command in the git bash and after that an important
+
+63
+00:04:26,000 --> 00:04:30,000
+project to the eclipse and an existing local git repository.
+
+64
+00:04:31,000 --> 00:04:37,000
+Personally, for me, this option is the easiest one, but my job is to share with you all possible
+
+65
+00:04:37,000 --> 00:04:40,000
+options and let you decide what works the best for you.
+
+66
+00:04:41,000 --> 00:04:46,000
+That's why let me show you how I usually add existing local repositories to Eclipse.
+
+67
+00:04:46,000 --> 00:04:53,000
+And now you should specify a folder where your local repository is located and navigate it to the folder
+
+68
+00:04:53,000 --> 00:04:59,000
+that we created together during the course while learning Gaede and press select folder button here
+
+69
+00:04:59,000 --> 00:05:02,000
+clip's shows me repositories that it found in this folder.
+
+70
+00:05:02,000 --> 00:05:08,000
+I checked this checkbox and press that button and here's my repository back again.
+
+71
+00:05:09,000 --> 00:05:10,000
+Let me expand it.
+
+72
+00:05:11,000 --> 00:05:13,000
+It is very convenient to switch branches here.
+
+73
+00:05:14,000 --> 00:05:20,000
+You might find here local and remote branches nable left click on the massive branch will move me to
+
+74
+00:05:20,000 --> 00:05:23,000
+the master branch eclipse will ask for confirmation.
+
+75
+00:05:24,000 --> 00:05:28,000
+Just click checkout and you already know how you check out command works.
+
+76
+00:05:28,000 --> 00:05:35,000
+So I believe you understood what happened behind the scene and you may see a small T care next to the
+
+77
+00:05:35,000 --> 00:05:36,000
+massive branch name.
+
+78
+00:05:37,000 --> 00:05:40,000
+Let me switch back to the Kayseri 09 branch.
+
+79
+00:05:41,000 --> 00:05:41,000
+Right.
+
+80
+00:05:41,000 --> 00:05:47,000
+Click on the branch would allow you to do the operations that will want to perform in Git Bush.
+
+81
+00:05:47,000 --> 00:05:51,000
+You may reset branch in different modes, so it makes and hard.
+
+82
+00:05:52,000 --> 00:05:58,000
+You may replace your branch if needed, merged, delete, rename and perform all other operations that
+
+83
+00:05:58,000 --> 00:06:00,000
+you may perform in the git bash.
+
+84
+00:06:01,000 --> 00:06:05,000
+We don't have docs in our repository yet, so it is empty here.
+
+85
+00:06:06,000 --> 00:06:13,000
+What a task is will be discussed in the separate question here, you may find your main references in
+
+86
+00:06:13,000 --> 00:06:13,000
+your repository.
+
+87
+00:06:13,000 --> 00:06:17,000
+You may check out the if you wish in remote.
+
+88
+00:06:17,000 --> 00:06:24,000
+You may check to what remote repository you are connected right now in Stasch comments, you can explore
+
+89
+00:06:24,000 --> 00:06:25,000
+the state of your stasch.
+
+90
+00:06:26,000 --> 00:06:33,000
+And you're working directory, that is technically a project that may collapse everything here, based
+
+91
+00:06:33,000 --> 00:06:38,000
+on my experience, I mostly use this section to navigate between branches, create new branch if needed,
+
+92
+00:06:38,000 --> 00:06:40,000
+and remove all branches.
+
+93
+00:06:41,000 --> 00:06:48,000
+Let's move on this, Sunny, as a positive name means that I have some onstage changes you may find
+
+94
+00:06:48,000 --> 00:06:48,000
+similar.
+
+95
+00:06:48,000 --> 00:06:54,000
+Some here in the package explore how to identify what change are we talking about?
+
+96
+00:06:54,000 --> 00:06:56,000
+Let's check separate tab for that.
+
+97
+00:06:56,000 --> 00:07:02,000
+Yet, Stadion here, you can manage what is in the staging area right here, commit message and commit
+
+98
+00:07:02,000 --> 00:07:03,000
+changes if you want.
+
+99
+00:07:03,000 --> 00:07:08,000
+You also can commit and push to the remote with a single button click here.
+
+100
+00:07:08,000 --> 00:07:13,000
+From this view, I see that DOT project file is marked as unstaged changes here.
+
+101
+00:07:14,000 --> 00:07:20,000
+This is configuration of eclipse file that the groups created after we implement the project into it.
+
+102
+00:07:20,000 --> 00:07:22,000
+Let me update yet.
+
+103
+00:07:22,000 --> 00:07:23,000
+Ignore the just ignore this file.
+
+104
+00:07:24,000 --> 00:07:28,000
+I can't find it in your file in the package Explorer review.
+
+105
+00:07:28,000 --> 00:07:30,000
+But let me open the gate of you for that.
+
+106
+00:07:31,000 --> 00:07:34,000
+I click window shoe view navigator.
+
+107
+00:07:35,000 --> 00:07:42,000
+And this view, I can see old files as they are look like in my file system and here's Technophile,
+
+108
+00:07:43,000 --> 00:07:46,000
+let me add here DOT Project and save the file.
+
+109
+00:07:47,000 --> 00:07:53,000
+And you must use it instantly, not project file is gone from unstaged changes and to ignore it, you're
+
+110
+00:07:54,000 --> 00:07:59,000
+going to press this green plus sign to add all files from this section to the stage changes section.
+
+111
+00:07:59,000 --> 00:08:00,000
+That's right.
+
+112
+00:08:00,000 --> 00:08:03,000
+Commit message and troops files ignored.
+
+113
+00:08:03,000 --> 00:08:09,000
+And I can make a comment by clicking here, but probably I would commit and push changes to the remote
+
+114
+00:08:09,000 --> 00:08:11,000
+repository simultaneously.
+
+115
+00:08:11,000 --> 00:08:16,000
+To do this, I have to click on it and push button here in the desert.
+
+116
+00:08:16,000 --> 00:08:19,000
+You should set up stream branch for the current branch.
+
+117
+00:08:19,000 --> 00:08:25,000
+That is exactly what we did when we specified you option during the push to the remote repository.
+
+118
+00:08:26,000 --> 00:08:32,000
+Just click all these buttons until you see confirmation that your changes were pushed because the remote
+
+119
+00:08:32,000 --> 00:08:37,000
+we may check GitHub, but believe me, changes are there in the remote already.
+
+120
+00:08:37,000 --> 00:08:40,000
+Let me show you a few more things you can press.
+
+121
+00:08:40,000 --> 00:08:41,000
+Mouse, right.
+
+122
+00:08:41,000 --> 00:08:44,000
+Click on the project and you'll find a team section.
+
+123
+00:08:45,000 --> 00:08:48,000
+This section is integration with it in Eclipse.
+
+124
+00:08:48,000 --> 00:08:54,000
+And you might find here a lot of different options like fetch from upstream push or bold changes and
+
+125
+00:08:54,000 --> 00:08:55,000
+many others.
+
+126
+00:08:56,000 --> 00:09:02,000
+Take your time to investigate the section and ask me in case you have any questions to check, commit
+
+127
+00:09:02,000 --> 00:09:02,000
+history.
+
+128
+00:09:03,000 --> 00:09:06,000
+You can press show in history here.
+
+129
+00:09:06,000 --> 00:09:11,000
+You may see cammed hash commit message, author of the Commit and Date of the Snapshot.
+
+130
+00:09:11,000 --> 00:09:16,000
+And this window, you can check what files were changed in scope of the particular comment.
+
+131
+00:09:16,000 --> 00:09:21,000
+You may open the file to see the difference before and after the snapshot to understand what exactly
+
+132
+00:09:21,000 --> 00:09:22,000
+was changed.
+
+133
+00:09:23,000 --> 00:09:28,000
+This is where we use a full tool during the investigation of the effects when after specific commit
+
+134
+00:09:28,000 --> 00:09:29,000
+something went wrong.
+
+135
+00:09:30,000 --> 00:09:35,000
+Also here in the history, you may reset your branch to a specific committee or check out there.
+
+136
+00:09:36,000 --> 00:09:37,000
+You just click mouse, right.
+
+137
+00:09:37,000 --> 00:09:40,000
+Click and select exactly what you need.
+
+138
+00:09:41,000 --> 00:09:46,000
+Now I want to show you a few more configurations that I found extremely helpful.
+
+139
+00:09:46,000 --> 00:09:50,000
+I want to tell you how you can add a few buttons here on the toolbar.
+
+140
+00:09:50,000 --> 00:09:54,000
+Click window perspective, customize perspective.
+
+141
+00:09:55,000 --> 00:09:59,000
+Now go to the action of ability and select it here.
+
+142
+00:09:59,000 --> 00:10:05,000
+After that, go to the toolbar visibility and make sure that it is selected here.
+
+143
+00:10:06,000 --> 00:10:11,000
+Click, apply and close, and now here on the top, you have very convenient buttons.
+
+144
+00:10:12,000 --> 00:10:20,000
+No matter what you want to do, push back from upstream pool, check out the branch, Rebase Mirch,
+
+145
+00:10:20,000 --> 00:10:26,000
+or he said you can start the separation's simply by clicking the right button in the toolbar.
+
+146
+00:10:27,000 --> 00:10:33,000
+And even in case you can't find is important that you need or you want to execute some specific command
+
+147
+00:10:33,000 --> 00:10:34,000
+was a specific option.
+
+148
+00:10:34,000 --> 00:10:40,000
+You always may open it feedback directly from Eclipse and start working it to open it.
+
+149
+00:10:40,000 --> 00:10:44,000
+Bushing An Eclipse finds the icon of the console in the toolbar.
+
+150
+00:10:45,000 --> 00:10:48,000
+Hear this, click on it and select it.
+
+151
+00:10:48,000 --> 00:10:53,000
+Bush in the dropdown here in the bus should be installed on your computer.
+
+152
+00:10:53,000 --> 00:10:58,000
+In either case, you won't be able to find it here in the dropdown list.
+
+153
+00:10:58,000 --> 00:11:02,000
+Now you may click OK Button and terminal is opened.
+
+154
+00:11:03,000 --> 00:11:05,000
+Important thing to mention here.
+
+155
+00:11:05,000 --> 00:11:11,000
+Always pay attention to the directory WAGGETT Bush is opened in case you have multiple yet repositories
+
+156
+00:11:11,000 --> 00:11:19,000
+in the single eclipse workspace that keeps my open you another directory or it may open your home directory
+
+157
+00:11:20,000 --> 00:11:23,000
+to make sure that eclipse will open the user right directly.
+
+158
+00:11:23,000 --> 00:11:29,000
+I always press the project first here and only after that I click open terminal icon homes.
+
+159
+00:11:29,000 --> 00:11:31,000
+This information will help you.
+
+160
+00:11:31,000 --> 00:11:33,000
+That is practical, deep.
+
+161
+00:11:33,000 --> 00:11:35,000
+That is really helpful to students in my opinion.
+
+162
+00:11:36,000 --> 00:11:38,000
+We didn't talk about Rafalski yet.
+
+163
+00:11:38,000 --> 00:11:40,000
+Nothing special here.
+
+164
+00:11:40,000 --> 00:11:44,000
+I believe you already learned in the separate lesson what a greater focus here.
+
+165
+00:11:44,000 --> 00:11:48,000
+You might find the red flag, if you will domus right click.
+
+166
+00:11:48,000 --> 00:11:51,000
+You can find additional options that might be useful for you.
+
+167
+00:11:52,000 --> 00:11:57,000
+And the last things that I wanted to share with you today is to show you how you can resolve conflicts
+
+168
+00:11:57,000 --> 00:12:02,000
+in eclipse, especially for that I prepared a separate branch where I reproduce, merge conflicts,
+
+169
+00:12:02,000 --> 00:12:06,000
+state how to reproduce and what merge conflict is.
+
+170
+00:12:06,000 --> 00:12:12,000
+Please feel free to learn in the separate lesson dedicated to the merge conflicts in this lesson output
+
+171
+00:12:12,000 --> 00:12:15,000
+the stress only on the eclipse tools to integrate with the grid.
+
+172
+00:12:16,000 --> 00:12:19,000
+Here is a separate branch with so much conflict in it.
+
+173
+00:12:20,000 --> 00:12:22,000
+I called the branch merge conflict dilemma.
+
+174
+00:12:23,000 --> 00:12:29,000
+Usually when you have much conflict, eclipse highlights to your files in which you have much conflict
+
+175
+00:12:29,000 --> 00:12:30,000
+with the red dots like this.
+
+176
+00:12:31,000 --> 00:12:37,000
+So now it is impossible to mis file with the next conflict when we open the file, which is a good science
+
+177
+00:12:37,000 --> 00:12:41,000
+where I get separated for different state of the file from different snapshots.
+
+178
+00:12:42,000 --> 00:12:45,000
+But the groups offer special tool to merge conflicts in files.
+
+179
+00:12:46,000 --> 00:12:48,000
+Let me show it to you, Mouse.
+
+180
+00:12:48,000 --> 00:12:53,000
+Right, click on file game merge two here on top.
+
+181
+00:12:53,000 --> 00:12:56,000
+You are going to see Kummetz hash that have conflict.
+
+182
+00:12:57,000 --> 00:13:04,000
+Usually you can't edit text in the window on the right, but you can modify text in the window on the
+
+183
+00:13:04,000 --> 00:13:04,000
+left.
+
+184
+00:13:04,000 --> 00:13:09,000
+Here you can click this arrow to place everything from the right window to the left window.
+
+185
+00:13:10,000 --> 00:13:15,000
+When you are going to have more conflicts, there will be different arrows for each specific conflict.
+
+186
+00:13:16,000 --> 00:13:21,000
+And after you modify the file on the left, you can press control and ask to save the file.
+
+187
+00:13:21,000 --> 00:13:27,000
+If we would check the same file in the text editor, we are going to find that all signs that it put
+
+188
+00:13:27,000 --> 00:13:27,000
+here.
+
+189
+00:13:27,000 --> 00:13:31,000
+I removed grate in the gas station.
+
+190
+00:13:31,000 --> 00:13:34,000
+You can put a file to the staging area to more conflict.
+
+191
+00:13:34,000 --> 00:13:39,000
+As a result, when conflict is resolved, you may see a small asterisk on the file.
+
+192
+00:13:39,000 --> 00:13:45,000
+And after all, conflicts are resolved and there are no more red dots, you can open it.
+
+193
+00:13:45,000 --> 00:13:46,000
+Brush and continue.
+
+194
+00:13:46,000 --> 00:13:48,000
+Is a rebasing or cherrypicking something?
+
+195
+00:13:48,000 --> 00:13:50,000
+What caused the merge conflicts?
+
+196
+00:13:51,000 --> 00:13:55,000
+I believe we learned a lot today about the clips and get integration.
+
+197
+00:13:55,000 --> 00:14:02,000
+Now I want you to take your time and as much heat related violence as possible to learn the material
+
+198
+00:14:02,000 --> 00:14:02,000
+better.
+
+199
+00:14:02,000 --> 00:14:06,000
+The best thing to learn this is to practice as much as you can.
+
+200
+00:14:07,000 --> 00:14:10,000
+Meanwhile, let's recap what we have learned today.
+
+201
+00:14:10,000 --> 00:14:13,000
+The Navy learned how we might interact with it.
+
+202
+00:14:13,000 --> 00:14:18,000
+With the help of a glimpse, we learned what views the clips we may use to execute to give commands.
+
+203
+00:14:19,000 --> 00:14:25,000
+Also today, you saw how you can execute basic operations from a collapse besides the collapse configuration.
+
+204
+00:14:25,000 --> 00:14:32,000
+We also learned how to use it directly from Eclipse today, where even did can commit and push that
+
+205
+00:14:32,000 --> 00:14:34,000
+snapshot to the remote repository.
+
+206
+00:14:34,000 --> 00:14:39,000
+And in the end of the lesson, I showed you how you might use magenta in eclipse.
+
+207
+00:14:39,000 --> 00:14:41,000
+Hope you enjoyed the lesson.
+
+208
+00:14:41,000 --> 00:14:44,000
+Thanks a lot for your attention and see you in the next lesson.
+
diff --git a/17 - GIT/external-links.txt b/17 - GIT/external-links.txt
new file mode 100644
index 0000000000000000000000000000000000000000..bb531250b34be9d1edccb129b126a67c0f7de3fc
--- /dev/null
+++ b/17 - GIT/external-links.txt
@@ -0,0 +1,9 @@
+
+002 Git-download-Web-site
+https://git-scm.com/downloads
+
+005 Git-ignore-for-different-languages
+https://github.com/github/gitignore
+
+009 -ls-command-details
+https://www.rapidtables.com/code/linux/ls.html
diff --git a/18 - Excpetion Handling/001 Exception Handling in Java_en.srt b/18 - Excpetion Handling/001 Exception Handling in Java_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..ae8bcc7fce32e9bbbdc17460a40387a9cb0f550b
--- /dev/null
+++ b/18 - Excpetion Handling/001 Exception Handling in Java_en.srt
@@ -0,0 +1,1500 @@
+1
+00:00:05,000 --> 00:00:06,000
+Hello there.
+
+2
+00:00:06,000 --> 00:00:10,000
+Students in this class and we are going to discuss an important topic, you would use knowledge from
+
+3
+00:00:10,000 --> 00:00:13,000
+this last year in your own life as a software engineer.
+
+4
+00:00:14,000 --> 00:00:17,000
+They will talk about exceptions and how to handle exceptions in Java.
+
+5
+00:00:17,000 --> 00:00:19,000
+I will explain what exceptions are.
+
+6
+00:00:20,000 --> 00:00:22,000
+We will talk about Iraqi of exceptions.
+
+7
+00:00:23,000 --> 00:00:24,000
+After this lesson.
+
+8
+00:00:24,000 --> 00:00:27,000
+You will understand what checked and checked exceptions are.
+
+9
+00:00:27,000 --> 00:00:30,000
+Besides all this, we are going to learn how to handle exceptions.
+
+10
+00:00:30,000 --> 00:00:35,000
+You'll learn what try catch block is and what finally block is well known.
+
+11
+00:00:35,000 --> 00:00:38,000
+Different variations of catch blocks in this lesson.
+
+12
+00:00:38,000 --> 00:00:42,000
+We'll also talk about how to declare that some method will throw exception.
+
+13
+00:00:43,000 --> 00:00:48,000
+You are going to learn what specific case was thrown exceptions during inheritance and methods of arriving.
+
+14
+00:00:48,000 --> 00:00:54,000
+And at the end of the lesson you learn how to create your own custom exceptions to meet the requirements
+
+15
+00:00:54,000 --> 00:00:55,000
+of business logic.
+
+16
+00:00:55,000 --> 00:01:00,000
+During the lesson I, I'll share with you best practices and tips how to work with exceptions in Java
+
+17
+00:01:00,000 --> 00:01:03,000
+to help you handle exceptions like approach.
+
+18
+00:01:03,000 --> 00:01:08,000
+Let's start from understanding what exceptions have explaining in simple words.
+
+19
+00:01:08,000 --> 00:01:14,000
+Imagine that you wrote the logic for your online store, and the content managers may now upload information
+
+20
+00:01:14,000 --> 00:01:21,000
+about products to your program manager, store information about products and specific files with GSV
+
+21
+00:01:21,000 --> 00:01:28,000
+format that is comma separated values format that is widely used in transferring and storing data will
+
+22
+00:01:28,000 --> 00:01:33,000
+face with files of such format in the near future will not focus on the specific file format.
+
+23
+00:01:34,000 --> 00:01:39,000
+Just imagine that managers can upload information with products to your program, bypassing a specific
+
+24
+00:01:39,000 --> 00:01:39,000
+file.
+
+25
+00:01:40,000 --> 00:01:46,000
+And what if manager parse the file name and file past that does not exist on the file system at all.
+
+26
+00:01:46,000 --> 00:01:48,000
+That is exceptional case.
+
+27
+00:01:48,000 --> 00:01:52,000
+Your program does not have predefined logic by default to handle that.
+
+28
+00:01:53,000 --> 00:01:54,000
+That is called exception.
+
+29
+00:01:55,000 --> 00:02:01,000
+Your program can't predict that users who will interact with your program will pass invalid link to
+
+30
+00:02:01,000 --> 00:02:02,000
+the file.
+
+31
+00:02:02,000 --> 00:02:06,000
+It is not an issue of your application that is technical limitations at all.
+
+32
+00:02:06,000 --> 00:02:08,000
+Users should respect.
+
+33
+00:02:09,000 --> 00:02:14,000
+But what to do in this case, they have to catch this exceptional case and write a code that will tell
+
+34
+00:02:14,000 --> 00:02:15,000
+what to do next.
+
+35
+00:02:15,000 --> 00:02:22,000
+In such cases, for example, do we want to inform our users that file does not exist and let him or
+
+36
+00:02:22,000 --> 00:02:24,000
+her to upload file one more time?
+
+37
+00:02:24,000 --> 00:02:29,000
+Or do we want to just ignore this fact and inform users at zero products added?
+
+38
+00:02:30,000 --> 00:02:36,000
+Product owners can come up with numerous cases how to handle this case from user experience site, but
+
+39
+00:02:36,000 --> 00:02:38,000
+we have to implement that.
+
+40
+00:02:38,000 --> 00:02:40,000
+Does this example make sense clearer?
+
+41
+00:02:40,000 --> 00:02:43,000
+Can you understand now what an exception is?
+
+42
+00:02:43,000 --> 00:02:47,000
+OK, if you understood this example, let's move on.
+
+43
+00:02:47,000 --> 00:02:50,000
+The next example would be a bit more technical.
+
+44
+00:02:50,000 --> 00:02:54,000
+That's why let me show it to you on the real code example.
+
+45
+00:02:55,000 --> 00:02:59,000
+Imagine that you implemented masses that should charge users during the checkout process.
+
+46
+00:03:00,000 --> 00:03:02,000
+We call it charge user.
+
+47
+00:03:02,000 --> 00:03:07,000
+And this matter takes user object as an argument, an amount of money to charge.
+
+48
+00:03:07,000 --> 00:03:15,000
+Specially for this example, I created simple class user that contains only one filled amount of money
+
+49
+00:03:15,000 --> 00:03:20,000
+and tumescence getter and setter to manipulate with the state of this type.
+
+50
+00:03:20,000 --> 00:03:24,000
+This simple user class will keep you focused on our example.
+
+51
+00:03:25,000 --> 00:03:28,000
+Imagine that we want to update amount of money in user object.
+
+52
+00:03:29,000 --> 00:03:35,000
+That's why you call Sattar Masset to set amount of money that is less than current amount by the order
+
+53
+00:03:35,000 --> 00:03:36,000
+price.
+
+54
+00:03:36,000 --> 00:03:41,000
+But for some reasons there is no user object behind this reference.
+
+55
+00:03:41,000 --> 00:03:42,000
+How this can happen?
+
+56
+00:03:43,000 --> 00:03:46,000
+There are dozens of reasons database didn't return.
+
+57
+00:03:46,000 --> 00:03:53,000
+The information about the user or some error happened on database site or in case you want to take information
+
+58
+00:03:53,000 --> 00:03:55,000
+about user from current obsession.
+
+59
+00:03:55,000 --> 00:03:59,000
+But user is locked out in another Web browser tab.
+
+60
+00:03:59,000 --> 00:04:05,000
+I can continue if you want, but I want you to understand that there are always chances that something
+
+61
+00:04:05,000 --> 00:04:05,000
+will go wrong.
+
+62
+00:04:06,000 --> 00:04:10,000
+And at the end of the day, user variable will reference to the null.
+
+63
+00:04:11,000 --> 00:04:12,000
+When will call mascot's on?
+
+64
+00:04:12,000 --> 00:04:13,000
+No reference.
+
+65
+00:04:13,000 --> 00:04:15,000
+We are going to have a new pointer exception.
+
+66
+00:04:16,000 --> 00:04:18,000
+Here's an example and main method.
+
+67
+00:04:18,000 --> 00:04:22,000
+You can see that I created a user variable that is reference to non-value.
+
+68
+00:04:23,000 --> 00:04:28,000
+That is just for the sake of example, in real life in this line can be retrieved the user from the
+
+69
+00:04:28,000 --> 00:04:32,000
+database or from the session for this example.
+
+70
+00:04:32,000 --> 00:04:33,000
+It doesn't matter.
+
+71
+00:04:33,000 --> 00:04:36,000
+And here I have order price.
+
+72
+00:04:36,000 --> 00:04:39,000
+I want to charge my user during the checkout.
+
+73
+00:04:39,000 --> 00:04:41,000
+I passed this variable to the it.
+
+74
+00:04:42,000 --> 00:04:43,000
+Can you guess what will happen?
+
+75
+00:04:44,000 --> 00:04:45,000
+You are right.
+
+76
+00:04:45,000 --> 00:04:48,000
+My program will be terminated because of Northpoint exception.
+
+77
+00:04:49,000 --> 00:04:53,000
+Let me run this program to prove this and here is no point the exception.
+
+78
+00:04:53,000 --> 00:05:01,000
+As I promised, I have it because I tried to call method some behavior on the object that doesn't exist.
+
+79
+00:05:02,000 --> 00:05:05,000
+So there are no methods for new values.
+
+80
+00:05:05,000 --> 00:05:12,000
+This is also exceptional case and our program program can't understand what it has to do in case there
+
+81
+00:05:12,000 --> 00:05:13,000
+is no object.
+
+82
+00:05:14,000 --> 00:05:19,000
+And now, when you understood what an exception is, let's categorize them.
+
+83
+00:05:20,000 --> 00:05:21,000
+There are two groups.
+
+84
+00:05:21,000 --> 00:05:23,000
+Have exceptions checked and checked.
+
+85
+00:05:23,000 --> 00:05:25,000
+What is the difference between them?
+
+86
+00:05:25,000 --> 00:05:28,000
+Let me explain in simple words, no point.
+
+87
+00:05:28,000 --> 00:05:31,000
+The exception that you saw is unchecked exception.
+
+88
+00:05:32,000 --> 00:05:34,000
+It isn't checked during compilation time.
+
+89
+00:05:35,000 --> 00:05:38,000
+Moreover, why it should be checked at compile time.
+
+90
+00:05:38,000 --> 00:05:45,000
+If a developer wants to call Masset on some object developer should ensure that the rest of the program
+
+91
+00:05:45,000 --> 00:05:47,000
+is written in the way to pass.
+
+92
+00:05:47,000 --> 00:05:50,000
+Not no value to this method.
+
+93
+00:05:50,000 --> 00:05:55,000
+And if there is now there is no error of user interaction with the program.
+
+94
+00:05:55,000 --> 00:05:58,000
+There is a defect in the way how program is written.
+
+95
+00:05:59,000 --> 00:06:04,000
+On the other hand, check the exception is an exceptional case that is checked during compilation time.
+
+96
+00:06:05,000 --> 00:06:11,000
+For example, user pass the filename to read from these kind of errors is checked at compile time.
+
+97
+00:06:12,000 --> 00:06:12,000
+Why?
+
+98
+00:06:13,000 --> 00:06:19,000
+Because in this case there could be case when the user will pass the filename that doesn't exist and
+
+99
+00:06:19,000 --> 00:06:23,000
+this case is obvious and it doesn't depend on developer.
+
+100
+00:06:23,000 --> 00:06:29,000
+So check the exceptions exist to predict errors of user interaction with the program and they can be
+
+101
+00:06:29,000 --> 00:06:32,000
+verified at compile time and check.
+
+102
+00:06:32,000 --> 00:06:38,000
+The exceptions usually appear during the runtime and can't be checked beforehand.
+
+103
+00:06:38,000 --> 00:06:42,000
+Can you understand now what checked and checked exceptions are?
+
+104
+00:06:43,000 --> 00:06:49,000
+You already saw no pointer exception and understood and checked exceptions before learning of Iraqi
+
+105
+00:06:49,000 --> 00:06:50,000
+exceptions and details.
+
+106
+00:06:50,000 --> 00:06:54,000
+I'm one of you understand example of checked exception.
+
+107
+00:06:54,000 --> 00:07:00,000
+Sheizaf files class that contains Massud to read the content of the files and write content through
+
+108
+00:07:00,000 --> 00:07:01,000
+the files.
+
+109
+00:07:01,000 --> 00:07:08,000
+Imagine that we want to read text from file and here instead of this text, it can be that I have some
+
+110
+00:07:08,000 --> 00:07:11,000
+variables that is passed to my program by user, for example.
+
+111
+00:07:11,000 --> 00:07:19,000
+And you can see that in this case there is a compilation error unhandled exception of Type II or exception.
+
+112
+00:07:19,000 --> 00:07:26,000
+And you can see that compiler checks a potential exception and compiler insists on Hanlon's exception.
+
+113
+00:07:27,000 --> 00:07:32,000
+In other words, Compiler wants us to write the code here that would tell what to do in case the file
+
+114
+00:07:32,000 --> 00:07:33,000
+wasn't found.
+
+115
+00:07:34,000 --> 00:07:38,000
+So one of our tasks today also to learn how to handle exceptions in Java.
+
+116
+00:07:38,000 --> 00:07:44,000
+But before that, I want to complete the topic of exceptions in Iraq to make sure you understood it.
+
+117
+00:07:45,000 --> 00:07:51,000
+So you already shown real examples of what is checked and unchecked exceptions and what does that mean?
+
+118
+00:07:51,000 --> 00:07:57,000
+Now, let's look at exceptions, the Iraqis to understand what types of exceptions exist and whether
+
+119
+00:07:57,000 --> 00:07:58,000
+they are checked on, checked.
+
+120
+00:07:59,000 --> 00:08:02,000
+And you already know everything in Java is an object.
+
+121
+00:08:02,000 --> 00:08:06,000
+That means how exceptions are also objects of specific type.
+
+122
+00:08:07,000 --> 00:08:15,000
+That's why on this slide, you can see Iraqi of classes that are used to create exception objects on
+
+123
+00:08:15,000 --> 00:08:16,000
+top of the Iraqi.
+
+124
+00:08:16,000 --> 00:08:22,000
+We have Straubel class that is basic class for all exceptions and instances of this type.
+
+125
+00:08:22,000 --> 00:08:23,000
+I checked exceptions.
+
+126
+00:08:24,000 --> 00:08:27,000
+Throw will is extended by two Ozeki types.
+
+127
+00:08:27,000 --> 00:08:33,000
+They are error and exception, error type and all the descendants unchecked.
+
+128
+00:08:33,000 --> 00:08:34,000
+Why?
+
+129
+00:08:34,000 --> 00:08:40,000
+Because errors are type of exceptional cases in our program execution when something went completely
+
+130
+00:08:40,000 --> 00:08:43,000
+wrong and there is no chance to fix this already.
+
+131
+00:08:44,000 --> 00:08:50,000
+There is no need to handle this type of exceptional case because you even won't be able to do anything,
+
+132
+00:08:51,000 --> 00:08:53,000
+for example, out of memory error.
+
+133
+00:08:53,000 --> 00:08:59,000
+If you are in the position when you run out of memory, there is even no memory for you to create a
+
+134
+00:08:59,000 --> 00:09:00,000
+new object.
+
+135
+00:09:00,000 --> 00:09:01,000
+This makes sense.
+
+136
+00:09:02,000 --> 00:09:04,000
+Another example is stack overflow error.
+
+137
+00:09:05,000 --> 00:09:06,000
+It is thrown by GM.
+
+138
+00:09:06,000 --> 00:09:10,000
+When Stack memory's finished, Sarat Das error is thrown.
+
+139
+00:09:10,000 --> 00:09:15,000
+When you try to invoke a method on the threat of executions, it was already stopped.
+
+140
+00:09:15,000 --> 00:09:18,000
+And again, there is nothing you can do about this.
+
+141
+00:09:18,000 --> 00:09:26,000
+That's why all errors and checked and another Iraqi is Iraqi of exception types on the sense of exception
+
+142
+00:09:26,000 --> 00:09:30,000
+type beside the sentence of runtime exception type.
+
+143
+00:09:30,000 --> 00:09:34,000
+I checked and only runtime exception was its descendants is unchecked.
+
+144
+00:09:35,000 --> 00:09:37,000
+That is something that we just have to remember.
+
+145
+00:09:38,000 --> 00:09:45,000
+I know that this might seem not logical to you, but it is as it is, the most popular checked exceptions
+
+146
+00:09:45,000 --> 00:09:51,000
+that extended from exception type a group of I o exceptions, those exceptions that are associated with
+
+147
+00:09:51,000 --> 00:09:53,000
+input output streams.
+
+148
+00:09:53,000 --> 00:09:56,000
+Also, there are a group of checked Ezekial exceptions.
+
+149
+00:09:57,000 --> 00:10:01,000
+Additionally, you can explore Iraqian your source code edit by reviewing.
+
+150
+00:10:01,000 --> 00:10:08,000
+Iraq exceptions, if you missed the lesson when I explained how to do that, I will show you this in
+
+151
+00:10:08,000 --> 00:10:14,000
+the minute and runtime exceptions, those exceptions that are not checked by the compiler during the
+
+152
+00:10:14,000 --> 00:10:20,000
+compilation process, there are such exceptions as no pointer exception as we already sort of the arithmetic
+
+153
+00:10:20,000 --> 00:10:21,000
+exception.
+
+154
+00:10:21,000 --> 00:10:28,000
+So that's when we divided into zero class cast exceptions at the throne when it is not possible to cast
+
+155
+00:10:28,000 --> 00:10:30,000
+types illegal argument exception.
+
+156
+00:10:30,000 --> 00:10:34,000
+No such aliment exception array index out of bounds exception.
+
+157
+00:10:35,000 --> 00:10:39,000
+Those are all unchecked exceptions that are consequences of development errors.
+
+158
+00:10:40,000 --> 00:10:48,000
+Compiler won't be able to check those because those that can be identified only during the runtime.
+
+159
+00:10:48,000 --> 00:10:55,000
+Is it clear also now when we learned a hierarchy of exceptions, it is time to start look at examples
+
+160
+00:10:55,000 --> 00:10:58,000
+and understand how we can handle exceptions.
+
+161
+00:10:58,000 --> 00:11:04,000
+By the way, before we start, I promised to show you how you can explore type hierarchy in idea.
+
+162
+00:11:04,000 --> 00:11:10,000
+First of all, I open a type, I press control shift and simultaneously to open exception type.
+
+163
+00:11:11,000 --> 00:11:15,000
+And when I open the exception type, I press F for key.
+
+164
+00:11:16,000 --> 00:11:22,000
+And here on the left you can see that I opened type Iraqi and I can scroll and navigate here to explore
+
+165
+00:11:22,000 --> 00:11:24,000
+hierarchy of type exception.
+
+166
+00:11:25,000 --> 00:11:27,000
+Hobbs's will help you during your self application.
+
+167
+00:11:28,000 --> 00:11:30,000
+And now let's get back to exceptions handlin.
+
+168
+00:11:31,000 --> 00:11:35,000
+As we already discussed, there is not so much sense to handle and exception.
+
+169
+00:11:36,000 --> 00:11:39,000
+You still can do that for some specific reasons if you want.
+
+170
+00:11:39,000 --> 00:11:45,000
+But in most cases it is better to fix your code, not face with runtime exceptions at all.
+
+171
+00:11:45,000 --> 00:11:52,000
+That's why during the next examples, I'm going to use checked exceptions for the purposes the remember
+
+172
+00:11:52,000 --> 00:11:55,000
+example with reading files that doesn't exist.
+
+173
+00:11:56,000 --> 00:11:59,000
+Let me show you now how we can handle that exception.
+
+174
+00:11:59,000 --> 00:12:04,000
+You have to surround the code that potentially can throw an exception with try catch block.
+
+175
+00:12:05,000 --> 00:12:06,000
+The syntax is simple.
+
+176
+00:12:07,000 --> 00:12:07,000
+You're right.
+
+177
+00:12:07,000 --> 00:12:09,000
+Try keyword followed by braze.
+
+178
+00:12:10,000 --> 00:12:14,000
+After that goes code that potentially can throw an exception.
+
+179
+00:12:14,000 --> 00:12:21,000
+And after that you write catch keyword and declare a local variable of type that you want to catch.
+
+180
+00:12:21,000 --> 00:12:29,000
+In our particular case, we want to catch I o exception in case exceptions will be thrown will get into
+
+181
+00:12:29,000 --> 00:12:30,000
+this block.
+
+182
+00:12:30,000 --> 00:12:39,000
+So here object of I o exception will be created in this local variable will be used to get access to
+
+183
+00:12:39,000 --> 00:12:40,000
+the exception object.
+
+184
+00:12:41,000 --> 00:12:44,000
+Why do I need this in real life.
+
+185
+00:12:44,000 --> 00:12:46,000
+You use reference to the exception.
+
+186
+00:12:46,000 --> 00:12:53,000
+Object to look stack trace interviewed later here for the sake of example, I retrieve an array of stack
+
+187
+00:12:53,000 --> 00:12:55,000
+trace elements and print it in one line.
+
+188
+00:12:56,000 --> 00:12:59,000
+Also you can get the root cause of the error in case there are any.
+
+189
+00:13:00,000 --> 00:13:05,000
+I'll get mad if there is any further debugging purposes we can print, stack, trace to console.
+
+190
+00:13:06,000 --> 00:13:12,000
+Let me run this program to show you that we enter it catch block and here you can see text that we printed
+
+191
+00:13:12,000 --> 00:13:14,000
+to console from our catch block.
+
+192
+00:13:15,000 --> 00:13:18,000
+Can I understand now how you can catch exceptions?
+
+193
+00:13:18,000 --> 00:13:21,000
+If yes, then let's press it now.
+
+194
+00:13:21,000 --> 00:13:23,000
+Let me show you another example.
+
+195
+00:13:23,000 --> 00:13:28,000
+There is another syntax that allows you to use multiple exceptions in catch clause.
+
+196
+00:13:29,000 --> 00:13:30,000
+Let me open another file.
+
+197
+00:13:31,000 --> 00:13:38,000
+Imagine that you wrote code to handle an exception, but now we also have code to get connection to
+
+198
+00:13:38,000 --> 00:13:39,000
+the database.
+
+199
+00:13:39,000 --> 00:13:43,000
+This Masset get connection also can throw an exception.
+
+200
+00:13:44,000 --> 00:13:47,000
+That's why you have to handle potential Ezekial exception.
+
+201
+00:13:48,000 --> 00:13:50,000
+There are two options to do that.
+
+202
+00:13:50,000 --> 00:13:55,000
+You can add an exception to existing clause like this by using or operator.
+
+203
+00:13:56,000 --> 00:14:03,000
+In this case, I tell that this variable E will be either of Type II or exception or Ezekial exception
+
+204
+00:14:03,000 --> 00:14:06,000
+because in the case exception will be thrown in.
+
+205
+00:14:06,000 --> 00:14:11,000
+This line will instantly get to the cadge block and we will catch I.
+
+206
+00:14:11,000 --> 00:14:17,000
+O exception and case exception will happen and this line will get to catch block and will have Ezekial
+
+207
+00:14:17,000 --> 00:14:18,000
+exception.
+
+208
+00:14:18,000 --> 00:14:25,000
+This syntax works just fine if you want to program the same behavior for multiple errors, for example,
+
+209
+00:14:26,000 --> 00:14:28,000
+if have one, just log error and that's it.
+
+210
+00:14:29,000 --> 00:14:34,000
+But in case you want to implement different logic, to handle different exceptions, you have to implement
+
+211
+00:14:34,000 --> 00:14:35,000
+different cadge block.
+
+212
+00:14:36,000 --> 00:14:42,000
+For example, in the first case, let's notify users that this file doesn't exist and ask user to provide
+
+213
+00:14:42,000 --> 00:14:44,000
+a path to a new file.
+
+214
+00:14:44,000 --> 00:14:50,000
+In either case, let's notify users that there is an error with database and there is nothing.
+
+215
+00:14:50,000 --> 00:14:53,000
+What user can do about this doesn't make sense.
+
+216
+00:14:53,000 --> 00:14:59,000
+Can you understand now when to use sketchbook with multiple exception types and when to use multiple
+
+217
+00:14:59,000 --> 00:15:01,000
+catch blocks also?
+
+218
+00:15:01,000 --> 00:15:02,000
+Let's move on.
+
+219
+00:15:03,000 --> 00:15:08,000
+There is one more rule for multiple catch blocks in case there are potentially two types of exceptions
+
+220
+00:15:08,000 --> 00:15:15,000
+that are from the same Iraqi, you have to specify the more specific type first and only after that
+
+221
+00:15:15,000 --> 00:15:17,000
+specified the most generic time.
+
+222
+00:15:17,000 --> 00:15:19,000
+Let me show you this one example.
+
+223
+00:15:19,000 --> 00:15:25,000
+Imagine that this line can throw an exception and constructor of a file reader can throw a file not
+
+224
+00:15:25,000 --> 00:15:28,000
+found exception, and we can write multiple catch blocks.
+
+225
+00:15:29,000 --> 00:15:35,000
+But important thing here is that Philmont found exception is a shell type of IO exception.
+
+226
+00:15:36,000 --> 00:15:40,000
+When exceptions will be thrown, each catch close will be checked.
+
+227
+00:15:40,000 --> 00:15:47,000
+That's why you can specify Kedge Block with all exceptions, before Kedge Block, which Philmont found
+
+228
+00:15:47,000 --> 00:15:47,000
+exception.
+
+229
+00:15:48,000 --> 00:15:54,000
+In this case, you're going to have compilation error unreachable catch block because exceptions will
+
+230
+00:15:54,000 --> 00:15:58,000
+be handled by the first KEDGE block with generic exception.
+
+231
+00:15:58,000 --> 00:16:02,000
+Type Lekman common this code to show you this compilation error.
+
+232
+00:16:02,000 --> 00:16:06,000
+And here you can see unreachable kedge block and error.
+
+233
+00:16:06,000 --> 00:16:12,000
+This example is very popular in tests during the interview, so please remember that.
+
+234
+00:16:12,000 --> 00:16:17,000
+OK, if you understood how to work with multiple kedge blocks, let's look at the next example.
+
+235
+00:16:18,000 --> 00:16:22,000
+Before the lesson, I also created another file to them and use the next case.
+
+236
+00:16:23,000 --> 00:16:28,000
+Now I want to review as you try Keje finally construction by default.
+
+237
+00:16:28,000 --> 00:16:31,000
+Finally Blac will be executed with and without exception.
+
+238
+00:16:32,000 --> 00:16:33,000
+Here you can see the same case.
+
+239
+00:16:33,000 --> 00:16:35,000
+But with Finally Block.
+
+240
+00:16:35,000 --> 00:16:39,000
+Let me around this program again and here and console.
+
+241
+00:16:39,000 --> 00:16:44,000
+You can see the text that we printed from our final block right after the stack trace.
+
+242
+00:16:44,000 --> 00:16:47,000
+In some particular case you can use try finally block.
+
+243
+00:16:48,000 --> 00:16:52,000
+Let me comment these lines and you can see there is no compilation error.
+
+244
+00:16:53,000 --> 00:16:59,000
+Usually we use final blog to perform operations that should be executed no matter what happened.
+
+245
+00:17:00,000 --> 00:17:02,000
+Is the exception happened or not?
+
+246
+00:17:02,000 --> 00:17:04,000
+The code from Final Lock should be executed.
+
+247
+00:17:05,000 --> 00:17:09,000
+For example, in the past, final block used to close input output streams.
+
+248
+00:17:10,000 --> 00:17:14,000
+Now Thrivers Resources Block is used to close resources automatically.
+
+249
+00:17:14,000 --> 00:17:20,000
+I'll show you that during the lesson about input output streams today, you can use final block to release
+
+250
+00:17:20,000 --> 00:17:22,000
+some critical resources.
+
+251
+00:17:23,000 --> 00:17:29,000
+Finally, Block will be executed all the times, but there are some exceptions that can prevent you
+
+252
+00:17:29,000 --> 00:17:29,000
+from executing.
+
+253
+00:17:29,000 --> 00:17:31,000
+Finally, block till the end.
+
+254
+00:17:31,000 --> 00:17:34,000
+Let's quickly review these cases.
+
+255
+00:17:34,000 --> 00:17:40,000
+The first case finally block won't be executed in case program is stopped and finally block.
+
+256
+00:17:41,000 --> 00:17:43,000
+That is the case when we stopped giving.
+
+257
+00:17:43,000 --> 00:17:50,000
+Our final block won't be executed till the end in case some exception will happen inside the final block.
+
+258
+00:17:51,000 --> 00:17:57,000
+Also, in case you have noticed, writing the program final block will be executed till the end in case
+
+259
+00:17:57,000 --> 00:17:58,000
+Read will be terminated.
+
+260
+00:17:59,000 --> 00:18:02,000
+Now, I believe you know everything about final blocks.
+
+261
+00:18:02,000 --> 00:18:03,000
+Let's move on.
+
+262
+00:18:03,000 --> 00:18:07,000
+I want to tell you now about Suros Keever, for example.
+
+263
+00:18:07,000 --> 00:18:12,000
+Let me open the source code of Red Alliance Macit here you can see Suros Keevers.
+
+264
+00:18:13,000 --> 00:18:14,000
+What does that mean?
+
+265
+00:18:14,000 --> 00:18:20,000
+That means that this Masset potentially can throw an exception in their custom matters.
+
+266
+00:18:20,000 --> 00:18:27,000
+You would also like to specify that some suros exception if you want to warn all clients of your code
+
+267
+00:18:27,000 --> 00:18:29,000
+to handle some specific cases.
+
+268
+00:18:30,000 --> 00:18:33,000
+In this case it is specified that I have to handle I o exception.
+
+269
+00:18:34,000 --> 00:18:39,000
+Now let's create custom method and declare Tetsuro exception.
+
+270
+00:18:39,000 --> 00:18:43,000
+I open another demo files that I prepared before this lesson.
+
+271
+00:18:43,000 --> 00:18:48,000
+You will be able to find reference to all files from the lesson in the lesson attachments.
+
+272
+00:18:49,000 --> 00:18:51,000
+In this example in class throws Damos.
+
+273
+00:18:51,000 --> 00:18:55,000
+I have some methods that throws file not found exception.
+
+274
+00:18:55,000 --> 00:19:02,000
+After that I create an object of throws them a class and call some Macit Letterman.
+
+275
+00:19:02,000 --> 00:19:09,000
+Command this line and you can see that there is a compilation error because I have to handle potential
+
+276
+00:19:09,000 --> 00:19:15,000
+error and I have to do that even in case I don't have any code in this matter at all.
+
+277
+00:19:15,000 --> 00:19:21,000
+So this declaration is like a warning for everyone who is going to use this method.
+
+278
+00:19:22,000 --> 00:19:27,000
+There is some rule that we all have to know while overwriting methods that throw exception.
+
+279
+00:19:28,000 --> 00:19:31,000
+Let me show it to you on the example in this file.
+
+280
+00:19:31,000 --> 00:19:36,000
+For the sake of the demo, I created one more class that extends through them a class.
+
+281
+00:19:37,000 --> 00:19:39,000
+And I want to write some method.
+
+282
+00:19:39,000 --> 00:19:45,000
+And you can see that I don't necessarily have to add Suros declaration here, and that is fine.
+
+283
+00:19:45,000 --> 00:19:49,000
+I can Atheros declaration if I want one second.
+
+284
+00:19:49,000 --> 00:19:50,000
+Let me add it here.
+
+285
+00:19:51,000 --> 00:19:57,000
+Now, this method also suros file and found exception Massaro as an exception.
+
+286
+00:19:58,000 --> 00:19:59,000
+What about I o exception.
+
+287
+00:20:00,000 --> 00:20:00,000
+Let me try.
+
+288
+00:20:01,000 --> 00:20:07,000
+And now we can see compilation error, exception, IO exception is not compatible with throws clothes
+
+289
+00:20:07,000 --> 00:20:09,000
+and throws them as a method.
+
+290
+00:20:09,000 --> 00:20:11,000
+Now, you know the rule.
+
+291
+00:20:11,000 --> 00:20:17,000
+If you want to declare that some method throws exception and one of the rules for overridden Macit,
+
+292
+00:20:18,000 --> 00:20:23,000
+you have to specify compatible type of exception was the one from original master.
+
+293
+00:20:23,000 --> 00:20:31,000
+So in this case we can specify is a file not found exception or some child of violence found exception.
+
+294
+00:20:32,000 --> 00:20:38,000
+This type of exception doesn't have any child types, but we can create if we want to remove this rose
+
+295
+00:20:38,000 --> 00:20:39,000
+declaration.
+
+296
+00:20:40,000 --> 00:20:46,000
+Now, you know what Sarah's key word means, what to do in case you want to start program execution,
+
+297
+00:20:46,000 --> 00:20:51,000
+in case there is some error, you have to throw an exception how to do that.
+
+298
+00:20:52,000 --> 00:20:56,000
+Let me show it to you and navigate to file was the new example.
+
+299
+00:20:56,000 --> 00:21:01,000
+Imagine that we have mastered that can transfer money from one account to another.
+
+300
+00:21:01,000 --> 00:21:03,000
+It is called transfer money.
+
+301
+00:21:04,000 --> 00:21:09,000
+It gets account from account to and money to transfer amount.
+
+302
+00:21:09,000 --> 00:21:14,000
+By the way, for the sake of the drama, I created account class here in the same file.
+
+303
+00:21:14,000 --> 00:21:21,000
+And the rule of thumb is to validate that all arguments are valid and we can work with them here.
+
+304
+00:21:21,000 --> 00:21:25,000
+You can see if close where I check that from.
+
+305
+00:21:25,000 --> 00:21:32,000
+And two accounts are not you and that from account has enough money to perform a transaction in case
+
+306
+00:21:32,000 --> 00:21:34,000
+is in one of these statements is true.
+
+307
+00:21:34,000 --> 00:21:41,000
+That means that one of the argument is invalid and we can't proceed with this mass execution.
+
+308
+00:21:41,000 --> 00:21:46,000
+That's why I want to stop program execution with illegal argument exception.
+
+309
+00:21:46,000 --> 00:21:50,000
+I read through keyword and create an instance of a legal argument exception.
+
+310
+00:21:51,000 --> 00:21:56,000
+I can use any instance of any type that extends through class after a keyword.
+
+311
+00:21:56,000 --> 00:22:00,000
+In this particular case, I use already predefined type of exception.
+
+312
+00:22:01,000 --> 00:22:05,000
+Let me execute program and call this method with no accounts.
+
+313
+00:22:05,000 --> 00:22:08,000
+And I can see here a legal argument exception.
+
+314
+00:22:09,000 --> 00:22:11,000
+That is how you can throw an exception.
+
+315
+00:22:11,000 --> 00:22:13,000
+Your wish is that clear.
+
+316
+00:22:14,000 --> 00:22:19,000
+Take pause and think for a second about this construction if you understood it.
+
+317
+00:22:19,000 --> 00:22:26,000
+Let me explain this and next thing, each type of stromal has constructor that takes string as an argument.
+
+318
+00:22:26,000 --> 00:22:29,000
+This string is used as a message to our exception.
+
+319
+00:22:30,000 --> 00:22:37,000
+Let me add here in constructor, same message, for example, invalid arguments and let me execute this
+
+320
+00:22:37,000 --> 00:22:38,000
+program again.
+
+321
+00:22:38,000 --> 00:22:42,000
+And here in the sector race, you can see explanatory message.
+
+322
+00:22:42,000 --> 00:22:49,000
+Moreover, in case someone would like to catch this exception, each will has mastered get message.
+
+323
+00:22:49,000 --> 00:22:51,000
+This can return the string.
+
+324
+00:22:51,000 --> 00:22:54,000
+But this is only in case you want to retrieve this message.
+
+325
+00:22:55,000 --> 00:22:56,000
+What else we can do?
+
+326
+00:22:57,000 --> 00:23:01,000
+Sometimes developers drop checked exception with and checked.
+
+327
+00:23:01,000 --> 00:23:08,000
+When we have to do this, we have to do this in case when we have to throw exceptions during the implementation
+
+328
+00:23:08,000 --> 00:23:11,000
+of the method that does not allow us to throw exceptions.
+
+329
+00:23:12,000 --> 00:23:12,000
+But we should.
+
+330
+00:23:13,000 --> 00:23:19,000
+This is really a specific case, but will face with it the first time when we will learn the same topic.
+
+331
+00:23:20,000 --> 00:23:20,000
+I will explain.
+
+332
+00:23:20,000 --> 00:23:21,000
+Is it run?
+
+333
+00:23:21,000 --> 00:23:26,000
+Masset in Runnable interface doesn't throw exceptions, but sometimes we have to.
+
+334
+00:23:27,000 --> 00:23:29,000
+There are also some other cases.
+
+335
+00:23:30,000 --> 00:23:33,000
+I want you to learn this trick and use it when it is needed.
+
+336
+00:23:34,000 --> 00:23:37,000
+Let me come on this line and explain how it works.
+
+337
+00:23:38,000 --> 00:23:42,000
+Each Wrobel type has a constructor that takes us as Wrobel as an argument.
+
+338
+00:23:43,000 --> 00:23:50,000
+This is used when we want to set an original course for the exception here I a runtime exception and
+
+339
+00:23:50,000 --> 00:23:53,000
+posta is constructor a regional exception.
+
+340
+00:23:54,000 --> 00:23:57,000
+Let me run the program now and here and council.
+
+341
+00:23:57,000 --> 00:24:03,000
+You can see that runtime exception was caused by file not found exception.
+
+342
+00:24:03,000 --> 00:24:08,000
+In case somebody would catch this error, he can extract course.
+
+343
+00:24:08,000 --> 00:24:15,000
+Every type of Wrobel has a method yet cause that can return the reference to a regional exception.
+
+344
+00:24:15,000 --> 00:24:19,000
+So that's how you can rub checked exception with and checked exception.
+
+345
+00:24:20,000 --> 00:24:27,000
+And the last but not least for today, I want to teach you how to create your custom exceptions in case
+
+346
+00:24:27,000 --> 00:24:33,000
+you want to express some specific case and business logic with your custom type of exception, you have
+
+347
+00:24:33,000 --> 00:24:34,000
+to decide first.
+
+348
+00:24:34,000 --> 00:24:37,000
+You want to create checks or inject exception.
+
+349
+00:24:38,000 --> 00:24:44,000
+To create an unchecked exception, we have to declare our class that extends runtime exception in case
+
+350
+00:24:44,000 --> 00:24:46,000
+we want to implement and checked exception.
+
+351
+00:24:46,000 --> 00:24:52,000
+As I said, let me open a class with declaration of customer exception here we have not enough money
+
+352
+00:24:52,000 --> 00:24:53,000
+exception.
+
+353
+00:24:53,000 --> 00:24:57,000
+It is unchecked because it extends runtime exception.
+
+354
+00:24:57,000 --> 00:25:03,000
+In case you want to implement checked exception, you have to just extend your custom class from exception
+
+355
+00:25:03,000 --> 00:25:04,000
+type.
+
+356
+00:25:04,000 --> 00:25:07,000
+That's all easy, don't you think?
+
+357
+00:25:07,000 --> 00:25:12,000
+So for the sake of our Demmer, I'm going to keep not enough money exception unchecked.
+
+358
+00:25:13,000 --> 00:25:18,000
+And now when we have our custom exception, let me look at another version of the transfer money.
+
+359
+00:25:19,000 --> 00:25:24,000
+And this version was throw a legal argument, exceptional case from and to accounts.
+
+360
+00:25:24,000 --> 00:25:30,000
+And now and in case there is not enough money on the account from any transaction, we throw our custom
+
+361
+00:25:30,000 --> 00:25:32,000
+exception, not enough money exception.
+
+362
+00:25:32,000 --> 00:25:38,000
+Hobe, this example helps you understand when we might want to use custom exceptions and how we can
+
+363
+00:25:38,000 --> 00:25:39,000
+do that.
+
+364
+00:25:40,000 --> 00:25:42,000
+Now, let's review what we have learned today.
+
+365
+00:25:43,000 --> 00:25:44,000
+Today, we learned a lot of things.
+
+366
+00:25:45,000 --> 00:25:48,000
+Now, you know, what exceptions are we learned in Iraq?
+
+367
+00:25:48,000 --> 00:25:54,000
+Have exceptions also, you learned what checked and checked exceptions are one examples.
+
+368
+00:25:54,000 --> 00:25:56,000
+We learned how to handle exceptions.
+
+369
+00:25:56,000 --> 00:26:02,000
+You saw how we can use try to catch blogs and try catch finally blogs to handle exceptions.
+
+370
+00:26:02,000 --> 00:26:07,000
+In this lesson, you learned what Suros keywords is and how we can use it.
+
+371
+00:26:07,000 --> 00:26:13,000
+We learned how to throw exceptions when we need, and at the end of the lesson we learned how to create
+
+372
+00:26:13,000 --> 00:26:16,000
+our custom checked or unchecked exception.
+
+373
+00:26:16,000 --> 00:26:19,000
+Hope you found this lesson useful for you.
+
+374
+00:26:19,000 --> 00:26:21,000
+Thanks a lot for your attention.
+
+375
+00:26:21,000 --> 00:26:23,000
+See you in the next lesson.
+
diff --git a/18 - Excpetion Handling/001 Source-code-of-all-examples-from-the-lesson.url b/18 - Excpetion Handling/001 Source-code-of-all-examples-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..2ea270b905c0071e3f7ee05ec14de1b9e1780bac
--- /dev/null
+++ b/18 - Excpetion Handling/001 Source-code-of-all-examples-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/exceptions
\ No newline at end of file
diff --git a/18 - Excpetion Handling/external-links.txt b/18 - Excpetion Handling/external-links.txt
new file mode 100644
index 0000000000000000000000000000000000000000..3d0b06060de71800849ebf7fa2ba0448cfbe4285
--- /dev/null
+++ b/18 - Excpetion Handling/external-links.txt
@@ -0,0 +1,3 @@
+
+001 Source-code-of-all-examples-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/exceptions
diff --git a/19 - Java Collections Framework/001 Java Collections Framework Overview_en.srt b/19 - Java Collections Framework/001 Java Collections Framework Overview_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..b48e46709af93a7ba361129c862aa0b73ddcbeea
--- /dev/null
+++ b/19 - Java Collections Framework/001 Java Collections Framework Overview_en.srt
@@ -0,0 +1,508 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello.
+
+2
+00:00:06,000 --> 00:00:10,000
+Students in this region, I'm going to make overview of Java collections framework.
+
+3
+00:00:10,000 --> 00:00:15,000
+I want you to understand general structure of Java collections framework before we start going deeper
+
+4
+00:00:15,000 --> 00:00:16,000
+in the details.
+
+5
+00:00:16,000 --> 00:00:18,000
+And here's our agenda for the day.
+
+6
+00:00:18,000 --> 00:00:21,000
+We'll talk about what GSF includes in this lesson.
+
+7
+00:00:21,000 --> 00:00:24,000
+You are going to learn the difference between collections and the rates.
+
+8
+00:00:24,000 --> 00:00:28,000
+We are going to discuss what advantages collections have over their rates.
+
+9
+00:00:28,000 --> 00:00:34,000
+Also, during the lesson, we are going to talk about two separate Iraqis in Java collections framework
+
+10
+00:00:34,000 --> 00:00:37,000
+that Zeta's Iraqi of collections and hierarchy of maps.
+
+11
+00:00:37,000 --> 00:00:39,000
+And what are the difference between them?
+
+12
+00:00:39,000 --> 00:00:44,000
+I believe this is going to help you significantly to understand the core structure and the next lessons
+
+13
+00:00:44,000 --> 00:00:45,000
+in general.
+
+14
+00:00:45,000 --> 00:00:50,000
+So let's start and to start with let's answer the question.
+
+15
+00:00:50,000 --> 00:00:54,000
+What does you see, if I will shut and Java collections framework, if you don't mind.
+
+16
+00:00:54,000 --> 00:00:56,000
+What does it consist of?
+
+17
+00:00:56,000 --> 00:01:02,000
+GCF is a unified name for the group of the types and algorithms that are developed to store elements
+
+18
+00:01:02,000 --> 00:01:05,000
+in them and perform manipulations on the group of the objects.
+
+19
+00:01:06,000 --> 00:01:10,000
+GCF includes next things, collection interfaces.
+
+20
+00:01:10,000 --> 00:01:16,000
+These are abstract data types that describes the type that my group, multiple elements in the single
+
+21
+00:01:16,000 --> 00:01:21,000
+unit as a software engineer, are going to use collections all the times to perform operations with
+
+22
+00:01:21,000 --> 00:01:26,000
+the group of objects, for example, product list in our Web application.
+
+23
+00:01:26,000 --> 00:01:32,000
+This might be a collection of products in the language of Java, and we could perform operations on
+
+24
+00:01:32,000 --> 00:01:37,000
+the group of the products, for example, search products, or filter them to keep only products that
+
+25
+00:01:37,000 --> 00:01:43,000
+has priced more than ten dollars or split all the group of products on the equal chance to show products
+
+26
+00:01:43,000 --> 00:01:45,000
+page by page and a lot of other things.
+
+27
+00:01:46,000 --> 00:01:49,000
+Can you understand now why we might need collections?
+
+28
+00:01:50,000 --> 00:01:51,000
+You might think.
+
+29
+00:01:51,000 --> 00:01:56,000
+Isn't that the same what we have arrays for take into account you used to raise already?
+
+30
+00:01:56,000 --> 00:02:02,000
+You might think that for the same purposes you would use arrays a bit later when we would talk about
+
+31
+00:02:02,000 --> 00:02:04,000
+advantages of collections of arrays.
+
+32
+00:02:04,000 --> 00:02:10,000
+You would understand why arrays and collections are two different things implementations of collection
+
+33
+00:02:10,000 --> 00:02:16,000
+interfaces, even despite the fact that abstractions for collections looks the same, the implementation
+
+34
+00:02:16,000 --> 00:02:20,000
+of this interface at different and fits for different goals.
+
+35
+00:02:20,000 --> 00:02:26,000
+For example, some collections work the best for adding new elements since the end of the collection,
+
+36
+00:02:26,000 --> 00:02:31,000
+and developers like that collections because of the constant time of retrieving element from them.
+
+37
+00:02:31,000 --> 00:02:36,000
+Are the collections work better when you need to add elements in the middle or at the beginning of the
+
+38
+00:02:36,000 --> 00:02:37,000
+collection?
+
+39
+00:02:38,000 --> 00:02:41,000
+Other collections work the best in the current environment.
+
+40
+00:02:41,000 --> 00:02:46,000
+We are going to learn all of these collections and to understand the difference when to use each collection
+
+41
+00:02:46,000 --> 00:02:47,000
+type.
+
+42
+00:02:48,000 --> 00:02:55,000
+Map interfaces, map interface at different from collections in one important think map is a container
+
+43
+00:02:55,000 --> 00:02:58,000
+that contains pairs of key and value.
+
+44
+00:02:59,000 --> 00:03:05,000
+For example, you may the name of the product category, for example, doors and collections of all
+
+45
+00:03:05,000 --> 00:03:07,000
+doors associated with it.
+
+46
+00:03:07,000 --> 00:03:12,000
+You might have goods category and collection of booths associated with that key.
+
+47
+00:03:13,000 --> 00:03:19,000
+And in case you need to get all doors, you just make a request to the map button on the key to it to
+
+48
+00:03:19,000 --> 00:03:21,000
+retrieve all doors.
+
+49
+00:03:21,000 --> 00:03:22,000
+Does it make sense?
+
+50
+00:03:23,000 --> 00:03:29,000
+Maps are also considered a part of the collections framework because even if they don't have the same
+
+51
+00:03:29,000 --> 00:03:35,000
+interface as collections, they have operations that allow us to view and interact with them the same
+
+52
+00:03:35,000 --> 00:03:36,000
+way as with collections.
+
+53
+00:03:37,000 --> 00:03:43,000
+Implementation of MAP interfaces unions, of course, we are going to discuss different implementations
+
+54
+00:03:43,000 --> 00:03:48,000
+of the map and we are going to understand when we will use each implementation of the map interface.
+
+55
+00:03:49,000 --> 00:03:55,000
+Deprecated collections, deprecated collections are also part of the Java collections framework, despite
+
+56
+00:03:55,000 --> 00:04:00,000
+the fact that it is recommended not to use specific collections sometimes on the Java project.
+
+57
+00:04:00,000 --> 00:04:02,000
+You still going to work with them?
+
+58
+00:04:03,000 --> 00:04:09,000
+Because even nowadays there are a lot of old projects written on Java that require support and maintenance,
+
+59
+00:04:10,000 --> 00:04:11,000
+synchronized collections.
+
+60
+00:04:12,000 --> 00:04:17,000
+There are also special set of collections that are developed to be used in the multithreaded environment.
+
+61
+00:04:17,000 --> 00:04:19,000
+Let me tell you the example to make you understand.
+
+62
+00:04:20,000 --> 00:04:25,000
+Imagine that you have collections of users and one administrator of the website removes the user from
+
+63
+00:04:25,000 --> 00:04:31,000
+the collection and another administrator of the website is iterating over each user in the same collection
+
+64
+00:04:31,000 --> 00:04:33,000
+to update the state of the total.
+
+65
+00:04:33,000 --> 00:04:39,000
+Orders about the conflict might appear when two administrators in the two separate threats of execution
+
+66
+00:04:40,000 --> 00:04:41,000
+would obtain the same collection.
+
+67
+00:04:42,000 --> 00:04:47,000
+In this course, I'm going to tell you how centralized collections work and how to use them.
+
+68
+00:04:48,000 --> 00:04:50,000
+Algorithms also.
+
+69
+00:04:50,000 --> 00:04:56,000
+GCF includes algorithms that are the methods that perform useful computations, such as searching and
+
+70
+00:04:56,000 --> 00:05:03,000
+sorting on objects that implement collection interfaces that algorithms are said to be polymorphic.
+
+71
+00:05:03,000 --> 00:05:08,000
+That is, the same method can be used on many different implementations of the appropriate collection
+
+72
+00:05:08,000 --> 00:05:09,000
+interface.
+
+73
+00:05:10,000 --> 00:05:17,000
+Robbers GCF contains a special wrapper that can turn your regular collection into non modifiable collection
+
+74
+00:05:18,000 --> 00:05:23,000
+or wrapper, that can turn your regular collection into synchronized collection that you can use and
+
+75
+00:05:23,000 --> 00:05:24,000
+will just write an environment.
+
+76
+00:05:25,000 --> 00:05:31,000
+Now, when you know what a collection framework consists of, let's discuss what advantages does it
+
+77
+00:05:31,000 --> 00:05:32,000
+have over race?
+
+78
+00:05:33,000 --> 00:05:36,000
+Let's go over this table to compare collections and race.
+
+79
+00:05:37,000 --> 00:05:41,000
+This table will help you to understand what advantage collections have over race.
+
+80
+00:05:42,000 --> 00:05:48,000
+First of all, you already know that our racing driver have fixed size collections in Java can be extended
+
+81
+00:05:48,000 --> 00:05:49,000
+dynamically.
+
+82
+00:05:49,000 --> 00:05:54,000
+So using collections, there is no need to create new collection and copy the state of the previous
+
+83
+00:05:54,000 --> 00:05:59,000
+collection into the new one when you run out of space in this old collection.
+
+84
+00:05:59,000 --> 00:06:02,000
+There's a significant benefit for the development process.
+
+85
+00:06:03,000 --> 00:06:10,000
+Secondly, our race itself does not have any behavior and algorithms to work with them, for example,
+
+86
+00:06:10,000 --> 00:06:18,000
+a race can't filter themselves or find the first index of appearance of element or keep all elements
+
+87
+00:06:18,000 --> 00:06:25,000
+sorted automatically or have only unique elements and do not add elements that already exist in collection
+
+88
+00:06:25,000 --> 00:06:26,000
+and a lot of other things.
+
+89
+00:06:27,000 --> 00:06:33,000
+If you remember a race class, you may say that some of the algorithms are present in a race class to
+
+90
+00:06:33,000 --> 00:06:34,000
+work with the race.
+
+91
+00:06:34,000 --> 00:06:40,000
+But the amount of operations that you can do with our race class is significantly lower than a number
+
+92
+00:06:40,000 --> 00:06:43,000
+of algorithms that Java collections framework has.
+
+93
+00:06:43,000 --> 00:06:50,000
+And moreover, we mentioned separate class and static methods in a race class that is not the same as
+
+94
+00:06:50,000 --> 00:06:53,000
+behavior of the object like we have in collections.
+
+95
+00:06:54,000 --> 00:07:00,000
+Certainly collections have single API and no matter what is the specifics of each particular implementation
+
+96
+00:07:00,000 --> 00:07:06,000
+of the collection, whether it's stauss only unique elements or supports region of elements during the
+
+97
+00:07:06,000 --> 00:07:08,000
+constant amount of time, it doesn't matter.
+
+98
+00:07:09,000 --> 00:07:11,000
+All collections have common API.
+
+99
+00:07:11,000 --> 00:07:15,000
+What significantly simplifies usage of collections and running them.
+
+100
+00:07:16,000 --> 00:07:21,000
+On the other hand, working with arrays e.g. developer may implement his own application programming
+
+101
+00:07:21,000 --> 00:07:23,000
+interface to interact with a rate.
+
+102
+00:07:23,000 --> 00:07:29,000
+For example, the developer may come up with a method to add a new element in array and extend it in
+
+103
+00:07:29,000 --> 00:07:31,000
+case there is no more Plaisance.
+
+104
+00:07:31,000 --> 00:07:35,000
+Every developer may come up with a specific algorithm.
+
+105
+00:07:35,000 --> 00:07:37,000
+How to clear all elements in array.
+
+106
+00:07:37,000 --> 00:07:42,000
+One developer will just create a new array with the default array size and as a developer would just
+
+107
+00:07:42,000 --> 00:07:48,000
+turn into new values or current elements in array and the already might use a problem and such approach.
+
+108
+00:07:48,000 --> 00:07:52,000
+There is no single API when you are working with arrays.
+
+109
+00:07:53,000 --> 00:07:58,000
+By having such data structures and algorithms as collections, developers may concentrate on the important
+
+110
+00:07:58,000 --> 00:08:03,000
+parts of the program rather than on the low level work and inventions of your.
+
+111
+00:08:04,000 --> 00:08:10,000
+Forcedly, what you need to remember, collections can store only reference types of data collections
+
+112
+00:08:10,000 --> 00:08:12,000
+doesn't work with primitive types of data.
+
+113
+00:08:13,000 --> 00:08:17,000
+If you want to store primitive types of data because of the performance reasons, you still have to
+
+114
+00:08:17,000 --> 00:08:18,000
+use arrays.
+
+115
+00:08:19,000 --> 00:08:21,000
+And last but not the least performance.
+
+116
+00:08:22,000 --> 00:08:26,000
+Usually it is considered the performance of arrays is higher than performance of collections.
+
+117
+00:08:27,000 --> 00:08:32,000
+While this can be true in the modern world, in the most of business cases we are talking about milliseconds
+
+118
+00:08:32,000 --> 00:08:38,000
+difference for standard operations and for standard number of elements in either collection or array.
+
+119
+00:08:38,000 --> 00:08:44,000
+But you have to know about this and now you have the vision of what we are going to learn and what Java
+
+120
+00:08:44,000 --> 00:08:45,000
+collections framework is.
+
+121
+00:08:46,000 --> 00:08:49,000
+As you can see, there are really a lot of things to learn.
+
+122
+00:08:50,000 --> 00:08:52,000
+Right now, let's recap what we have learned today.
+
+123
+00:08:53,000 --> 00:08:57,000
+In this lesson, we learned what Java collections framework contains on the high level.
+
+124
+00:08:57,000 --> 00:09:03,000
+We understand what collections are and how they are different from maps during the last very of the
+
+125
+00:09:03,000 --> 00:09:09,000
+main advantages of collections of arrays and also discussed what advantages arrays have over collections.
+
+126
+00:09:10,000 --> 00:09:11,000
+That's all for now.
+
+127
+00:09:12,000 --> 00:09:15,000
+Thanks a lot for your attention and to you in the next lesson.
+
diff --git a/19 - Java Collections Framework/002 Collection Interface_en.srt b/19 - Java Collections Framework/002 Collection Interface_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..d016481de59d0569322018ab5955a126d74c39fc
--- /dev/null
+++ b/19 - Java Collections Framework/002 Collection Interface_en.srt
@@ -0,0 +1,596 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello.
+
+2
+00:00:06,000 --> 00:00:09,000
+Students, in this lesson, we are going to learn what connections are.
+
+3
+00:00:10,000 --> 00:00:15,000
+This is very important topic because connection interface is implemented by all connections implementations
+
+4
+00:00:15,000 --> 00:00:16,000
+in Java.
+
+5
+00:00:16,000 --> 00:00:23,000
+That's why understanding of collection interface is a key for understanding of all other collections
+
+6
+00:00:23,000 --> 00:00:23,000
+in Java.
+
+7
+00:00:24,000 --> 00:00:28,000
+So today our primary focus is learning of collection interface.
+
+8
+00:00:28,000 --> 00:00:35,000
+I'm going to show you your middle class diagram, will understand what it is and how we can use it in
+
+9
+00:00:35,000 --> 00:00:36,000
+the future.
+
+10
+00:00:36,000 --> 00:00:42,000
+To understand a type structure during the lesson will understand what methods collection interface has
+
+11
+00:00:42,000 --> 00:00:43,000
+and why do we need them.
+
+12
+00:00:44,000 --> 00:00:50,000
+We will review abstract and default methods of collection interface and at the end of the lesson, we'll
+
+13
+00:00:50,000 --> 00:00:52,000
+look at the collection source code.
+
+14
+00:00:52,000 --> 00:00:53,000
+Let's start.
+
+15
+00:00:53,000 --> 00:00:59,000
+I suggest that our lesson from this slide on this slide, you may see visualization of what the collection
+
+16
+00:00:59,000 --> 00:01:02,000
+is to understand collection.
+
+17
+00:01:02,000 --> 00:01:07,000
+Imagine the back, the big back where you may put all your stuff.
+
+18
+00:01:07,000 --> 00:01:15,000
+You might put your product, user card and all other objects, and you can retrieve exactly user or
+
+19
+00:01:15,000 --> 00:01:19,000
+product or cards by its index like you did in array.
+
+20
+00:01:20,000 --> 00:01:25,000
+What you can do is to put all things from your back on the floor and go over them one by one.
+
+21
+00:01:26,000 --> 00:01:31,000
+We're also going to learn in the separate lessons, the specific type that is developed to go over each
+
+22
+00:01:31,000 --> 00:01:32,000
+element.
+
+23
+00:01:32,000 --> 00:01:34,000
+What else we can do with these?
+
+24
+00:01:34,000 --> 00:01:40,000
+Back to answer this question, let's take a look at collection interface and we'll learn what else we
+
+25
+00:01:40,000 --> 00:01:42,000
+can do with our bag of elements.
+
+26
+00:01:43,000 --> 00:01:49,000
+Here is a class diagram we are going to learn with your UML language that is unified model and language
+
+27
+00:01:49,000 --> 00:01:50,000
+in detail a bit later.
+
+28
+00:01:51,000 --> 00:01:54,000
+But this is what is used to call class diagram.
+
+29
+00:01:54,000 --> 00:01:59,000
+And while being a software engineer, you are going to see such diagrams very often.
+
+30
+00:02:00,000 --> 00:02:01,000
+What do we have here?
+
+31
+00:02:01,000 --> 00:02:06,000
+We can see that collection interface extends a terrible interface, a terrible interface.
+
+32
+00:02:06,000 --> 00:02:10,000
+We are going to learn in a separate lesson, the same as Iterator.
+
+33
+00:02:10,000 --> 00:02:17,000
+But in short, this is an interface that stands on top of all collections interfaces to make sure that
+
+34
+00:02:17,000 --> 00:02:23,000
+it will be possible to iterate over each element in each implementation of collection interface.
+
+35
+00:02:24,000 --> 00:02:29,000
+Today we are going to focus on collection interface and we will start learning it from this class diagram.
+
+36
+00:02:30,000 --> 00:02:32,000
+Let me give you a quick introduction regarding symbols here.
+
+37
+00:02:33,000 --> 00:02:40,000
+You can find indication whether this type interface or no, that is our interface text right above the
+
+38
+00:02:40,000 --> 00:02:41,000
+interface name.
+
+39
+00:02:41,000 --> 00:02:46,000
+We can see that it's Arabel and collections, both interfaces here.
+
+40
+00:02:46,000 --> 00:02:52,000
+We can see list of methods that each specific type has, plus some means that this method is public.
+
+41
+00:02:53,000 --> 00:02:55,000
+After that goes method signature.
+
+42
+00:02:55,000 --> 00:02:59,000
+That is method, name and method parameters followed by colon.
+
+43
+00:02:59,000 --> 00:03:03,000
+And we can find return type right after the column.
+
+44
+00:03:03,000 --> 00:03:09,000
+For example, the first method in the list in collection interface is this method without parameters
+
+45
+00:03:09,000 --> 00:03:11,000
+that returns in value.
+
+46
+00:03:11,000 --> 00:03:12,000
+Does it make sense now?
+
+47
+00:03:13,000 --> 00:03:18,000
+This knowledge will help you to understand class diagrams written down on human language.
+
+48
+00:03:19,000 --> 00:03:21,000
+And let's answer our original question.
+
+49
+00:03:21,000 --> 00:03:23,000
+What else we can do with this back?
+
+50
+00:03:24,000 --> 00:03:26,000
+We can check a number of elements in it.
+
+51
+00:03:26,000 --> 00:03:28,000
+That is what size method does.
+
+52
+00:03:28,000 --> 00:03:31,000
+We can check if this bag is empty or no.
+
+53
+00:03:31,000 --> 00:03:34,000
+We can check if this bag is empty or no.
+
+54
+00:03:34,000 --> 00:03:41,000
+That's why when it is empty, we can ask our back elements, does it contain some specific element or
+
+55
+00:03:41,000 --> 00:03:45,000
+no contains measures that will help us with this task.
+
+56
+00:03:45,000 --> 00:03:51,000
+We have also matters that control collection of elements, interior objects and methods that can turn
+
+57
+00:03:51,000 --> 00:03:54,000
+collection of elements into the array of specific types.
+
+58
+00:03:54,000 --> 00:04:00,000
+For example, if your collection contains only elements of product type, we can convert our collection
+
+59
+00:04:00,000 --> 00:04:04,000
+into of product elements, but not in the array of objects.
+
+60
+00:04:04,000 --> 00:04:07,000
+If you don't want, can you feel the difference?
+
+61
+00:04:08,000 --> 00:04:08,000
+After that?
+
+62
+00:04:08,000 --> 00:04:11,000
+We can see methods that we already kind of discuss.
+
+63
+00:04:11,000 --> 00:04:12,000
+Let us add methods.
+
+64
+00:04:13,000 --> 00:04:15,000
+I can add elements to the collection.
+
+65
+00:04:15,000 --> 00:04:21,000
+I can also remove elements from the collection and to remove elements from the collection, I have to
+
+66
+00:04:21,000 --> 00:04:23,000
+pass this exact element.
+
+67
+00:04:24,000 --> 00:04:30,000
+Another important behavior, we can check whether this collection contains all elements that other collection
+
+68
+00:04:30,000 --> 00:04:30,000
+has.
+
+69
+00:04:30,000 --> 00:04:32,000
+That is our contains all method.
+
+70
+00:04:33,000 --> 00:04:36,000
+We can add all elements from one collection to another.
+
+71
+00:04:36,000 --> 00:04:43,000
+To do this, we have to use at all method and we can remove all elements from the current collections
+
+72
+00:04:43,000 --> 00:04:50,000
+and other collection has that is our remove all method and believe you can see on the slide that message
+
+73
+00:04:50,000 --> 00:04:51,000
+that we have just discussed.
+
+74
+00:04:51,000 --> 00:04:54,000
+Take out the collection as my argument.
+
+75
+00:04:54,000 --> 00:04:58,000
+If you want, you can keep only elements that are present in both collections.
+
+76
+00:04:58,000 --> 00:05:04,000
+To do this, we have to invoke retain all methods and positive reference to another collection into
+
+77
+00:05:04,000 --> 00:05:04,000
+it.
+
+78
+00:05:05,000 --> 00:05:11,000
+In other words, this message removes from the current collection all elements that are not present
+
+79
+00:05:11,000 --> 00:05:17,000
+in the collection that we passed as a method augment the methods that are left here are also describing
+
+80
+00:05:18,000 --> 00:05:23,000
+claims method will remove all elements from the collection and as you already know, equals and harsh
+
+81
+00:05:23,000 --> 00:05:26,000
+methods that are the methods that each object should have.
+
+82
+00:05:27,000 --> 00:05:33,000
+But the idea of specifying equals and Haskett methods in the collection interface is to put stress on
+
+83
+00:05:33,000 --> 00:05:39,000
+the fact that these methods should be implemented in an implementation of collection interface and that
+
+84
+00:05:39,000 --> 00:05:43,000
+these methods should override default behavior from object class.
+
+85
+00:05:43,000 --> 00:05:48,000
+And the last but not the least, massive collection interface is an iterator.
+
+86
+00:05:48,000 --> 00:05:51,000
+Pay attention to the iterable interface description now.
+
+87
+00:05:52,000 --> 00:05:57,000
+It is also the collection interface because it implements a terrible interface.
+
+88
+00:05:57,000 --> 00:06:03,000
+As you can see, Iterator method returns object of iterator type insert.
+
+89
+00:06:03,000 --> 00:06:07,000
+This object will help you to iterate over each element in your collection.
+
+90
+00:06:07,000 --> 00:06:13,000
+We are going to learn what Iterator is in the separate class and that is how our collection interface
+
+91
+00:06:13,000 --> 00:06:14,000
+that is something.
+
+92
+00:06:14,000 --> 00:06:15,000
+What do you have to remember?
+
+93
+00:06:16,000 --> 00:06:21,000
+We just have such interface and what we can do is just to remember it just as an alphabet.
+
+94
+00:06:21,000 --> 00:06:26,000
+We don't ask why a letter is written exactly in this way.
+
+95
+00:06:26,000 --> 00:06:30,000
+We just learned that this is a letter and how it sounds.
+
+96
+00:06:30,000 --> 00:06:36,000
+And when we know that we start building words with this letter, the same as here, we just have to
+
+97
+00:06:36,000 --> 00:06:38,000
+learn collection, interface and learn how to use it.
+
+98
+00:06:39,000 --> 00:06:45,000
+So here on the screen, you may see only abstract methods that should be implemented in each collection,
+
+99
+00:06:45,000 --> 00:06:49,000
+but there are a few more other default methods in the collection interface.
+
+100
+00:06:49,000 --> 00:06:55,000
+What are they to answer this question and to give you otherwise how constantly learn new things and
+
+101
+00:06:55,000 --> 00:07:00,000
+check information that you get not only on this lesson but in any tutorial?
+
+102
+00:07:00,000 --> 00:07:03,000
+Always investigate the source code of your conversion.
+
+103
+00:07:04,000 --> 00:07:09,000
+I believe you remember how to add source code, your code editor and where you might find it.
+
+104
+00:07:09,000 --> 00:07:14,000
+Let's open collection type to investigate the source code and find methods that we didn't learn yet.
+
+105
+00:07:15,000 --> 00:07:20,000
+I press control shift and simultaneously I have to type collection.
+
+106
+00:07:21,000 --> 00:07:27,000
+I need collection from Java with your package and here this and here on the right, we might see a list
+
+107
+00:07:27,000 --> 00:07:30,000
+of all methods that are present in this interface.
+
+108
+00:07:30,000 --> 00:07:34,000
+It looks like we went over all abstract methods.
+
+109
+00:07:34,000 --> 00:07:40,000
+How I learned which method is abstract and it's is a small a letter that stands for abstract.
+
+110
+00:07:41,000 --> 00:07:45,000
+But we didn't cover in our presentation methods that have Glitnir.
+
+111
+00:07:45,000 --> 00:07:46,000
+What are they?
+
+112
+00:07:47,000 --> 00:07:50,000
+Here's the overloaded method to array it.
+
+113
+00:07:50,000 --> 00:07:57,000
+Just take specific functions that will describe how to convert collection to a right to be able to apply
+
+114
+00:07:57,000 --> 00:07:57,000
+this method.
+
+115
+00:07:57,000 --> 00:08:03,000
+We have to know how to write in the functional style in Java and understand what functional interface
+
+116
+00:08:03,000 --> 00:08:03,000
+is.
+
+117
+00:08:04,000 --> 00:08:05,000
+Don't worry.
+
+118
+00:08:05,000 --> 00:08:08,000
+This topic also will be discussed in the separate lesson.
+
+119
+00:08:08,000 --> 00:08:13,000
+I just want you to understand, at least on the high level, what these default methods are about.
+
+120
+00:08:13,000 --> 00:08:21,000
+Remove method, this method takes predicate, predicate is a specific type that can return true or false
+
+121
+00:08:22,000 --> 00:08:26,000
+based on the specific function that you will pass as a method argument to this method.
+
+122
+00:08:26,000 --> 00:08:29,000
+It will identify which element should be removed.
+
+123
+00:08:29,000 --> 00:08:32,000
+For example, you may describe functions that will return.
+
+124
+00:08:32,000 --> 00:08:38,000
+True in a case product price is more than one hundred dollars, and in case this function will be applied
+
+125
+00:08:38,000 --> 00:08:44,000
+to this specific product and collection, it will be removed and this function will be applied to each
+
+126
+00:08:44,000 --> 00:08:50,000
+element in the collection you might find while loop here and see that Iterator is used to go over the
+
+127
+00:08:50,000 --> 00:08:56,000
+collection as a condition for each element in the collection and remove it in case it satisfies the
+
+128
+00:08:56,000 --> 00:08:57,000
+condition.
+
+129
+00:08:57,000 --> 00:09:01,000
+Also, there is a default method that creates iterator.
+
+130
+00:09:01,000 --> 00:09:07,000
+Split Iterator is a specific type that can traverse and make parts of elements of the source collection.
+
+131
+00:09:08,000 --> 00:09:11,000
+And here is a method that exists in all implementations of collection.
+
+132
+00:09:11,000 --> 00:09:18,000
+Interface Stream Method joins the collection into stream of elements or in other words, sequential
+
+133
+00:09:18,000 --> 00:09:19,000
+stream of elements.
+
+134
+00:09:20,000 --> 00:09:26,000
+String Mapei was introduced in Java version eight and it was a breakthrough in this course in separate
+
+135
+00:09:26,000 --> 00:09:31,000
+lesson will be on stream API and we'll learn how to use it as a practical exercise.
+
+136
+00:09:31,000 --> 00:09:35,000
+Will even rewrite our home tasks with the help of the Stream API.
+
+137
+00:09:36,000 --> 00:09:38,000
+And here is a massive, transparent stream.
+
+138
+00:09:39,000 --> 00:09:44,000
+According to documentation, it returns possible parallel stream with the current collection at its
+
+139
+00:09:44,000 --> 00:09:44,000
+source.
+
+140
+00:09:46,000 --> 00:09:51,000
+Now, let's recap what we have learned today, so they've learned what the connection is, we try to
+
+141
+00:09:51,000 --> 00:09:54,000
+imagine collection is a back for our understanding.
+
+142
+00:09:55,000 --> 00:09:59,000
+The day you saw your first UML diagram, class diagram.
+
+143
+00:09:59,000 --> 00:10:05,000
+Now you know how to read class diagrams to understand the type of description we reviewed all abstract
+
+144
+00:10:05,000 --> 00:10:07,000
+methods in collection interface.
+
+145
+00:10:07,000 --> 00:10:10,000
+And after that, we reviewed the collection before methods.
+
+146
+00:10:10,000 --> 00:10:14,000
+Also during the lesson we investigated source code of collection interface.
+
+147
+00:10:15,000 --> 00:10:17,000
+That's all what I have for you for today.
+
+148
+00:10:17,000 --> 00:10:18,000
+Thanks a lot for your attention.
+
+149
+00:10:18,000 --> 00:10:20,000
+See you in the next lesson.
+
diff --git a/19 - Java Collections Framework/003 Interfaces List, Set and Queue Overview_en.srt b/19 - Java Collections Framework/003 Interfaces List, Set and Queue Overview_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..ef703eb603e4c7e338f387c67ac528abeaf51194
--- /dev/null
+++ b/19 - Java Collections Framework/003 Interfaces List, Set and Queue Overview_en.srt
@@ -0,0 +1,472 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello, Jim.
+
+2
+00:00:06,000 --> 00:00:12,000
+In this lesson, I'll go to understand the main descendants of collection interface before going deep,
+
+3
+00:00:12,000 --> 00:00:18,000
+I believe it is very important to understand the big picture and learn three main interfaces in collections.
+
+4
+00:00:18,000 --> 00:00:23,000
+Iraqi today will hold a high level overview of such interfaces likely set.
+
+5
+00:00:23,000 --> 00:00:29,000
+And Q According to our agenda, we are going to start from the overview of the class diagram of collection
+
+6
+00:00:29,000 --> 00:00:32,000
+interface with its main descendants.
+
+7
+00:00:32,000 --> 00:00:37,000
+After that, I'm going to explain in simple words what a key difference is between three interfaces
+
+8
+00:00:37,000 --> 00:00:38,000
+and why we need them.
+
+9
+00:00:39,000 --> 00:00:44,000
+I will explain you what list is said and Q You use the explanation of the cube.
+
+10
+00:00:44,000 --> 00:00:48,000
+We are going to learn what f i f o principle is.
+
+11
+00:00:48,000 --> 00:00:54,000
+This lesson will help you to understand the first structure of our lessons and understand the core hierarchy
+
+12
+00:00:54,000 --> 00:00:55,000
+of collections.
+
+13
+00:00:55,000 --> 00:00:58,000
+Let's start here is our class diagram.
+
+14
+00:00:59,000 --> 00:01:02,000
+This one is the extended version of the one you saw in the previous lesson.
+
+15
+00:01:03,000 --> 00:01:06,000
+I believe you are already familiar with the collection interface.
+
+16
+00:01:06,000 --> 00:01:12,000
+Now let's look at the most popular child interfaces of collection interface that we are going to learn.
+
+17
+00:01:12,000 --> 00:01:18,000
+There are three interfaces that extends collection interface and that implemented by all the collection
+
+18
+00:01:18,000 --> 00:01:25,000
+implementations in GDP, Zaya least set and Q They're all collections.
+
+19
+00:01:25,000 --> 00:01:32,000
+But each interface is introduced in behavior on the quality of implementation of collection interface
+
+20
+00:01:32,000 --> 00:01:33,000
+by extending it.
+
+21
+00:01:33,000 --> 00:01:35,000
+Why do we need this interfaces?
+
+22
+00:01:36,000 --> 00:01:38,000
+Let me briefly go over each one.
+
+23
+00:01:39,000 --> 00:01:40,000
+Let's start from the least interface.
+
+24
+00:01:41,000 --> 00:01:45,000
+You already know that collection is just a back where you can put all your elements.
+
+25
+00:01:46,000 --> 00:01:47,000
+The list interface.
+
+26
+00:01:47,000 --> 00:01:52,000
+Introduce an ordered collection with the possibility to manage your elements by the index.
+
+27
+00:01:53,000 --> 00:01:56,000
+In the more simple words list is an order.
+
+28
+00:01:56,000 --> 00:01:58,000
+A collection of elements was all benefit.
+
+29
+00:01:58,000 --> 00:02:00,000
+That follows from that statement.
+
+30
+00:02:01,000 --> 00:02:04,000
+We can add element to the specific index and the collection.
+
+31
+00:02:04,000 --> 00:02:11,000
+We can get element by its index and we can replace existing element as a specific position to set the
+
+32
+00:02:11,000 --> 00:02:14,000
+new element in the specific position we have to use, said Mass.
+
+33
+00:02:15,000 --> 00:02:17,000
+With a specific index and element.
+
+34
+00:02:18,000 --> 00:02:22,000
+If we want, we can remove the element from the specific position in our list.
+
+35
+00:02:22,000 --> 00:02:28,000
+We can get the index of the first occurrence of the element in the specific collection and index of
+
+36
+00:02:28,000 --> 00:02:32,000
+the last occurrence of the specific element to perform these tasks.
+
+37
+00:02:32,000 --> 00:02:41,000
+Mass index of and last index should help us at least also allows us to get list iterator list iterator
+
+38
+00:02:41,000 --> 00:02:46,000
+that this extended version of the regular iterator in the separate class in about iterators.
+
+39
+00:02:46,000 --> 00:02:47,000
+And we'll explain the difference.
+
+40
+00:02:48,000 --> 00:02:54,000
+Sometimes we may want to create some lists, for example, to process back amount of data.
+
+41
+00:02:54,000 --> 00:03:00,000
+We may split our list into four equal chunks and perform any operations we need in four separate sets
+
+42
+00:03:00,000 --> 00:03:01,000
+of execution.
+
+43
+00:03:02,000 --> 00:03:07,000
+I believe you are aware that Java supports MultiThreaded and a bit later in the course, I'm also going
+
+44
+00:03:07,000 --> 00:03:08,000
+to teach you that.
+
+45
+00:03:09,000 --> 00:03:14,000
+Besides new absurd methods that were introduced, there are also to default matters that are absent
+
+46
+00:03:14,000 --> 00:03:17,000
+in connection interface and that are present in the list interface.
+
+47
+00:03:18,000 --> 00:03:20,000
+Zaya, replace all MassArt.
+
+48
+00:03:20,000 --> 00:03:26,000
+This method will take a function that can transform an element of one type to the element of the same
+
+49
+00:03:26,000 --> 00:03:26,000
+type.
+
+50
+00:03:27,000 --> 00:03:32,000
+We may want to use this method when we want, for example, transform all string objects in the list
+
+51
+00:03:32,000 --> 00:03:35,000
+to the string objects in the lowercase.
+
+52
+00:03:36,000 --> 00:03:42,000
+Sort method allows us to set the algorithm and to tell exactly how we want to certain elements in the
+
+53
+00:03:42,000 --> 00:03:47,000
+list, a bit later we're going to run such a functional interface as comparator.
+
+54
+00:03:48,000 --> 00:03:50,000
+Now, let's proceed with the collections Iraqi.
+
+55
+00:03:50,000 --> 00:03:52,000
+Let's talk about set interface.
+
+56
+00:03:53,000 --> 00:03:54,000
+What do you think?
+
+57
+00:03:54,000 --> 00:03:59,000
+What new methods are introduced in the set interface in comparison with collection interface?
+
+58
+00:04:00,000 --> 00:04:04,000
+No one is a set interface, doesn't introduce new methods.
+
+59
+00:04:05,000 --> 00:04:06,000
+Then why do we need it at all?
+
+60
+00:04:07,000 --> 00:04:10,000
+Let's recall what a set is from the mathematics.
+
+61
+00:04:10,000 --> 00:04:13,000
+The set is a well defined collection of discrete.
+
+62
+00:04:14,000 --> 00:04:17,000
+The set is a well defined collection of distinct objects.
+
+63
+00:04:18,000 --> 00:04:22,000
+The set interface is a main interface for the Iraqi of containers.
+
+64
+00:04:22,000 --> 00:04:25,000
+By the way, collections are often called containers.
+
+65
+00:04:26,000 --> 00:04:33,000
+So set is the main interface for the hierarchy of containers that contains only unique elements that
+
+66
+00:04:33,000 --> 00:04:40,000
+different implementations of the set interface during the development of JDK engineers come up with
+
+67
+00:04:40,000 --> 00:04:45,000
+the decisions that they need to distinguish a collection of elements and the set of elements.
+
+68
+00:04:45,000 --> 00:04:49,000
+Somehow the best decision was to introduce new interface.
+
+69
+00:04:49,000 --> 00:04:51,000
+So you're of development.
+
+70
+00:04:51,000 --> 00:04:57,000
+Engineers may declare variable of type set that would give us new methods to manipulate with elements
+
+71
+00:04:57,000 --> 00:04:58,000
+in the container.
+
+72
+00:04:59,000 --> 00:05:04,000
+But this instantly will give us the vision that this container contains only unique elements.
+
+73
+00:05:05,000 --> 00:05:10,000
+To understand how implementations of the set interface work, we need to learn map interfaces first.
+
+74
+00:05:11,000 --> 00:05:13,000
+We are going to understand later why.
+
+75
+00:05:14,000 --> 00:05:18,000
+And now let's review one more interface Hirschi interface.
+
+76
+00:05:18,000 --> 00:05:22,000
+There are a few new abstract methods were introduced here to manage the queue.
+
+77
+00:05:23,000 --> 00:05:31,000
+They are offer to insert an element into the queue, remove this method to retrieve and remove the head
+
+78
+00:05:31,000 --> 00:05:32,000
+of the queue.
+
+79
+00:05:32,000 --> 00:05:36,000
+But in case there is an empty queue, the method throws exception.
+
+80
+00:05:36,000 --> 00:05:37,000
+What is an exception?
+
+81
+00:05:38,000 --> 00:05:43,000
+And a bit later we are going to learn how Java programs may handle exceptional situations of program
+
+82
+00:05:43,000 --> 00:05:44,000
+execution.
+
+83
+00:05:44,000 --> 00:05:50,000
+Right now you can understand exception like something what is not an expected way of program execution
+
+84
+00:05:50,000 --> 00:05:56,000
+and what may potentially interrupt the program in case there is no code written that handles the exception
+
+85
+00:05:57,000 --> 00:06:03,000
+for this method also retrieves and removes the head of the queue the same as remove method, but with
+
+86
+00:06:03,000 --> 00:06:09,000
+only one difference in case queue is empty, there is no exception, no value is returned instead.
+
+87
+00:06:10,000 --> 00:06:17,000
+Element this MassArt retrieves but doesn't remove elements from the Q the same as remove method, it
+
+88
+00:06:17,000 --> 00:06:19,000
+throws exception in the case.
+
+89
+00:06:19,000 --> 00:06:19,000
+Q is empty.
+
+90
+00:06:20,000 --> 00:06:27,000
+Take Macit also retrieved but doesn't remove elements from the cube, with only one exception, that
+
+91
+00:06:27,000 --> 00:06:30,000
+in case there is an empty cube, no value is returned.
+
+92
+00:06:31,000 --> 00:06:36,000
+That's all new methods that were introduced in Q interface, no other default methods were introduced,
+
+93
+00:06:37,000 --> 00:06:44,000
+cues needed when you need to implement first in, first out principle, so-called f i f o principle,
+
+94
+00:06:45,000 --> 00:06:51,000
+imagine that you process support requests and you need to process them in the specific priority.
+
+95
+00:06:51,000 --> 00:06:57,000
+And according to the date, when you receive them the support you get that you received the earliest.
+
+96
+00:06:58,000 --> 00:06:58,000
+Exactly.
+
+97
+00:06:58,000 --> 00:07:01,000
+These tickets should be processed first.
+
+98
+00:07:02,000 --> 00:07:04,000
+And here you can understand what the queue is.
+
+99
+00:07:05,000 --> 00:07:11,000
+The first support that was received by Q The first left in the queue.
+
+100
+00:07:11,000 --> 00:07:12,000
+I feel really prepared.
+
+101
+00:07:12,000 --> 00:07:18,000
+Super interesting home task for you to improve our online store and to practice your skills in writing
+
+102
+00:07:18,000 --> 00:07:20,000
+use, but that will be later.
+
+103
+00:07:21,000 --> 00:07:27,000
+So right now I believe you understood the three main sub Iraqis that goes right after collection interface.
+
+104
+00:07:27,000 --> 00:07:33,000
+And also the structure of the next lesson should be clearer for you now during the next lesson.
+
+105
+00:07:33,000 --> 00:07:39,000
+So we are going to learn each interface in detail with all methods and to learn the most popular implementation
+
+106
+00:07:39,000 --> 00:07:40,000
+of each interface.
+
+107
+00:07:41,000 --> 00:07:44,000
+I want you to understand, Siiri, first before we start calling.
+
+108
+00:07:44,000 --> 00:07:46,000
+Believe me, this is very important.
+
+109
+00:07:47,000 --> 00:07:51,000
+But very soon you would beg me to stop quoting examples, I promise you.
+
+110
+00:07:52,000 --> 00:07:54,000
+Now, let's review what we have learned today.
+
+111
+00:07:55,000 --> 00:07:58,000
+Today we have learned what has remained descendants of collection interface.
+
+112
+00:07:59,000 --> 00:08:03,000
+Now you know why we need at least set new interfaces.
+
+113
+00:08:03,000 --> 00:08:09,000
+Moreover, after this lesson, you may understand the difference between them while explaining what
+
+114
+00:08:09,000 --> 00:08:09,000
+A is.
+
+115
+00:08:09,000 --> 00:08:12,000
+We learned f o principle.
+
+116
+00:08:12,000 --> 00:08:14,000
+Now you are ready for the next lesson.
+
+117
+00:08:15,000 --> 00:08:16,000
+Thanks a lot for your attention.
+
+118
+00:08:16,000 --> 00:08:18,000
+See you in the next lesson.
+
diff --git a/19 - Java Collections Framework/004 List implementations - ArrayList, Vector, CopyOnWriteArrayList & Stack_en.srt b/19 - Java Collections Framework/004 List implementations - ArrayList, Vector, CopyOnWriteArrayList & Stack_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..7bcedd37b9bc69b28e7b293cea6e35c12c542ecc
--- /dev/null
+++ b/19 - Java Collections Framework/004 List implementations - ArrayList, Vector, CopyOnWriteArrayList & Stack_en.srt
@@ -0,0 +1,1152 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello.
+
+2
+00:00:06,000 --> 00:00:11,000
+Yes, students, today we are going to talk about implementations of the list interface, we are going
+
+3
+00:00:11,000 --> 00:00:17,000
+to discuss such implementations as our list vector question right away, list and stack.
+
+4
+00:00:17,000 --> 00:00:23,000
+You have a lot of things to learn in this lesson besides the learning of the specific classes.
+
+5
+00:00:23,000 --> 00:00:28,000
+We are going to answer the question when you have to use each particular implementation of list interface.
+
+6
+00:00:28,000 --> 00:00:34,000
+I'm going to share with you real life examples where we will use list implementations today during the
+
+7
+00:00:34,000 --> 00:00:39,000
+lesson I'm going to show you is a tool that will allow you to investigate the interaction of classes
+
+8
+00:00:39,000 --> 00:00:40,000
+in the clips.
+
+9
+00:00:40,000 --> 00:00:45,000
+During the lesson, we are going to compare different implementations of the list interface so that
+
+10
+00:00:45,000 --> 00:00:50,000
+you could understand what pros and cons of each implementations are in this lesson.
+
+11
+00:00:50,000 --> 00:00:56,000
+We are going to compare on the array vector Copan right away and Stack also.
+
+12
+00:00:56,000 --> 00:01:01,000
+We're going to learn what mocker interfaces are and what is random access interface.
+
+13
+00:01:01,000 --> 00:01:04,000
+So as you can see, we have a huge agenda for today.
+
+14
+00:01:05,000 --> 00:01:07,000
+Let's don't waste our time and start our lesson.
+
+15
+00:01:08,000 --> 00:01:09,000
+Brunious lessons.
+
+16
+00:01:09,000 --> 00:01:14,000
+You already learned what list is, but let's try to answer the question when we have to use list.
+
+17
+00:01:15,000 --> 00:01:20,000
+In my opinion, list implementations can cover the requirements of the widest range of business cases.
+
+18
+00:01:21,000 --> 00:01:21,000
+Why?
+
+19
+00:01:22,000 --> 00:01:23,000
+Because of the next reasons.
+
+20
+00:01:24,000 --> 00:01:26,000
+Support of data manipulation by Elements Index.
+
+21
+00:01:27,000 --> 00:01:33,000
+You may want to retrieve product from specific index in your list of products, or you may want to put
+
+22
+00:01:33,000 --> 00:01:36,000
+user in the list of users in the middle of the list by its index.
+
+23
+00:01:37,000 --> 00:01:42,000
+Or probably you always want to add the new user since the beginning of the list, but not at the end.
+
+24
+00:01:42,000 --> 00:01:48,000
+The possibility to use index to manage element positions gives you a lot of options for data manipulations
+
+25
+00:01:48,000 --> 00:01:50,000
+that will help you in different business cases.
+
+26
+00:01:51,000 --> 00:01:55,000
+And another reason list implementations may contain duplicates.
+
+27
+00:01:55,000 --> 00:02:01,000
+Sometimes you just need to have container that will store all your products, for example, and you
+
+28
+00:02:01,000 --> 00:02:03,000
+don't care about duplicate there.
+
+29
+00:02:03,000 --> 00:02:07,000
+You just need to have a list of all products here.
+
+30
+00:02:08,000 --> 00:02:14,000
+That's why, which is at least overset sometimes one more reason usability to create subleased.
+
+31
+00:02:14,000 --> 00:02:16,000
+This feature is really attractive.
+
+32
+00:02:16,000 --> 00:02:18,000
+One for some specific business cases.
+
+33
+00:02:18,000 --> 00:02:21,000
+Let me share with you one example from the real life.
+
+34
+00:02:21,000 --> 00:02:25,000
+We implemented mobile app for the betting tips in this app.
+
+35
+00:02:25,000 --> 00:02:27,000
+We received data from the server.
+
+36
+00:02:27,000 --> 00:02:29,000
+We store the data in the list.
+
+37
+00:02:30,000 --> 00:02:33,000
+There was such the main type asport prediction data.
+
+38
+00:02:33,000 --> 00:02:39,000
+eSport prediction was done for the specific sports event that may happen either today or yesterday or
+
+39
+00:02:39,000 --> 00:02:40,000
+tomorrow.
+
+40
+00:02:40,000 --> 00:02:46,000
+So developers created sub lists of the sport prediction for yesterday, today and tomorrow.
+
+41
+00:02:46,000 --> 00:02:50,000
+We created three lists instead of one by splitting the original one.
+
+42
+00:02:51,000 --> 00:02:57,000
+Why we could pass the one list to each widget to draw the list on the UI interface only for specific
+
+43
+00:02:57,000 --> 00:02:58,000
+date.
+
+44
+00:02:58,000 --> 00:03:00,000
+That's it, by the way.
+
+45
+00:03:00,000 --> 00:03:03,000
+Here is the UI of the sports app, Anderson.
+
+46
+00:03:04,000 --> 00:03:07,000
+You will be able to create similar apps, so don't worry.
+
+47
+00:03:07,000 --> 00:03:12,000
+To implement such application, you have to know implementations of the list interface.
+
+48
+00:03:12,000 --> 00:03:15,000
+Let's move further certain.
+
+49
+00:03:15,000 --> 00:03:19,000
+And again, one more features a collection interface doesn't have.
+
+50
+00:03:19,000 --> 00:03:25,000
+We may sort our button Tepes based on the level of probability that really improves interaction with
+
+51
+00:03:25,000 --> 00:03:26,000
+the app.
+
+52
+00:03:26,000 --> 00:03:29,000
+Moreover, I can offer user to source support.
+
+53
+00:03:29,000 --> 00:03:37,000
+Prediction is a high probability score or by keep also rating or by anything else, wide range of use.
+
+54
+00:03:37,000 --> 00:03:43,000
+And one more important reason to opt for these implementations, and this reason probably is the most
+
+55
+00:03:43,000 --> 00:03:46,000
+important one that is not written in any book that you read.
+
+56
+00:03:46,000 --> 00:03:52,000
+Engineers use list implementations and most of the times because they just don't use a set.
+
+57
+00:03:52,000 --> 00:03:59,000
+Documentation's developers just need some container to store multiple elements in there and treat them
+
+58
+00:03:59,000 --> 00:04:02,000
+as a single unit without any extra features.
+
+59
+00:04:02,000 --> 00:04:07,000
+OK, now we want to know when and why we opt for liste implementations.
+
+60
+00:04:07,000 --> 00:04:13,000
+Let's investigate list Iraqi on this slide you may use at least the interface is implemented by absoluteness
+
+61
+00:04:13,000 --> 00:04:14,000
+class.
+
+62
+00:04:14,000 --> 00:04:15,000
+Absolutely.
+
+63
+00:04:15,000 --> 00:04:20,000
+Tintern extends APSA collection and is extended by Absol sequential sequentially.
+
+64
+00:04:21,000 --> 00:04:27,000
+From this diagram you may see that our own list is extended directly from the absolute list, the same
+
+65
+00:04:27,000 --> 00:04:33,000
+as vector and copy and write and released and linked list is extended from absolute sequential list
+
+66
+00:04:33,000 --> 00:04:37,000
+stack class extends vector engineers.
+
+67
+00:04:37,000 --> 00:04:41,000
+Doesn't like Stack for that because that is not the least by its essence.
+
+68
+00:04:42,000 --> 00:04:43,000
+It is closer to the reverse.
+
+69
+00:04:43,000 --> 00:04:45,000
+CU does a deck interface.
+
+70
+00:04:46,000 --> 00:04:52,000
+We're going to run it later, but because of the backward compatibility creator subject didn't change
+
+71
+00:04:52,000 --> 00:04:53,000
+anything here.
+
+72
+00:04:54,000 --> 00:04:54,000
+Is it clear?
+
+73
+00:04:55,000 --> 00:05:02,000
+Because Stack in its essence implement last in, first out principle, but it extends least interface,
+
+74
+00:05:02,000 --> 00:05:02,000
+but not that.
+
+75
+00:05:03,000 --> 00:05:09,000
+Even despite this, glass will not be used very often by a during the development, you might be asked
+
+76
+00:05:09,000 --> 00:05:11,000
+about it during the interview.
+
+77
+00:05:11,000 --> 00:05:13,000
+That's why I decided to mention it here.
+
+78
+00:05:14,000 --> 00:05:19,000
+What is also worth to mention is the implementation of random access interface.
+
+79
+00:05:19,000 --> 00:05:25,000
+Today during the demo, I'm going to show you what random access interface is and what mocker interfaces
+
+80
+00:05:25,000 --> 00:05:31,000
+are to protect our lesson today as I just jump into the eclipse to investigate the source code that
+
+81
+00:05:31,000 --> 00:05:35,000
+will help us to learn the topic better understand them.
+
+82
+00:05:35,000 --> 00:05:39,000
+I'd like to share with you the trick that will also help you in the future during the development.
+
+83
+00:05:39,000 --> 00:05:45,000
+Namely, I'd like to show you how you can easily find implementations of each interface and reviews
+
+84
+00:05:45,000 --> 00:05:48,000
+a whole Iraqian, for example.
+
+85
+00:05:48,000 --> 00:05:50,000
+Here is a list interface.
+
+86
+00:05:50,000 --> 00:05:54,000
+I should put the cursor into the editor error and press efore button.
+
+87
+00:05:55,000 --> 00:05:57,000
+Or you can also make mouse right.
+
+88
+00:05:57,000 --> 00:06:02,000
+Click and select open type Iraqi here and we can see that the separate widget is open.
+
+89
+00:06:02,000 --> 00:06:07,000
+Here, here I see items that extends or implements the interface.
+
+90
+00:06:07,000 --> 00:06:09,000
+For example, here's our list.
+
+91
+00:06:10,000 --> 00:06:16,000
+We can make a left mouse click to open it and here we may find our array list.
+
+92
+00:06:16,000 --> 00:06:20,000
+As you can see, there are really a lot of classes over here will not run.
+
+93
+00:06:20,000 --> 00:06:25,000
+Each of them instead will focus only on those that you will use during your work.
+
+94
+00:06:26,000 --> 00:06:32,000
+Let's start from the most popular implementation of this interface that you will use in 98 percent of
+
+95
+00:06:32,000 --> 00:06:32,000
+cases.
+
+96
+00:06:33,000 --> 00:06:34,000
+That is just my assumption.
+
+97
+00:06:34,000 --> 00:06:42,000
+But you will tell me that if I was right, here's a release class when people are released because it's
+
+98
+00:06:42,000 --> 00:06:47,000
+really fast and most simple words released is array with dynamic size.
+
+99
+00:06:48,000 --> 00:06:50,000
+But this is in very, very simple words.
+
+100
+00:06:51,000 --> 00:06:55,000
+I only use regular arrays inside to store elements here.
+
+101
+00:06:55,000 --> 00:07:00,000
+This is a variable is called element data in my store array of objects.
+
+102
+00:07:00,000 --> 00:07:07,000
+That means that technically we can put everything in this array, but we can't because this field has
+
+103
+00:07:07,000 --> 00:07:09,000
+packaged private modifier.
+
+104
+00:07:09,000 --> 00:07:15,000
+OK, then you might be wondering if I only use this regular array to store elements, then it should
+
+105
+00:07:15,000 --> 00:07:18,000
+have fixed size, is that correct?
+
+106
+00:07:18,000 --> 00:07:19,000
+That is correct.
+
+107
+00:07:20,000 --> 00:07:23,000
+Arrays in Java have fixed size, but not the array.
+
+108
+00:07:23,000 --> 00:07:27,000
+Least let me show is a code that adds element to the collection.
+
+109
+00:07:28,000 --> 00:07:33,000
+Here is an element method in today's modification count variable first.
+
+110
+00:07:33,000 --> 00:07:35,000
+Don't pay attention to that right now.
+
+111
+00:07:35,000 --> 00:07:38,000
+After that it calls another add method.
+
+112
+00:07:38,000 --> 00:07:41,000
+I hold control key and press mouse left click.
+
+113
+00:07:41,000 --> 00:07:50,000
+OK, here is a private matter and you see the first line we have if statement here we check if s equals
+
+114
+00:07:50,000 --> 00:07:55,000
+to the length of the array, then we initialize our element data array with the new array.
+
+115
+00:07:56,000 --> 00:08:00,000
+Before we go further, let's look what this s variable is.
+
+116
+00:08:00,000 --> 00:08:06,000
+I hold all key and press our left key to move back to the previous position where I was.
+
+117
+00:08:06,000 --> 00:08:13,000
+And we see that the argument in this method is a size variable size is also one of the fields in a release
+
+118
+00:08:13,000 --> 00:08:14,000
+class.
+
+119
+00:08:14,000 --> 00:08:15,000
+Now let's get back.
+
+120
+00:08:16,000 --> 00:08:22,000
+I keep all key press and also press arrow right key to get back to the place in the source code where
+
+121
+00:08:22,000 --> 00:08:23,000
+I was before.
+
+122
+00:08:23,000 --> 00:08:26,000
+Now, you know, that s is a size.
+
+123
+00:08:27,000 --> 00:08:28,000
+What does Groom method do?
+
+124
+00:08:29,000 --> 00:08:30,000
+Let me answer that question.
+
+125
+00:08:31,000 --> 00:08:32,000
+OK.
+
+126
+00:08:32,000 --> 00:08:37,000
+This method calls another group method within argument and person size plus one there.
+
+127
+00:08:38,000 --> 00:08:39,000
+And what do we have here?
+
+128
+00:08:40,000 --> 00:08:46,000
+We see that in arguments that we passed to this method is used to define desired minimum capacity.
+
+129
+00:08:47,000 --> 00:08:54,000
+You may see has that old capacity is equal to arrest lengths and in case old capacity is more than zero.
+
+130
+00:08:54,000 --> 00:08:57,000
+We calculate new capacity, how it is calculated.
+
+131
+00:08:57,000 --> 00:09:02,000
+I suggest you to investigate by itself by going deeper and method and location change.
+
+132
+00:09:03,000 --> 00:09:05,000
+By the way, you might see here bitwise shift.
+
+133
+00:09:06,000 --> 00:09:09,000
+And it is great that by this lesson you already know how it works.
+
+134
+00:09:10,000 --> 00:09:15,000
+If you don't know, please review my lesson from the Java course about operators.
+
+135
+00:09:15,000 --> 00:09:23,000
+And after that we use a race class to copy our current theory to the one with the new capacity and we
+
+136
+00:09:23,000 --> 00:09:24,000
+return the reference to this array.
+
+137
+00:09:25,000 --> 00:09:31,000
+So now you can understand that when there is no space for new element Ansary, the values from the old
+
+138
+00:09:31,000 --> 00:09:34,000
+are a cockpit to the new array was the new size.
+
+139
+00:09:35,000 --> 00:09:40,000
+OK, but what happens if we have just created the of our type and it's empty?
+
+140
+00:09:41,000 --> 00:09:43,000
+Let's check the default constructor.
+
+141
+00:09:44,000 --> 00:09:47,000
+We can see that element data is initialized with the empty array.
+
+142
+00:09:48,000 --> 00:09:50,000
+This is constant empty array.
+
+143
+00:09:50,000 --> 00:09:53,000
+But why do we need this default capacity constant?
+
+144
+00:09:54,000 --> 00:09:57,000
+To answer this, let's get back to zero method.
+
+145
+00:09:57,000 --> 00:09:59,000
+Pay attention to the if clause here.
+
+146
+00:10:00,000 --> 00:10:02,000
+If old capacity more than zero.
+
+147
+00:10:02,000 --> 00:10:06,000
+And we know that when our only has been just created, its size is zero.
+
+148
+00:10:07,000 --> 00:10:12,000
+And the second clause is if Elliman data is not equal to the full capacity MHRA.
+
+149
+00:10:12,000 --> 00:10:17,000
+We know that this statement is also false because we initialized our rate with this constant.
+
+150
+00:10:18,000 --> 00:10:25,000
+So that's why our full program execution goes to the else block where we initialize our element data
+
+151
+00:10:25,000 --> 00:10:32,000
+array with the rate of the Langston Wighton because it will take Maximilien between ten and one during
+
+152
+00:10:32,000 --> 00:10:33,000
+the creation of three.
+
+153
+00:10:34,000 --> 00:10:37,000
+Does it make sense now as a part of your homework?
+
+154
+00:10:37,000 --> 00:10:43,000
+I would encourage you to go over each method in a release like we did with Add Method to understand
+
+155
+00:10:43,000 --> 00:10:46,000
+how Array Works program.
+
+156
+00:10:46,000 --> 00:10:50,000
+You might be wondered whether you can create an array list with a specific capacity.
+
+157
+00:10:51,000 --> 00:10:52,000
+Yes, you can arrange.
+
+158
+00:10:52,000 --> 00:10:59,000
+This has special constructor for that here it why you may need to create array list of different capacity.
+
+159
+00:11:00,000 --> 00:11:01,000
+Let me explain.
+
+160
+00:11:01,000 --> 00:11:05,000
+You imagine that you created array list with capacity of 10 elements.
+
+161
+00:11:05,000 --> 00:11:12,000
+That means when you will add 11 element and after that sextants element and so forth, each time I should
+
+162
+00:11:12,000 --> 00:11:18,000
+copies of values from the previous array and add them to the new array that will cause some spikes in
+
+163
+00:11:18,000 --> 00:11:19,000
+our performance.
+
+164
+00:11:20,000 --> 00:11:26,000
+Then if you know that you're going to add to your rate around one million elements right after creation
+
+165
+00:11:26,000 --> 00:11:31,000
+of the array, at least it is better to set capacity at the beginning to avoid some spikes in the performance.
+
+166
+00:11:32,000 --> 00:11:38,000
+If we specify capacity for one million elements, we will avoid case when we constantly copying arrays
+
+167
+00:11:38,000 --> 00:11:45,000
+and creating new objects of arrays, keeping the old arrays in our memory until garbage collector will
+
+168
+00:11:45,000 --> 00:11:45,000
+remove them.
+
+169
+00:11:46,000 --> 00:11:50,000
+Is it clear now why you might want to create an array with the initial capacity?
+
+170
+00:11:51,000 --> 00:11:51,000
+Great.
+
+171
+00:11:51,000 --> 00:11:52,000
+Let's move on.
+
+172
+00:11:53,000 --> 00:11:55,000
+There is also one more interesting use case.
+
+173
+00:11:55,000 --> 00:12:02,000
+Imagine that you added new elements to your array list and after that you removed nine thousand one
+
+174
+00:12:02,000 --> 00:12:03,000
+hundred elements.
+
+175
+00:12:03,000 --> 00:12:07,000
+OK, there is a one thousand hundred elements in your list.
+
+176
+00:12:08,000 --> 00:12:16,000
+But what its capacity, its capacity is still one million to remove new elements from our array.
+
+177
+00:12:16,000 --> 00:12:19,000
+Inside our list we may call stream to size method.
+
+178
+00:12:20,000 --> 00:12:24,000
+This method streams the capacity of the relist instance to the list.
+
+179
+00:12:24,000 --> 00:12:24,000
+Current size.
+
+180
+00:12:25,000 --> 00:12:32,000
+OK, now you know how the dynamic extension happens in Frailest, I also promised you to explain what
+
+181
+00:12:32,000 --> 00:12:34,000
+random access is.
+
+182
+00:12:34,000 --> 00:12:37,000
+Can you see that array list implements random access?
+
+183
+00:12:38,000 --> 00:12:40,000
+Let's take a look at this interface.
+
+184
+00:12:40,000 --> 00:12:43,000
+Can you see that this is the empty interface?
+
+185
+00:12:43,000 --> 00:12:46,000
+It doesn't declare any contract for any behavior.
+
+186
+00:12:47,000 --> 00:12:48,000
+Then why do we need it at all?
+
+187
+00:12:49,000 --> 00:12:52,000
+Random access interface is a marker interface.
+
+188
+00:12:52,000 --> 00:12:57,000
+Sometimes in you would see so-called marker interfaces.
+
+189
+00:12:57,000 --> 00:13:00,000
+Why is called so xcode so?
+
+190
+00:13:00,000 --> 00:13:06,000
+Because the only reason why they exist is to mark interface with a specific type to use this information
+
+191
+00:13:06,000 --> 00:13:07,000
+in the future.
+
+192
+00:13:08,000 --> 00:13:10,000
+Probably it is still not clear for you.
+
+193
+00:13:11,000 --> 00:13:13,000
+But let me show you on the example.
+
+194
+00:13:13,000 --> 00:13:20,000
+Here is a random access interface which is used to mark any class that supports retrieval of elements
+
+195
+00:13:20,000 --> 00:13:21,000
+for the constant amount of time.
+
+196
+00:13:22,000 --> 00:13:29,000
+That's actually one of the key features of our list is a constant amount of time for reading an element
+
+197
+00:13:29,000 --> 00:13:33,000
+is because of the nature of a release and how it works under the hood.
+
+198
+00:13:33,000 --> 00:13:38,000
+To read an element, you just need to get it from array by specific index.
+
+199
+00:13:38,000 --> 00:13:40,000
+And this time is usually constant.
+
+200
+00:13:41,000 --> 00:13:45,000
+That's why our list is marked as implementation of random access.
+
+201
+00:13:46,000 --> 00:13:48,000
+Now let's see where this information is used.
+
+202
+00:13:49,000 --> 00:13:55,000
+If we would open collection class, this is class with utility methods nonwar, it will run it in the
+
+203
+00:13:55,000 --> 00:13:56,000
+separate question.
+
+204
+00:13:57,000 --> 00:14:02,000
+Right now, I just want to show you how information about market interfaces used I press control and
+
+205
+00:14:03,000 --> 00:14:09,000
+you simultaneously to search through this file and I want to search for random access words and I have
+
+206
+00:14:09,000 --> 00:14:11,000
+around fifty eight mentions.
+
+207
+00:14:11,000 --> 00:14:18,000
+You can see that random access is used with instance of operator and if closes to select specific algorithms
+
+208
+00:14:18,000 --> 00:14:22,000
+that will work the best here in binary search method.
+
+209
+00:14:22,000 --> 00:14:28,000
+You may see that in case that were passed as parameter to the mass that is compatible with random access
+
+210
+00:14:28,000 --> 00:14:31,000
+type then indexed binary search algorithm will be applied.
+
+211
+00:14:32,000 --> 00:14:35,000
+If no, then iterate a binary search method will be called.
+
+212
+00:14:36,000 --> 00:14:41,000
+And similarly, in the other method, check for compatibility with random access interface is used to
+
+213
+00:14:41,000 --> 00:14:43,000
+select the best algorithm.
+
+214
+00:14:44,000 --> 00:14:49,000
+Right now, I believe you understood the use case and how much the interface may be used.
+
+215
+00:14:49,000 --> 00:14:50,000
+That's great.
+
+216
+00:14:51,000 --> 00:14:52,000
+According to the agenda.
+
+217
+00:14:52,000 --> 00:14:55,000
+Also, we're going to cover today a few more classes.
+
+218
+00:14:55,000 --> 00:14:59,000
+Zaya Vector, Cooperton writer released and Stack.
+
+219
+00:14:59,000 --> 00:15:06,000
+While covering those, I will be super fast because they are mostly the same as I released, so I would
+
+220
+00:15:06,000 --> 00:15:11,000
+draw your attention only to the things that are different from the released here of Extra Vector.
+
+221
+00:15:12,000 --> 00:15:18,000
+It is almost the same as it released the same mechanism of storing data.
+
+222
+00:15:18,000 --> 00:15:21,000
+Here is the element data array to store elements.
+
+223
+00:15:22,000 --> 00:15:28,000
+There's only one big difference between a release and vector on assets and vector a synchronized.
+
+224
+00:15:28,000 --> 00:15:29,000
+What does that mean?
+
+225
+00:15:30,000 --> 00:15:32,000
+Let's take a look at the ad method.
+
+226
+00:15:32,000 --> 00:15:33,000
+For example.
+
+227
+00:15:33,000 --> 00:15:36,000
+Can you see the key words synchronized in the method definition?
+
+228
+00:15:37,000 --> 00:15:43,000
+We didn't learn yet this keyword in detail, but we will we will run it in the details durians and we'll
+
+229
+00:15:43,000 --> 00:15:44,000
+just write in top it.
+
+230
+00:15:45,000 --> 00:15:50,000
+But right now you can understand this keyword as a restriction for multiple threats of execution and
+
+231
+00:15:50,000 --> 00:15:52,000
+the method, but body simultaneously.
+
+232
+00:15:53,000 --> 00:15:59,000
+That means if two threats of execution want to add element, remove element or replace element of a
+
+233
+00:15:59,000 --> 00:16:03,000
+specific index, they won't be able to do this simultaneously.
+
+234
+00:16:04,000 --> 00:16:07,000
+All these operations will be performed one after another.
+
+235
+00:16:07,000 --> 00:16:11,000
+That would save you from the data inconsistency inside the vector.
+
+236
+00:16:11,000 --> 00:16:14,000
+That's why Vector is called safe container.
+
+237
+00:16:15,000 --> 00:16:16,000
+Does it make sense?
+
+238
+00:16:16,000 --> 00:16:18,000
+OK, let's go further.
+
+239
+00:16:18,000 --> 00:16:20,000
+Let me open a copy right away.
+
+240
+00:16:20,000 --> 00:16:22,000
+List the same stories here.
+
+241
+00:16:23,000 --> 00:16:23,000
+Right.
+
+242
+00:16:23,000 --> 00:16:26,000
+Or at least is a safe version of the array list.
+
+243
+00:16:27,000 --> 00:16:30,000
+Then what is the difference between vector and copywriter?
+
+244
+00:16:30,000 --> 00:16:31,000
+At least Corporan.
+
+245
+00:16:31,000 --> 00:16:32,000
+Right.
+
+246
+00:16:32,000 --> 00:16:34,000
+The list was introduced in Java version five.
+
+247
+00:16:35,000 --> 00:16:39,000
+Well, Vector was introduced in the version first in version five.
+
+248
+00:16:39,000 --> 00:16:44,000
+Engineers come up with improvements in performance for this, let's say, version of a release.
+
+249
+00:16:45,000 --> 00:16:49,000
+And we can say that right writer released is more efficient from the performance standpoint.
+
+250
+00:16:49,000 --> 00:16:54,000
+In comparison with Vector, for example, let me open add method.
+
+251
+00:16:54,000 --> 00:16:55,000
+Can you see this?
+
+252
+00:16:56,000 --> 00:16:59,000
+There is no synchronized word here, but synchronized block instead.
+
+253
+00:17:00,000 --> 00:17:06,000
+The White House improvisation is implemented in this class is different from the way it is implemented
+
+254
+00:17:06,000 --> 00:17:06,000
+in Vector.
+
+255
+00:17:07,000 --> 00:17:10,000
+That is the difference between vector unreleased and Copan.
+
+256
+00:17:10,000 --> 00:17:11,000
+Right?
+
+257
+00:17:11,000 --> 00:17:11,000
+Frailest.
+
+258
+00:17:12,000 --> 00:17:18,000
+And now let's open this attack was, as you remember from the beginning of the lesson, Stack extends
+
+259
+00:17:18,000 --> 00:17:19,000
+factor.
+
+260
+00:17:19,000 --> 00:17:22,000
+But take a look at the map that introduced instead.
+
+261
+00:17:23,000 --> 00:17:29,000
+What does this remind you of your right that is almost interface of the cube.
+
+262
+00:17:29,000 --> 00:17:32,000
+The names of the masses are almost the same.
+
+263
+00:17:32,000 --> 00:17:36,000
+Engineers don't like Stack because this is concrete glass.
+
+264
+00:17:36,000 --> 00:17:41,000
+That means there is no flexibility in using different implementation of the same API.
+
+265
+00:17:42,000 --> 00:17:44,000
+It implements LIFO principle.
+
+266
+00:17:45,000 --> 00:17:46,000
+Last in, first out.
+
+267
+00:17:47,000 --> 00:17:52,000
+We are going to review this principle in the details when we get closer to the interface.
+
+268
+00:17:52,000 --> 00:17:54,000
+So don't worry.
+
+269
+00:17:54,000 --> 00:18:01,000
+Years for now, the LIFO principle is implemented in DEC interface and in different implementation of
+
+270
+00:18:01,000 --> 00:18:02,000
+that interface.
+
+271
+00:18:02,000 --> 00:18:08,000
+But Stack was introduced in Java version one and keep the promise of backwards compatibility and to
+
+272
+00:18:08,000 --> 00:18:13,000
+make sure that programs that are written on Java version first will be successfully executed on the
+
+273
+00:18:13,000 --> 00:18:14,000
+Java version fifteens.
+
+274
+00:18:14,000 --> 00:18:17,000
+And later this class is still here.
+
+275
+00:18:18,000 --> 00:18:18,000
+That's it.
+
+276
+00:18:19,000 --> 00:18:23,000
+Now, you know, also the difference between a release vector, right.
+
+277
+00:18:23,000 --> 00:18:24,000
+And released instead.
+
+278
+00:18:25,000 --> 00:18:27,000
+Now let's recap what we have learned today.
+
+279
+00:18:28,000 --> 00:18:31,000
+Today, we investigated the Iraqi of least interface.
+
+280
+00:18:31,000 --> 00:18:36,000
+You saw how you may investigate source code and you Iraqi of any interface in eclipse.
+
+281
+00:18:37,000 --> 00:18:42,000
+Also in this lesson, we learned when we have to use implementation of the interface, such as every
+
+282
+00:18:43,000 --> 00:18:50,000
+vector writer relist, and so that we learned in detail how size of the array maybe dynamically increased
+
+283
+00:18:50,000 --> 00:18:50,000
+in there.
+
+284
+00:18:50,000 --> 00:18:56,000
+At least now you know the difference between a real E vector right at released and stack.
+
+285
+00:18:57,000 --> 00:19:00,000
+During the lesson we learned what Mark interfaces are.
+
+286
+00:19:00,000 --> 00:19:05,000
+On the example of random access interface, we learned how market interface might be used.
+
+287
+00:19:06,000 --> 00:19:08,000
+That's what we have for today.
+
+288
+00:19:08,000 --> 00:19:11,000
+Thanks a lot for your attention and see you in the next lesson.
+
diff --git a/19 - Java Collections Framework/005 Homework.url b/19 - Java Collections Framework/005 Homework.url
new file mode 100644
index 0000000000000000000000000000000000000000..996c19dc10f02d6760e03b3ac34c860020431a58
--- /dev/null
+++ b/19 - Java Collections Framework/005 Homework.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://docs.google.com/document/d/1g5GRLOU4XRDCIp50n_-Dmnok-2EdoDTlAQdVm6XyBLo/edit?usp=sharing
\ No newline at end of file
diff --git a/19 - Java Collections Framework/005 LinkedList VS ArrayList, Big O Notation & Homework_en.srt b/19 - Java Collections Framework/005 LinkedList VS ArrayList, Big O Notation & Homework_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..1389df985cc4ecaf240612a13df714852c8b4795
--- /dev/null
+++ b/19 - Java Collections Framework/005 LinkedList VS ArrayList, Big O Notation & Homework_en.srt
@@ -0,0 +1,1388 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello, Jim.
+
+2
+00:00:06,000 --> 00:00:10,000
+Today we are going to discuss one more implementation of list interface.
+
+3
+00:00:10,000 --> 00:00:12,000
+I'm talking about linked list.
+
+4
+00:00:12,000 --> 00:00:15,000
+In this lesson we are going to learn how Linked List works.
+
+5
+00:00:15,000 --> 00:00:20,000
+We are going to review the source code and understand when we are going to use it.
+
+6
+00:00:20,000 --> 00:00:25,000
+Also, we'll compare linked list and array list to provide you with the answer what list implementation
+
+7
+00:00:25,000 --> 00:00:28,000
+you are going to use most of the times.
+
+8
+00:00:28,000 --> 00:00:33,000
+Besides that, today in lesson we are going to have a lot of practice and I will share with you home
+
+9
+00:00:33,000 --> 00:00:36,000
+tasks that will help you to practice your knowledge in lists.
+
+10
+00:00:36,000 --> 00:00:37,000
+Let's start.
+
+11
+00:00:38,000 --> 00:00:42,000
+And first of all, let's understand how Linked List works and why it is called.
+
+12
+00:00:42,000 --> 00:00:45,000
+So this is double linked list.
+
+13
+00:00:45,000 --> 00:00:47,000
+Why it double linked.
+
+14
+00:00:47,000 --> 00:00:48,000
+Let's look at the slide.
+
+15
+00:00:48,000 --> 00:00:54,000
+This container consists of multiple objects of node type that connected between each other.
+
+16
+00:00:54,000 --> 00:00:59,000
+Each node contains some data linked to the previous node and linked to the next node.
+
+17
+00:00:59,000 --> 00:01:02,000
+That's why each node has two links.
+
+18
+00:01:02,000 --> 00:01:05,000
+That's where a name of the container comes from.
+
+19
+00:01:05,000 --> 00:01:06,000
+Linked list.
+
+20
+00:01:06,000 --> 00:01:11,000
+It is double linked because each node has the links to the next and previous element.
+
+21
+00:01:11,000 --> 00:01:12,000
+Does it make sense?
+
+22
+00:01:12,000 --> 00:01:16,000
+Now let's review the real example of linked list.
+
+23
+00:01:16,000 --> 00:01:17,000
+Take a look at the slide please.
+
+24
+00:01:17,000 --> 00:01:21,000
+For example, we have our first node a node.
+
+25
+00:01:21,000 --> 00:01:23,000
+It contains value 1000.
+
+26
+00:01:23,000 --> 00:01:26,000
+Taking into account this is the first element.
+
+27
+00:01:26,000 --> 00:01:32,000
+The link to previous element is null, but link to the next element is linked to the b node.
+
+28
+00:01:32,000 --> 00:01:36,000
+B node also contains value that is 2000.
+
+29
+00:01:36,000 --> 00:01:41,000
+Link to the previous node that is a node and link to the next node.
+
+30
+00:01:41,000 --> 00:01:44,000
+C node C node is the last one.
+
+31
+00:01:44,000 --> 00:01:48,000
+That's why link to the next node has no value.
+
+32
+00:01:48,000 --> 00:01:54,000
+And on the slide you can see that link list always stores the reference to the first and the last node.
+
+33
+00:01:54,000 --> 00:01:57,000
+It is clear now how linked list is built.
+
+34
+00:01:57,000 --> 00:02:03,000
+Understanding of this will help you a lot in understanding where and when you might want to use Linked
+
+35
+00:02:03,000 --> 00:02:05,000
+List to proceed.
+
+36
+00:02:05,000 --> 00:02:09,000
+Our lesson today, I suggest investigating the source code of the linked list.
+
+37
+00:02:09,000 --> 00:02:12,000
+Here is the source code of the linked list class.
+
+38
+00:02:12,000 --> 00:02:18,000
+As you remember from the previous lesson, it extends abstract sequential list that contains implementation
+
+39
+00:02:18,000 --> 00:02:20,000
+of some list methods.
+
+40
+00:02:20,000 --> 00:02:23,000
+Here you may see two fields of node type.
+
+41
+00:02:23,000 --> 00:02:28,000
+I believe from their names it is clear where they are referencing to the linked list.
+
+42
+00:02:28,000 --> 00:02:32,000
+Always stores the reference to the first and the last element.
+
+43
+00:02:32,000 --> 00:02:36,000
+Let's investigate how adding new element to the collection works.
+
+44
+00:02:36,000 --> 00:02:38,000
+I want to open add method.
+
+45
+00:02:38,000 --> 00:02:40,000
+Here it is.
+
+46
+00:02:40,000 --> 00:02:43,000
+We can see that link class method is invoked here.
+
+47
+00:02:44,000 --> 00:02:50,000
+Okay, let me investigate that one new variable of the node type is created and initialized with the
+
+48
+00:02:50,000 --> 00:02:53,000
+last node in the linked list.
+
+49
+00:02:53,000 --> 00:02:58,000
+After that new node object is created, special constructor is called.
+
+50
+00:02:58,000 --> 00:03:05,000
+We are passing reference to the last node elements that we want to add and new value.
+
+51
+00:03:05,000 --> 00:03:09,000
+Let me open this constructor to investigate what is happening there.
+
+52
+00:03:09,000 --> 00:03:12,000
+And now we may receive two answers.
+
+53
+00:03:12,000 --> 00:03:16,000
+The first answer is on the question what is node class?
+
+54
+00:03:16,000 --> 00:03:21,000
+As you can see, node is a static nested class and it's private.
+
+55
+00:03:21,000 --> 00:03:26,000
+That means that instances of the node class can be created only from the linked list class.
+
+56
+00:03:26,000 --> 00:03:33,000
+You also may notice that it is not so big and it doesn't have any behavior, only state.
+
+57
+00:03:33,000 --> 00:03:36,000
+The state of the node class is described in three fields.
+
+58
+00:03:36,000 --> 00:03:40,000
+They are item, next, and previous.
+
+59
+00:03:40,000 --> 00:03:44,000
+And the second answer is in this constructor.
+
+60
+00:03:44,000 --> 00:03:48,000
+So the first argument is used to initialize previous variable.
+
+61
+00:03:48,000 --> 00:03:54,000
+The second method argument is used to initialize the value of the current node, and the third method
+
+62
+00:03:54,000 --> 00:03:58,000
+argument is used to initialize the next variable.
+
+63
+00:03:58,000 --> 00:04:05,000
+Now when we know this, let's get back to the add method and when new node is created, last variable
+
+64
+00:04:05,000 --> 00:04:11,000
+is pointing out to the new node and in case last node was null, that means list was empty.
+
+65
+00:04:12,000 --> 00:04:15,000
+Thus new node should become the first element in the list.
+
+66
+00:04:15,000 --> 00:04:19,000
+If no, then we have to change the next reference in the node.
+
+67
+00:04:19,000 --> 00:04:22,000
+That was the last note so much time ago.
+
+68
+00:04:22,000 --> 00:04:28,000
+What I want you to understand, I want you to understand that to insert elements in linked list, it
+
+69
+00:04:28,000 --> 00:04:33,000
+is enough just to change references to the previous and the next element.
+
+70
+00:04:33,000 --> 00:04:34,000
+That's it.
+
+71
+00:04:34,000 --> 00:04:39,000
+If you remember array list that we learned in previous lesson, you should already know that in array
+
+72
+00:04:39,000 --> 00:04:44,000
+list, we always need to copy values from previous array and to create new arrays.
+
+73
+00:04:44,000 --> 00:04:50,000
+If we want to remove elements from the middle or beginning of the list, or to insert elements at the
+
+74
+00:04:50,000 --> 00:04:57,000
+beginning or in the middle of the list in the linked list, these operations may be done much faster
+
+75
+00:04:57,000 --> 00:04:58,000
+and significantly easier.
+
+76
+00:04:59,000 --> 00:05:01,000
+Also, I'd like you to pay attention to the.
+
+77
+00:05:01,000 --> 00:05:04,000
+The fact that Linked List implements that interface.
+
+78
+00:05:04,000 --> 00:05:06,000
+Let me open it.
+
+79
+00:05:06,000 --> 00:05:09,000
+Deck interface extends queue.
+
+80
+00:05:09,000 --> 00:05:13,000
+This is lesson not about queue and deck interface, but it is hard.
+
+81
+00:05:13,000 --> 00:05:19,000
+Not to mention that linked List is also one of the most popular implementations of the queue interface.
+
+82
+00:05:19,000 --> 00:05:26,000
+And to be honest, I used link list more often when I needed implementation of the queue, but not implementation
+
+83
+00:05:26,000 --> 00:05:27,000
+of the list.
+
+84
+00:05:27,000 --> 00:05:28,000
+Why?
+
+85
+00:05:28,000 --> 00:05:30,000
+I'm going to explain you this in a minute.
+
+86
+00:05:31,000 --> 00:05:34,000
+So knowing this fact, don't feel wondered why.
+
+87
+00:05:34,000 --> 00:05:42,000
+Linked list also has such methods as at first, at last remove first, remove last, get first, get
+
+88
+00:05:42,000 --> 00:05:43,000
+lost and others.
+
+89
+00:05:43,000 --> 00:05:50,000
+Now you know that linked list must give implementations to these methods since it implements deck interface.
+
+90
+00:05:50,000 --> 00:05:57,000
+We will not review these methods today since this is lesson about implementation of the list interface,
+
+91
+00:05:57,000 --> 00:06:03,000
+but we will discuss the other methods for sure during the lessons about queue, so don't worry.
+
+92
+00:06:03,000 --> 00:06:09,000
+Now I suggest practicing a bit with using linked list and array list for the sake of the demo.
+
+93
+00:06:09,000 --> 00:06:12,000
+Before the lesson I created this demo file.
+
+94
+00:06:12,000 --> 00:06:15,000
+I will leave a link to it in the lesson attachments.
+
+95
+00:06:15,000 --> 00:06:21,000
+And if you have all my training project cloned from the GitHub, just pull the latest changes.
+
+96
+00:06:21,000 --> 00:06:25,000
+Let me also run this program and we will explore console output together.
+
+97
+00:06:26,000 --> 00:06:27,000
+Okay.
+
+98
+00:06:27,000 --> 00:06:34,000
+As I begin here, I created two variables of type list, both of them initialized with array list objects.
+
+99
+00:06:34,000 --> 00:06:36,000
+Do not forget to do imports.
+
+100
+00:06:37,000 --> 00:06:40,000
+Eclipse will remind you to do that, so don't worry.
+
+101
+00:06:40,000 --> 00:06:47,000
+You also can see that the first list here is underlined with yellow line, the same as array list here.
+
+102
+00:06:47,000 --> 00:06:51,000
+But in the next line there are no any warnings.
+
+103
+00:06:51,000 --> 00:06:54,000
+What is the difference between these two declarations?
+
+104
+00:06:54,000 --> 00:07:00,000
+Probably you already saw in the source code this diamond operator, but you couldn't understand.
+
+105
+00:07:00,000 --> 00:07:01,000
+What does that mean?
+
+106
+00:07:01,000 --> 00:07:03,000
+Let me explain you this.
+
+107
+00:07:03,000 --> 00:07:09,000
+On the next example, I add string object to the list one and I also add integer object to the list
+
+108
+00:07:09,000 --> 00:07:10,000
+one.
+
+109
+00:07:10,000 --> 00:07:17,000
+Now my list one contains objects of different types, but all of them are compatible with the one type
+
+110
+00:07:18,000 --> 00:07:19,000
+object.
+
+111
+00:07:19,000 --> 00:07:26,000
+That's why when we want to get element of this container, we always get object of type object.
+
+112
+00:07:26,000 --> 00:07:28,000
+Can you understand why?
+
+113
+00:07:28,000 --> 00:07:34,000
+Because Java compiler doesn't know what object will be on the first index in the list and what its type.
+
+114
+00:07:35,000 --> 00:07:37,000
+Now let's look at the second list.
+
+115
+00:07:37,000 --> 00:07:44,000
+I also can add string in it, but I can't add integer because this would cause compilation error.
+
+116
+00:07:44,000 --> 00:07:48,000
+Why this called generic mechanism.
+
+117
+00:07:48,000 --> 00:07:53,000
+We are going to have separate lesson where I'm going to describe you generics in detail.
+
+118
+00:07:53,000 --> 00:07:58,000
+But right now you have to understand it at least on the high level because this will help you during
+
+119
+00:07:58,000 --> 00:08:00,000
+the homework implementation.
+
+120
+00:08:00,000 --> 00:08:07,000
+Here in Diamond operator, we specify type of elements in this list that is assigned for our Compilator
+
+121
+00:08:07,000 --> 00:08:11,000
+that in this list we will store only string objects.
+
+122
+00:08:11,000 --> 00:08:17,000
+We also have to specify diamond operator here next to specific collection implementation before the
+
+123
+00:08:17,000 --> 00:08:18,000
+Java version seven.
+
+124
+00:08:18,000 --> 00:08:25,000
+Engineers should also specify type here, but after Java version seven, in case type is the same as
+
+125
+00:08:25,000 --> 00:08:28,000
+it is specified for variable, we can keep it empty.
+
+126
+00:08:28,000 --> 00:08:32,000
+This would be the same as in case we would specify type here.
+
+127
+00:08:33,000 --> 00:08:37,000
+That's why Compilator allows only add string objects there.
+
+128
+00:08:37,000 --> 00:08:40,000
+Pretty cool feature, don't you think so?
+
+129
+00:08:40,000 --> 00:08:42,000
+This saves developer nerves.
+
+130
+00:08:42,000 --> 00:08:48,000
+When we get object from the container, call some method on it and we see some exception and program
+
+131
+00:08:48,000 --> 00:08:55,000
+stops execution because somebody in some other method put in the container object of incompatible type.
+
+132
+00:08:55,000 --> 00:09:02,000
+And when compilator is sure that will store only string objects there, we also can retrieve objects
+
+133
+00:09:02,000 --> 00:09:03,000
+of the string type.
+
+134
+00:09:03,000 --> 00:09:09,000
+For example, here when I get element from zero index, I get object of string type.
+
+135
+00:09:09,000 --> 00:09:13,000
+Hope this brings some clarity on how you may use diamond operator.
+
+136
+00:09:13,000 --> 00:09:19,000
+More advanced scenarios and how generics work will be reviewed during the separate lesson.
+
+137
+00:09:19,000 --> 00:09:21,000
+Okay, let's move on.
+
+138
+00:09:21,000 --> 00:09:28,000
+Here you may see that I initialized my variable of list type with linked list object, and this is one
+
+139
+00:09:28,000 --> 00:09:30,000
+of the advantages of Java Collections framework.
+
+140
+00:09:30,000 --> 00:09:31,000
+Here it is.
+
+141
+00:09:31,000 --> 00:09:37,000
+We may change implementation of the list, but the application programming interface is the same.
+
+142
+00:09:37,000 --> 00:09:41,000
+I still may use the same methods and count on the same result.
+
+143
+00:09:41,000 --> 00:09:48,000
+That's why all examples that you are going to see in this and in the next lessons will be the same for
+
+144
+00:09:48,000 --> 00:09:51,000
+different implementations of the specific interfaces.
+
+145
+00:09:51,000 --> 00:09:56,000
+For example, if we are reviewing list interface, you may use different implementations of the list.
+
+146
+00:09:56,000 --> 00:10:03,000
+All of them have the same set of methods, but the way how these methods works on site are different
+
+147
+00:10:03,000 --> 00:10:07,000
+and that may impact on your decision which list implementation to choose.
+
+148
+00:10:07,000 --> 00:10:08,000
+Does it make sense?
+
+149
+00:10:09,000 --> 00:10:14,000
+Now let me share with you the tip and the popular way to initialize some lists.
+
+150
+00:10:14,000 --> 00:10:19,000
+All lists implementation have constructors that takes collection of elements and initialize new list
+
+151
+00:10:19,000 --> 00:10:21,000
+with these elements.
+
+152
+00:10:21,000 --> 00:10:27,000
+Arrays class has as list method that takes multiple parameters of the same type and returns the list,
+
+153
+00:10:27,000 --> 00:10:32,000
+which in turn we use here to pass it to the constructor of array list.
+
+154
+00:10:32,000 --> 00:10:38,000
+So here is the example how you can initialize your list with multiple elements in one line.
+
+155
+00:10:38,000 --> 00:10:44,000
+For learning and debugging purposes, you always may pass list implementations to the println method,
+
+156
+00:10:44,000 --> 00:10:50,000
+because all list implementations have to string method overridden to display elements in such way as
+
+157
+00:10:50,000 --> 00:10:52,000
+you can see here in console.
+
+158
+00:10:52,000 --> 00:10:56,000
+Also, another important and practical thing to share with you.
+
+159
+00:10:56,000 --> 00:11:00,000
+All collection implementations can be used in for each loop.
+
+160
+00:11:00,000 --> 00:11:05,000
+I believe that you remember that collection interface implements a terrible interface.
+
+161
+00:11:05,000 --> 00:11:12,000
+This fact guarantees that each implementation of collection should have iterator method that will return
+
+162
+00:11:12,000 --> 00:11:17,000
+iterator object that knows how to iterate over the collection of elements.
+
+163
+00:11:17,000 --> 00:11:22,000
+That's why all collections can be used in for each loops according to Java syntax.
+
+164
+00:11:22,000 --> 00:11:24,000
+And you can see example here.
+
+165
+00:11:24,000 --> 00:11:25,000
+So now you.
+
+166
+00:11:25,000 --> 00:11:32,000
+Member that all arrays and everything that implements iterable interface, even if this your own custom
+
+167
+00:11:32,000 --> 00:11:33,000
+class may be used in.
+
+168
+00:11:33,000 --> 00:11:34,000
+For rich loops.
+
+169
+00:11:35,000 --> 00:11:38,000
+And here you can see example of clear method.
+
+170
+00:11:38,000 --> 00:11:42,000
+What I would recommend is to play with other methods like I do here.
+
+171
+00:11:43,000 --> 00:11:47,000
+Call clear method, call other methods and investigate console output.
+
+172
+00:11:47,000 --> 00:11:52,000
+Writing code and calling different methods will help you to understand material better.
+
+173
+00:11:52,000 --> 00:11:57,000
+And probably that would cause some questions and I will be always happy to answer those.
+
+174
+00:11:58,000 --> 00:12:04,000
+Now, when you know how to use list implementations in Java source code, I suggest understanding what
+
+175
+00:12:04,000 --> 00:12:09,000
+list implementations you have to use, in which particular case, and to make a choice, I'd like to
+
+176
+00:12:09,000 --> 00:12:12,000
+explain you what big O notation is.
+
+177
+00:12:12,000 --> 00:12:18,000
+Big O notation is a mathematical notation that describes the limiting behavior of a function when the
+
+178
+00:12:18,000 --> 00:12:21,000
+argument tends towards a particular value or infinity.
+
+179
+00:12:21,000 --> 00:12:27,000
+We are not going to do math in this course, but we need to understand big O notation while working
+
+180
+00:12:27,000 --> 00:12:31,000
+with different implementations of collections in computer science.
+
+181
+00:12:31,000 --> 00:12:38,000
+Big O notation is used to classify algorithms according to how they run time or space requirements grow
+
+182
+00:12:38,000 --> 00:12:40,000
+as the input size grows.
+
+183
+00:12:40,000 --> 00:12:47,000
+In very simple words, big O notation can tell us how efficient algorithm as number of elements that
+
+184
+00:12:47,000 --> 00:12:49,000
+algorithm work with increases.
+
+185
+00:12:49,000 --> 00:12:52,000
+We are going to use only few classes of functions.
+
+186
+00:12:53,000 --> 00:12:55,000
+Let me explain you what they mean.
+
+187
+00:12:55,000 --> 00:12:58,000
+Oh one that is constant.
+
+188
+00:12:58,000 --> 00:13:00,000
+For example, get an element from array by.
+
+189
+00:13:00,000 --> 00:13:03,000
+Its index is always constant.
+
+190
+00:13:04,000 --> 00:13:06,000
+Oh n let us linear clause.
+
+191
+00:13:06,000 --> 00:13:12,000
+That means that performance of the function directly depends on the number of elements.
+
+192
+00:13:12,000 --> 00:13:20,000
+For example, function of finding element in unsorted array has o n notation because you have to check
+
+193
+00:13:20,000 --> 00:13:24,000
+each element one by one to find the exactly one you need.
+
+194
+00:13:25,000 --> 00:13:30,000
+This operation takes time, and the time will depend on the number of elements.
+
+195
+00:13:30,000 --> 00:13:32,000
+Does it make sense now?
+
+196
+00:13:33,000 --> 00:13:33,000
+Oh.
+
+197
+00:13:33,000 --> 00:13:34,000
+Logarithm.
+
+198
+00:13:34,000 --> 00:13:41,000
+N that is, logarithmic class function of finding element in binary tree has all log n notation.
+
+199
+00:13:42,000 --> 00:13:45,000
+For example, imagine that you have sorted array of elements.
+
+200
+00:13:45,000 --> 00:13:51,000
+If you are looking for specific value, you can predict in which part of the array it is most likely
+
+201
+00:13:51,000 --> 00:13:55,000
+stored, and you shouldn't iterate exactly over each element.
+
+202
+00:13:55,000 --> 00:13:59,000
+We are going to learn what binary trees are in the next lessons.
+
+203
+00:13:59,000 --> 00:14:05,000
+Right now you can understand this as something what still depends on the number of elements, but the
+
+204
+00:14:05,000 --> 00:14:07,000
+dependency is not linear.
+
+205
+00:14:08,000 --> 00:14:12,000
+I try to say this as easy as possible without going deep in mathematic.
+
+206
+00:14:12,000 --> 00:14:16,000
+Believe me when you will see this on practice, that would be much easier.
+
+207
+00:14:17,000 --> 00:14:22,000
+Now I'd like to answer the question which implementation of list to use and when.
+
+208
+00:14:22,000 --> 00:14:27,000
+The first thing you have to answer during the interview, in case you would be asked what would you
+
+209
+00:14:27,000 --> 00:14:27,000
+use?
+
+210
+00:14:27,000 --> 00:14:29,000
+Linked list or array list?
+
+211
+00:14:29,000 --> 00:14:31,000
+You should ask in which environment we plan to use.
+
+212
+00:14:31,000 --> 00:14:37,000
+List implementation and regarding amount of data to answer when to use which implementation.
+
+213
+00:14:37,000 --> 00:14:43,000
+Let's review performance of each list implementation and based on this we will give an answer.
+
+214
+00:14:44,000 --> 00:14:48,000
+Now let's compare big O notation of array list and linked list.
+
+215
+00:14:48,000 --> 00:14:53,000
+Here on the slide you can see big O notation for different operations for array and linked lists.
+
+216
+00:14:54,000 --> 00:14:56,000
+Let me go over each one.
+
+217
+00:14:56,000 --> 00:14:59,000
+Get operation in array list is constant.
+
+218
+00:14:59,000 --> 00:15:06,000
+That's why we see here all one notation when on the other hand get element from linked list has linear
+
+219
+00:15:06,000 --> 00:15:07,000
+complexity.
+
+220
+00:15:07,000 --> 00:15:12,000
+And I want you to not memorize big O notation, but understand it instead.
+
+221
+00:15:12,000 --> 00:15:18,000
+Can you understand why retrieving elements from linked list is a linear function class?
+
+222
+00:15:18,000 --> 00:15:19,000
+Correct.
+
+223
+00:15:19,000 --> 00:15:25,000
+Because we have linked list without indices, and to get any specific element, we should iterate over
+
+224
+00:15:25,000 --> 00:15:29,000
+each element unless we would reach exactly the one that we need.
+
+225
+00:15:30,000 --> 00:15:33,000
+Linked list also defines from which side of the list to start.
+
+226
+00:15:33,000 --> 00:15:39,000
+If index in the second half of the list, then iteration starts from the end of the list.
+
+227
+00:15:39,000 --> 00:15:44,000
+In case index is in the first half of the list, then iteration starts from the beginning.
+
+228
+00:15:44,000 --> 00:15:45,000
+Does it make sense?
+
+229
+00:15:46,000 --> 00:15:48,000
+Okay, then let's move further.
+
+230
+00:15:49,000 --> 00:15:50,000
+Add elements to the list.
+
+231
+00:15:50,000 --> 00:15:56,000
+Array list adds always for constant amount of time, the same as linked list.
+
+232
+00:15:56,000 --> 00:15:58,000
+I'd like to make a note here.
+
+233
+00:15:58,000 --> 00:16:02,000
+This notation is from the book Java Generics and Collections by Philip Wadler.
+
+234
+00:16:03,000 --> 00:16:09,000
+You may find it on the internet if you wish, and I want to say that this is an average value listed
+
+235
+00:16:09,000 --> 00:16:10,000
+here.
+
+236
+00:16:10,000 --> 00:16:11,000
+Why?
+
+237
+00:16:11,000 --> 00:16:16,000
+Because adding elements to the end would take constant amount of time in both containers.
+
+238
+00:16:16,000 --> 00:16:20,000
+But for array list, you already know one exception.
+
+239
+00:16:20,000 --> 00:16:26,000
+That is the case when arrays inside the array list is expanded, and additional time is needed to copy
+
+240
+00:16:26,000 --> 00:16:28,000
+all elements from all the way to the new array.
+
+241
+00:16:29,000 --> 00:16:31,000
+Also, there is another note.
+
+242
+00:16:31,000 --> 00:16:36,000
+Adding elements at the beginning or in the middle of a release would also trigger creation of the new
+
+243
+00:16:36,000 --> 00:16:39,000
+array, and depends on the actual size of the array.
+
+244
+00:16:39,000 --> 00:16:43,000
+This can take some time, even despite native methods written on C plus.
+
+245
+00:16:43,000 --> 00:16:50,000
+Plus is used to copy an array and it works really fast on huge amount of data that may cause some performance
+
+246
+00:16:50,000 --> 00:16:51,000
+issues.
+
+247
+00:16:51,000 --> 00:16:53,000
+That is something what you have to remember.
+
+248
+00:16:53,000 --> 00:16:55,000
+Let's move on.
+
+249
+00:16:55,000 --> 00:16:56,000
+Remove operation.
+
+250
+00:16:56,000 --> 00:17:05,000
+This algorithm in array list is linear, the same as in linked list, but in general it should work
+
+251
+00:17:05,000 --> 00:17:13,000
+faster in linked list on huge amount of data because to remove element from the middle or beginning
+
+252
+00:17:13,000 --> 00:17:16,000
+of the array list, we have to find the element first.
+
+253
+00:17:16,000 --> 00:17:20,000
+And the more elements, the more time it would take to find it.
+
+254
+00:17:20,000 --> 00:17:28,000
+And then after removing it from an array, we need to merge two parts of array to not have empty element
+
+255
+00:17:28,000 --> 00:17:30,000
+inside the array.
+
+256
+00:17:30,000 --> 00:17:32,000
+So we need to copy array.
+
+257
+00:17:32,000 --> 00:17:39,000
+And again, the time that it will take will depend on the number of elements with linked list.
+
+258
+00:17:39,000 --> 00:17:42,000
+We need to spend time to find the element.
+
+259
+00:17:42,000 --> 00:17:45,000
+The more elements, the longer it would take.
+
+260
+00:17:45,000 --> 00:17:51,000
+And when we found the element, we don't need to copy all the data structure to merge it back again.
+
+261
+00:17:52,000 --> 00:17:54,000
+Because this is not an array.
+
+262
+00:17:54,000 --> 00:17:55,000
+This is a linked list.
+
+263
+00:17:55,000 --> 00:18:01,000
+So we have to only change the references to the next and previous elements.
+
+264
+00:18:01,000 --> 00:18:07,000
+Even despite the summary of big O notation between ArrayList and Linkedlist looks similar.
+
+265
+00:18:07,000 --> 00:18:11,000
+They would have different performance on different volumes of data.
+
+266
+00:18:11,000 --> 00:18:17,000
+That's why understanding how they work is essential to understand their performance.
+
+267
+00:18:17,000 --> 00:18:23,000
+You are going to have a homework to find out the difference in performance on different volumes of data.
+
+268
+00:18:23,000 --> 00:18:26,000
+Now let's make a conclusion based on these facts.
+
+269
+00:18:26,000 --> 00:18:32,000
+We have to use linked list when we plan constantly add elements at the beginning or at the end of the
+
+270
+00:18:32,000 --> 00:18:32,000
+list.
+
+271
+00:18:33,000 --> 00:18:38,000
+We also should opt for link list when we want to remove elements constantly from the beginning of the
+
+272
+00:18:38,000 --> 00:18:39,000
+list.
+
+273
+00:18:39,000 --> 00:18:45,000
+If we plan to use container to always add elements to the end and read elements from the list, then
+
+274
+00:18:45,000 --> 00:18:47,000
+array list is our choice.
+
+275
+00:18:47,000 --> 00:18:54,000
+But I told you that algorithm of array copying works really fast, and everything will depend on the
+
+276
+00:18:54,000 --> 00:18:56,000
+amount of data that we are working with.
+
+277
+00:18:56,000 --> 00:19:02,000
+I'm going to give you a home task where you would be able to test whether linked list really has advantage
+
+278
+00:19:02,000 --> 00:19:05,000
+over array list while working with not so big amount of data.
+
+279
+00:19:06,000 --> 00:19:09,000
+But I will give you insights even before you finish that task.
+
+280
+00:19:09,000 --> 00:19:15,000
+In majority of cases, even during the work with 1 million of elements that are relatively small objects.
+
+281
+00:19:15,000 --> 00:19:19,000
+Array list still is going to be faster than linked list.
+
+282
+00:19:20,000 --> 00:19:26,000
+And with regards of the business cases, I would say that array list is your choice almost in 99% of
+
+283
+00:19:26,000 --> 00:19:27,000
+cases.
+
+284
+00:19:27,000 --> 00:19:32,000
+The rest of the cases are when you need either threadsafe container, or you have millions of objects
+
+285
+00:19:32,000 --> 00:19:36,000
+that you need to add in the beginning of the list and constantly remove them.
+
+286
+00:19:37,000 --> 00:19:42,000
+I believe you would agree with me that it is even hard to come up with example here of such case.
+
+287
+00:19:42,000 --> 00:19:47,000
+Time for linked list will come when we will talk about queues, will discover that linked list works
+
+288
+00:19:47,000 --> 00:19:51,000
+the best for us if we need implementation of queue or deck.
+
+289
+00:19:52,000 --> 00:19:54,000
+Now let's recap what we have learned today.
+
+290
+00:19:55,000 --> 00:19:57,000
+Today we learned how linked list works.
+
+291
+00:19:57,000 --> 00:20:03,000
+Now we know what the node type is and how nodes are connected between each other in linked list.
+
+292
+00:20:04,000 --> 00:20:07,000
+We had a practice with link list and array list.
+
+293
+00:20:07,000 --> 00:20:10,000
+Now you even know how to use generics.
+
+294
+00:20:10,000 --> 00:20:16,000
+We learned what big O notation is and using this knowledge we compared link list and array lists.
+
+295
+00:20:16,000 --> 00:20:21,000
+Now you know, in which case you have to opt for either array list or link list.
+
+296
+00:20:21,000 --> 00:20:24,000
+And now I suggest reviewing your homework.
+
+297
+00:20:25,000 --> 00:20:27,000
+I have a lot of tasks for you today.
+
+298
+00:20:27,000 --> 00:20:31,000
+All of them have different level of complexity, but nothing what we didn't discuss.
+
+299
+00:20:31,000 --> 00:20:37,000
+So the first exercise is to test and compare the performance of array list and linked list.
+
+300
+00:20:37,000 --> 00:20:42,000
+It is not complex from the coding standpoint, but it is also good for you to practice with creating
+
+301
+00:20:42,000 --> 00:20:48,000
+objects of different types, declare variables and to remember, in which case you have to use which
+
+302
+00:20:48,000 --> 00:20:49,000
+container.
+
+303
+00:20:49,000 --> 00:20:54,000
+Here is a guidance what methods should be created and methods declarations.
+
+304
+00:20:54,000 --> 00:20:57,000
+And here operations that I'd like you to test.
+
+305
+00:20:57,000 --> 00:21:02,000
+We are going to insert different number of elements into the beginning, middle and at the end of the
+
+306
+00:21:02,000 --> 00:21:03,000
+list.
+
+307
+00:21:03,000 --> 00:21:09,000
+We'll test these operations with 110,000 and 1100 elements.
+
+308
+00:21:09,000 --> 00:21:14,000
+Also, we will test removal of elements from the beginning, middle and the end of the list.
+
+309
+00:21:14,000 --> 00:21:18,000
+We'll perform the same operations with array list and linked list.
+
+310
+00:21:18,000 --> 00:21:23,000
+And we'll measure how much time execution of specific method takes with array list and specific number
+
+311
+00:21:23,000 --> 00:21:25,000
+of elements and linked list.
+
+312
+00:21:26,000 --> 00:21:30,000
+After you're done with coding, I want you to fill out these tables.
+
+313
+00:21:30,000 --> 00:21:36,000
+You may see that these tables have different rows and columns based on which list implementation you
+
+314
+00:21:36,000 --> 00:21:38,000
+used and what operation you did.
+
+315
+00:21:38,000 --> 00:21:43,000
+If you are wondering how you can measure the time of method execution, here is a small hint for you.
+
+316
+00:21:43,000 --> 00:21:47,000
+You can capture time before some method execution.
+
+317
+00:21:47,000 --> 00:21:52,000
+After that call some method and after that calculate delta this value.
+
+318
+00:21:52,000 --> 00:21:58,000
+You can insert into the table after you finished, you may compare your results with my results and
+
+319
+00:21:58,000 --> 00:22:00,000
+to evaluate the trends.
+
+320
+00:22:00,000 --> 00:22:06,000
+I don't want to make any conclusions right now, primarily because some of them were already discussed
+
+321
+00:22:06,000 --> 00:22:07,000
+during the lesson.
+
+322
+00:22:07,000 --> 00:22:11,000
+And the other reason is that I want you to draw your own conclusions.
+
+323
+00:22:12,000 --> 00:22:17,000
+The second exercise here is to update existing backend system for online store.
+
+324
+00:22:17,000 --> 00:22:22,000
+It is a console application and you may find it in this repository in this package.
+
+325
+00:22:22,000 --> 00:22:24,000
+This solution uses arrays.
+
+326
+00:22:24,000 --> 00:22:28,000
+Your task is to substitute arrays with list implementations.
+
+327
+00:22:28,000 --> 00:22:30,000
+You are provided with a sample project.
+
+328
+00:22:30,000 --> 00:22:31,000
+Here.
+
+329
+00:22:31,000 --> 00:22:36,000
+Your goal is not to break anything and to make sure that all scenarios work as expected.
+
+330
+00:22:37,000 --> 00:22:42,000
+This task should give you a clear understanding of how you are going to use list implementations in
+
+331
+00:22:42,000 --> 00:22:43,000
+your applications.
+
+332
+00:22:43,000 --> 00:22:49,000
+And the last but not the least task is to create your own implementation of custom list interface.
+
+333
+00:22:49,000 --> 00:22:54,000
+You have to create interface first with such content, and after that you have to create class.
+
+334
+00:22:54,000 --> 00:22:57,000
+And to implement this interface in it.
+
+335
+00:22:57,000 --> 00:22:58,000
+Team.
+
+336
+00:22:58,000 --> 00:23:04,000
+I promise you in case you would implement these three exercises, you would understand list implementations
+
+337
+00:23:04,000 --> 00:23:05,000
+like nobody else.
+
+338
+00:23:05,000 --> 00:23:07,000
+Remember learning programming?
+
+339
+00:23:07,000 --> 00:23:13,000
+It is about coding and a little bit about reading, but definitely not vice versa.
+
+340
+00:23:13,000 --> 00:23:18,000
+And by the way, you also shouldn't worry in case something is hard for you to implement.
+
+341
+00:23:18,000 --> 00:23:20,000
+We are all learning new things here.
+
+342
+00:23:20,000 --> 00:23:24,000
+I'm going to leave links to the solution in attachments to this video.
+
+343
+00:23:24,000 --> 00:23:31,000
+So even in case you can't complete some of the tasks, feel free to look through my solution and rewrite
+
+344
+00:23:31,000 --> 00:23:36,000
+it very attentively and always ask me questions in case you have any.
+
+345
+00:23:36,000 --> 00:23:38,000
+That's all for today.
+
+346
+00:23:38,000 --> 00:23:40,000
+Thanks a lot for your attention and have a great day.
+
+347
+00:23:40,000 --> 00:23:42,000
+See you in the next lesson.
+
diff --git a/19 - Java Collections Framework/005 Solution-for-DefaultMyList-coding-exercise.url b/19 - Java Collections Framework/005 Solution-for-DefaultMyList-coding-exercise.url
new file mode 100644
index 0000000000000000000000000000000000000000..6a7f082bd0e6d56e6dbe0ce0839df2258d61f29f
--- /dev/null
+++ b/19 - Java Collections Framework/005 Solution-for-DefaultMyList-coding-exercise.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/collections/list/hw/DefaultMyList.java
\ No newline at end of file
diff --git a/19 - Java Collections Framework/005 Solution-of-the-homework-Backend-system-for-online-store-with-list.url b/19 - Java Collections Framework/005 Solution-of-the-homework-Backend-system-for-online-store-with-list.url
new file mode 100644
index 0000000000000000000000000000000000000000..3c85098d222969827574cb9595cae802461990ce
--- /dev/null
+++ b/19 - Java Collections Framework/005 Solution-of-the-homework-Backend-system-for-online-store-with-list.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/hw/onlinestore/withlist
\ No newline at end of file
diff --git a/19 - Java Collections Framework/005 Solution-of-the-homework-DefaultList-and-Performance-of-ArrayList-vs-LinkedList.url b/19 - Java Collections Framework/005 Solution-of-the-homework-DefaultList-and-Performance-of-ArrayList-vs-LinkedList.url
new file mode 100644
index 0000000000000000000000000000000000000000..33ce188146cdf7754f0474dcdf7aa06928b272eb
--- /dev/null
+++ b/19 - Java Collections Framework/005 Solution-of-the-homework-DefaultList-and-Performance-of-ArrayList-vs-LinkedList.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/collections/list/hw
\ No newline at end of file
diff --git a/19 - Java Collections Framework/005 Source-code-of-the-example-used-in-the-lesso.url b/19 - Java Collections Framework/005 Source-code-of-the-example-used-in-the-lesso.url
new file mode 100644
index 0000000000000000000000000000000000000000..ade21344357fda5e3d82b1ea2dd94094e82db662
--- /dev/null
+++ b/19 - Java Collections Framework/005 Source-code-of-the-example-used-in-the-lesso.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/collections/list/ListDemo.java
\ No newline at end of file
diff --git a/19 - Java Collections Framework/005 Template-project-for-your-homework.url b/19 - Java Collections Framework/005 Template-project-for-your-homework.url
new file mode 100644
index 0000000000000000000000000000000000000000..38f73e940569ad501c13cf5bfc4e86fa800c2ecb
--- /dev/null
+++ b/19 - Java Collections Framework/005 Template-project-for-your-homework.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/hw/onlinestore/withoutlist
\ No newline at end of file
diff --git a/19 - Java Collections Framework/008 Comparator and Comparable_en.srt b/19 - Java Collections Framework/008 Comparator and Comparable_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..ec8d54c51c388cfc0d7707067230afb7c8aab3f2
--- /dev/null
+++ b/19 - Java Collections Framework/008 Comparator and Comparable_en.srt
@@ -0,0 +1,912 @@
+1
+00:00:06,000 --> 00:00:11,000
+Hello, dear students and this class, and we are going to learn what comparator Uncomparable is, we'll
+
+2
+00:00:11,000 --> 00:00:17,000
+review these two interfaces and we'll answer when we have to use them after the lesson and you'll understand
+
+3
+00:00:17,000 --> 00:00:21,000
+the difference between them and will never confuse these two interfaces.
+
+4
+00:00:22,000 --> 00:00:27,000
+Today on Real Example, I'm going to show you how you can search your collection of elements.
+
+5
+00:00:27,000 --> 00:00:31,000
+We're also going to learn what the quicksort algorithm is.
+
+6
+00:00:31,000 --> 00:00:32,000
+Let's start.
+
+7
+00:00:32,000 --> 00:00:38,000
+And today, the best way to learn the topic is to jump directly to the eclipse and investigate the source
+
+8
+00:00:38,000 --> 00:00:38,000
+code.
+
+9
+00:00:39,000 --> 00:00:44,000
+We are going to start our lesson today from the interface over you compare.
+
+10
+00:00:44,000 --> 00:00:49,000
+The interface has only one abstract method that you have to implement in your own implementation.
+
+11
+00:00:50,000 --> 00:00:52,000
+The method name is compare.
+
+12
+00:00:52,000 --> 00:00:55,000
+This method takes two methods arguments.
+
+13
+00:00:55,000 --> 00:01:00,000
+This may be different reference types, as you can see here, but they should be the same.
+
+14
+00:01:00,000 --> 00:01:06,000
+This method, according to the interface contracts, should compare to objects and tell us what objects
+
+15
+00:01:06,000 --> 00:01:08,000
+should go before the other one.
+
+16
+00:01:08,000 --> 00:01:10,000
+How it can tell us this.
+
+17
+00:01:10,000 --> 00:01:12,000
+My return in value.
+
+18
+00:01:12,000 --> 00:01:19,000
+Everything is simple here in case the first argument is less than the second one negative integer is
+
+19
+00:01:19,000 --> 00:01:20,000
+returned.
+
+20
+00:01:20,000 --> 00:01:27,000
+In case the first argument is equal to the second argument, then zero is returned and only in case
+
+21
+00:01:27,000 --> 00:01:29,000
+the first argument is more than the second one.
+
+22
+00:01:30,000 --> 00:01:36,000
+In this case, positive integer is returned and this function is enough to source all elements in your
+
+23
+00:01:36,000 --> 00:01:38,000
+collection, according to the quicksort algorithm.
+
+24
+00:01:39,000 --> 00:01:43,000
+And a bit later today, we're going to learn how quicksort algorithm works.
+
+25
+00:01:44,000 --> 00:01:50,000
+Right now, let's investigate what else we have here in the comparator interface we have here.
+
+26
+00:01:50,000 --> 00:01:56,000
+Absaroka equals method, but it will have implementation in any class because each class is extended
+
+27
+00:01:56,000 --> 00:01:57,000
+from object and object.
+
+28
+00:01:57,000 --> 00:02:00,000
+Class has implementation of equals method.
+
+29
+00:02:01,000 --> 00:02:05,000
+That's Y equals usually is not overridden in comparative implementations.
+
+30
+00:02:06,000 --> 00:02:11,000
+Now I want to share with you information how you can quickly get comparator for natural and inverse
+
+31
+00:02:11,000 --> 00:02:12,000
+ordering.
+
+32
+00:02:12,000 --> 00:02:18,000
+Here is a reverse order method IT comparator that source items in reverse order.
+
+33
+00:02:19,000 --> 00:02:22,000
+But what is reverse order to explain this?
+
+34
+00:02:22,000 --> 00:02:23,000
+Let me open them up.
+
+35
+00:02:23,000 --> 00:02:26,000
+Programs that I prepared specially for this lesson.
+
+36
+00:02:27,000 --> 00:02:30,000
+Let me also run it to explore console output together with you.
+
+37
+00:02:31,000 --> 00:02:33,000
+Imagine that we have a list of integers.
+
+38
+00:02:34,000 --> 00:02:38,000
+We have one fifteen to thirty seven and one hundred.
+
+39
+00:02:38,000 --> 00:02:45,000
+And it is obvious for us what the natural order of these numbers is the same as it is easy for us to
+
+40
+00:02:45,000 --> 00:02:47,000
+understand what a reverse order is.
+
+41
+00:02:48,000 --> 00:02:53,000
+Each list has certain methods that takes object of comparison type as an argument.
+
+42
+00:02:53,000 --> 00:02:59,000
+Let's call short method for our list and reverse order comparator into this method.
+
+43
+00:02:59,000 --> 00:03:05,000
+And after we printed the console, the same collection, we noticed that our collection becomes sorted
+
+44
+00:03:05,000 --> 00:03:06,000
+in the reverse order.
+
+45
+00:03:06,000 --> 00:03:10,000
+But the things that are obvious for us are not obvious for the machines.
+
+46
+00:03:11,000 --> 00:03:16,000
+I believe you understand that for Java it is not obvious by default how to sort numbers.
+
+47
+00:03:17,000 --> 00:03:23,000
+There should be some code written that would tell Java to sort our collection exactly in this way.
+
+48
+00:03:23,000 --> 00:03:27,000
+So let's understand how to describe logic of natural ordering.
+
+49
+00:03:27,000 --> 00:03:34,000
+To explain this, let me open integer type and here we can see that integer implements comparable interface.
+
+50
+00:03:35,000 --> 00:03:36,000
+What is this?
+
+51
+00:03:36,000 --> 00:03:37,000
+Let me open this one.
+
+52
+00:03:38,000 --> 00:03:44,000
+Comparable interface declares the contract only for one method that is compared to method.
+
+53
+00:03:45,000 --> 00:03:50,000
+It takes another object as a method argument and can compare this.
+
+54
+00:03:50,000 --> 00:03:54,000
+The current object with the object that was passed into the method.
+
+55
+00:03:54,000 --> 00:03:59,000
+And you already can see the difference between compare and compare to methods.
+
+56
+00:03:59,000 --> 00:04:07,000
+Compare method takes two arguments compared to takes one argument in more simple words compared the
+
+57
+00:04:07,000 --> 00:04:09,000
+interface tells us something like this.
+
+58
+00:04:10,000 --> 00:04:15,000
+Give me two elements and I will tell you which one is greater than the other one.
+
+59
+00:04:15,000 --> 00:04:18,000
+Whereas comparable interface tells us something like this.
+
+60
+00:04:19,000 --> 00:04:25,000
+Give me an element and I will tell you if it is greater than me, can you feel the difference?
+
+61
+00:04:25,000 --> 00:04:32,000
+Usually comparable interface is implemented by types when we expect that objects of this type will be
+
+62
+00:04:32,000 --> 00:04:39,000
+sorted in containers like we have with the integer type creator of integer class for assorted objects
+
+63
+00:04:39,000 --> 00:04:44,000
+of this type will be compared between each other a lot of times in the future.
+
+64
+00:04:44,000 --> 00:04:46,000
+Let me open integer class again.
+
+65
+00:04:47,000 --> 00:04:50,000
+Let me show you how compared to Method is implemented here.
+
+66
+00:04:50,000 --> 00:04:54,000
+You can see the internal method compare is called here.
+
+67
+00:04:54,000 --> 00:05:01,000
+We possess a current value of the integer object because integer object has value variable and we also
+
+68
+00:05:01,000 --> 00:05:02,000
+pass into value of another.
+
+69
+00:05:03,000 --> 00:05:10,000
+Integer, let me open this campaign method and here we can see that in case the first argument that
+
+70
+00:05:10,000 --> 00:05:17,000
+is X is less than the second argument, that is Y, Z, we return to negative integer minus one.
+
+71
+00:05:17,000 --> 00:05:25,000
+And in case the statement is false, we check if X and Y are equal and is equal, we return zero.
+
+72
+00:05:25,000 --> 00:05:31,000
+And if no, that means X is greater than Y and we are to return positive integer.
+
+73
+00:05:32,000 --> 00:05:33,000
+That is one.
+
+74
+00:05:33,000 --> 00:05:39,000
+To be honest, I still don't know why developers adjudicate decided to write so many texts here.
+
+75
+00:05:39,000 --> 00:05:46,000
+Imagine that in case you have two integers and you need to compare them just right here, X minus Y
+
+76
+00:05:46,000 --> 00:05:47,000
+and that's it.
+
+77
+00:05:47,000 --> 00:05:55,000
+In case X is lower than why we would get negative number in case the equal will get zero, in case X
+
+78
+00:05:55,000 --> 00:05:58,000
+is greater than Y will get positive integer.
+
+79
+00:05:59,000 --> 00:06:03,000
+Sometimes guys from Oracle overcomplicating the things really.
+
+80
+00:06:03,000 --> 00:06:09,000
+But as true professionals, we have to understand this and respect their solutions according to the
+
+81
+00:06:09,000 --> 00:06:13,000
+contract, compared to also returns in value to certain elements.
+
+82
+00:06:14,000 --> 00:06:19,000
+The way how compared to method is implemented in the type is called natural order.
+
+83
+00:06:20,000 --> 00:06:26,000
+So I believe now you understand how Java made the reverse competitor to this required just one positive
+
+84
+00:06:26,000 --> 00:06:30,000
+result of this method into the negative and vice versa.
+
+85
+00:06:30,000 --> 00:06:32,000
+Let's get back to our example.
+
+86
+00:06:32,000 --> 00:06:38,000
+Now, imagine that we want to search elements in natural order in the computer interface.
+
+87
+00:06:38,000 --> 00:06:42,000
+There is also another default method was in the natural order.
+
+88
+00:06:42,000 --> 00:06:45,000
+It looks like that is exactly what we need.
+
+89
+00:06:45,000 --> 00:06:51,000
+You already know what natural order is and you can understand how numbers in our list will be sorted.
+
+90
+00:06:52,000 --> 00:06:57,000
+Things are pretty straightforward with the list of integers, but what will happen with our list of
+
+91
+00:06:57,000 --> 00:06:58,000
+products here?
+
+92
+00:06:58,000 --> 00:07:03,000
+I credit list that contains all products from our online store application.
+
+93
+00:07:03,000 --> 00:07:06,000
+In case you skipped homework, I will explain you.
+
+94
+00:07:07,000 --> 00:07:09,000
+We created our own service.
+
+95
+00:07:09,000 --> 00:07:14,000
+That is the default product management service that implements Singleton parkrun and can be created
+
+96
+00:07:14,000 --> 00:07:15,000
+only in single copy.
+
+97
+00:07:16,000 --> 00:07:18,000
+That's why we call that instance method here.
+
+98
+00:07:18,000 --> 00:07:21,000
+This class contains all products for our app.
+
+99
+00:07:22,000 --> 00:07:26,000
+Products are described with the help of another custom type product type.
+
+100
+00:07:27,000 --> 00:07:29,000
+If you want, you can explore this class in the details.
+
+101
+00:07:29,000 --> 00:07:32,000
+Don't worry, I will leave a link to this class.
+
+102
+00:07:32,000 --> 00:07:38,000
+It is still located in our training project that I am sure you already clone from the GitHub.
+
+103
+00:07:39,000 --> 00:07:43,000
+So when we fetched all products, we bring them to the console.
+
+104
+00:07:43,000 --> 00:07:45,000
+Each product from the new line.
+
+105
+00:07:45,000 --> 00:07:47,000
+I created custom method for that.
+
+106
+00:07:48,000 --> 00:07:50,000
+Nothing special just for each loop.
+
+107
+00:07:50,000 --> 00:07:51,000
+That's it.
+
+108
+00:07:52,000 --> 00:07:55,000
+Please don't pay attention to this wild card in the master signature.
+
+109
+00:07:56,000 --> 00:07:58,000
+We will talk about that when we return.
+
+110
+00:07:58,000 --> 00:07:59,000
+Generics topic.
+
+111
+00:07:59,000 --> 00:08:03,000
+What happens when we try to source products in natural order?
+
+112
+00:08:03,000 --> 00:08:05,000
+We see a compilation error.
+
+113
+00:08:05,000 --> 00:08:06,000
+Why?
+
+114
+00:08:06,000 --> 00:08:10,000
+Because our custom product type does not implement comparable interface.
+
+115
+00:08:11,000 --> 00:08:14,000
+So what we have to do now, we have two options.
+
+116
+00:08:14,000 --> 00:08:19,000
+Either we have to implement comparable interface and our product type or we have to implement our own
+
+117
+00:08:19,000 --> 00:08:20,000
+comparator.
+
+118
+00:08:20,000 --> 00:08:23,000
+That would contain the logic to compare elements.
+
+119
+00:08:23,000 --> 00:08:27,000
+Let me show you all these options to save the time.
+
+120
+00:08:27,000 --> 00:08:33,000
+During the video lesson, I created a product type that implements comparable interface and by default
+
+121
+00:08:33,000 --> 00:08:34,000
+we source products by idee.
+
+122
+00:08:35,000 --> 00:08:42,000
+To implement comparable interface, I added one more interface here after implements keyboards, you're
+
+123
+00:08:42,000 --> 00:08:44,000
+already familiar how to use generics.
+
+124
+00:08:44,000 --> 00:08:46,000
+Wasleys she has a similar thing.
+
+125
+00:08:47,000 --> 00:08:53,000
+I specify product type here in Diamond Operator to tell that our comparable implementation should compare
+
+126
+00:08:53,000 --> 00:08:54,000
+product type.
+
+127
+00:08:54,000 --> 00:09:01,000
+The generic usage allows me to get product type in parameters here in compared to method instead of
+
+128
+00:09:01,000 --> 00:09:04,000
+pure object and Tussaud elements by.
+
+129
+00:09:04,000 --> 00:09:06,000
+I just perform subtraction here.
+
+130
+00:09:06,000 --> 00:09:12,000
+We already reviewed on previous examples in which cases I return positive, negative or zero here.
+
+131
+00:09:13,000 --> 00:09:19,000
+That's why I suggest moving further now when we have comparable product, let's create a few objects
+
+132
+00:09:19,000 --> 00:09:22,000
+of comparable product type and add them to the list.
+
+133
+00:09:23,000 --> 00:09:28,000
+In the real app, probably you would extend product interface from comparable interface or you would
+
+134
+00:09:28,000 --> 00:09:34,000
+implement some absurd product type where you would implement comparable interface and you would use
+
+135
+00:09:34,000 --> 00:09:36,000
+that level of abstraction across your all application.
+
+136
+00:09:37,000 --> 00:09:39,000
+That just a few ideas to think about.
+
+137
+00:09:40,000 --> 00:09:45,000
+Now, in case we would support a comparable product, we would have all our products sorted according
+
+138
+00:09:45,000 --> 00:09:46,000
+to ideas.
+
+139
+00:09:47,000 --> 00:09:51,000
+And as you can see, it doesn't matter in which order we added our products to the list.
+
+140
+00:09:52,000 --> 00:09:58,000
+But what if we want to sort my product name and natural order doesn't work for us?
+
+141
+00:09:58,000 --> 00:10:01,000
+In this case, we have to implement our competitor.
+
+142
+00:10:02,000 --> 00:10:10,000
+We have four ways to implement comparator Zaya LeClaire anonymous class, create separate class, write
+
+143
+00:10:10,000 --> 00:10:13,000
+lambda expression, use method reference.
+
+144
+00:10:14,000 --> 00:10:19,000
+Then we are going to review first two options and the rest will learn in the separate lessons.
+
+145
+00:10:19,000 --> 00:10:25,000
+When we will talk about functional programming in Java, we have our list of products where products
+
+146
+00:10:25,000 --> 00:10:28,000
+don't implement comparable interface.
+
+147
+00:10:28,000 --> 00:10:30,000
+Let me use that one for sourcing.
+
+148
+00:10:31,000 --> 00:10:38,000
+I write a new comparator and specify product type in Diament operator to tell Java compilers, and this
+
+149
+00:10:38,000 --> 00:10:43,000
+comparator will work with Prototype and after that I am going to declare anonymous class.
+
+150
+00:10:44,000 --> 00:10:50,000
+And in case you missed my Java lesson about anonymous classes, please check that it will help you for
+
+151
+00:10:50,000 --> 00:10:55,000
+understanding of anonymous classes and here give implementation for compare method.
+
+152
+00:10:56,000 --> 00:10:59,000
+The second option is to implement separate class.
+
+153
+00:10:59,000 --> 00:11:05,000
+You can create separate file for that one, but for the sake of the demo, I will declare another class
+
+154
+00:11:05,000 --> 00:11:09,000
+in the same file here to keep all code examples from the lesson in one file.
+
+155
+00:11:10,000 --> 00:11:15,000
+So I have product name comparator class that implements comparator interface.
+
+156
+00:11:16,000 --> 00:11:19,000
+The implementation is the same as we have in our anonymous class.
+
+157
+00:11:20,000 --> 00:11:24,000
+I can source my products by passing the reference to the object of my competitor.
+
+158
+00:11:25,000 --> 00:11:28,000
+So there's two ways to source elements are similar.
+
+159
+00:11:28,000 --> 00:11:30,000
+It is up to you which one to choose.
+
+160
+00:11:31,000 --> 00:11:36,000
+I'm going to give you a task where you might practice in the implementation of comparator interface.
+
+161
+00:11:37,000 --> 00:11:43,000
+If you want me to answer what is better comparator or comparable, I wouldn't answer that question.
+
+162
+00:11:44,000 --> 00:11:48,000
+Using off any of these interfaces depends on the real case.
+
+163
+00:11:48,000 --> 00:11:54,000
+For example, you need to search elements by specific field in one method, then compare to usage would
+
+164
+00:11:54,000 --> 00:12:00,000
+be justified in case you don't have possibility to rewrite the type and implement comparable there.
+
+165
+00:12:01,000 --> 00:12:03,000
+You also have to use comparator in this case.
+
+166
+00:12:04,000 --> 00:12:09,000
+But if you know that objects of your type will be sorted on a regular basis during the creation of the
+
+167
+00:12:09,000 --> 00:12:13,000
+new type, you can consider implementation of comparable interface.
+
+168
+00:12:13,000 --> 00:12:14,000
+Does it make sense?
+
+169
+00:12:15,000 --> 00:12:19,000
+Before we proceed, I want to finish overview of assets in Comparator.
+
+170
+00:12:19,000 --> 00:12:24,000
+We have overloaded them comparing methods which I would say not used very often.
+
+171
+00:12:25,000 --> 00:12:29,000
+Originally, this method is built to great chain for comparison logic.
+
+172
+00:12:29,000 --> 00:12:34,000
+In the case, elements are equal, but to be honest, you can write the same logic in one method.
+
+173
+00:12:35,000 --> 00:12:40,000
+But it is also worth to mention that such architecture would allow you to be more flexible in describing
+
+174
+00:12:40,000 --> 00:12:45,000
+your comparison logic and to use different chain of comparisons in different situations.
+
+175
+00:12:46,000 --> 00:12:52,000
+While this brings a lot of flexibility, I can't come up with an example right now or any business case
+
+176
+00:12:52,000 --> 00:12:54,000
+where this flexibility will be needed.
+
+177
+00:12:55,000 --> 00:13:01,000
+We also hear no first and no last message that returned competitors with a specific logic for certain
+
+178
+00:13:01,000 --> 00:13:05,000
+new values and here also different variations of compare and method.
+
+179
+00:13:05,000 --> 00:13:07,000
+Those are pretty interesting.
+
+180
+00:13:07,000 --> 00:13:13,000
+For example, we can call comparing method and parse functions that will extract the field that we want
+
+181
+00:13:13,000 --> 00:13:20,000
+to use for sorting or extract the field and override natural ordering for it by providing another function
+
+182
+00:13:20,000 --> 00:13:21,000
+in return.
+
+183
+00:13:21,000 --> 00:13:24,000
+We will get comparators that we can use to search elements.
+
+184
+00:13:25,000 --> 00:13:31,000
+Review of these methods lies outside of our today's agenda, but we will definitely talk about this
+
+185
+00:13:31,000 --> 00:13:33,000
+when we agree on functional programming topic.
+
+186
+00:13:34,000 --> 00:13:39,000
+The last thing for the is that I want to discuss is to answer one of your potential questions.
+
+187
+00:13:40,000 --> 00:13:41,000
+Take into account this video.
+
+188
+00:13:41,000 --> 00:13:47,000
+Of course, I always try to predict what questions you might have, but in case I didn't answer all
+
+189
+00:13:47,000 --> 00:13:49,000
+your questions in the media, feel free to pose questions.
+
+190
+00:13:49,000 --> 00:13:55,000
+And the easiest lesson probably you are wondering how function that takes on the two arguments.
+
+191
+00:13:55,000 --> 00:13:59,000
+That is our campaign method, how it concerns all elements.
+
+192
+00:14:00,000 --> 00:14:03,000
+That is because algorithms with the name quicksort is applied.
+
+193
+00:14:04,000 --> 00:14:09,000
+This is not the course about algorithms, but I believe for the general understanding it will be useful
+
+194
+00:14:09,000 --> 00:14:12,000
+for you to know how quicksort algorithm works.
+
+195
+00:14:12,000 --> 00:14:16,000
+As I said, I'm not going to dive deep into the details.
+
+196
+00:14:16,000 --> 00:14:22,000
+Someday I will create course about algorithms and we are going to learn all algorithms in a nutshell.
+
+197
+00:14:23,000 --> 00:14:26,000
+But right now, I want you to look at this GIF image.
+
+198
+00:14:26,000 --> 00:14:30,000
+It explains exactly how quicksort algorithm works.
+
+199
+00:14:31,000 --> 00:14:32,000
+Quicksort algorithm.
+
+200
+00:14:32,000 --> 00:14:37,000
+It is still a commonly used algorithm for searching when implemented well.
+
+201
+00:14:37,000 --> 00:14:41,000
+It can be about two or three times faster than its main competitors.
+
+202
+00:14:41,000 --> 00:14:43,000
+Match, source and heat source.
+
+203
+00:14:44,000 --> 00:14:51,000
+The algorithm finds pivot element and after that split all elements into two separate, comparing each
+
+204
+00:14:51,000 --> 00:14:56,000
+element with belittlement algorithm source element by telling whether a particular element less or greater
+
+205
+00:14:56,000 --> 00:14:57,000
+than pivot.
+
+206
+00:14:58,000 --> 00:15:03,000
+As we go over each element, we constantly compare two elements and swapping them.
+
+207
+00:15:04,000 --> 00:15:07,000
+That's why Java needs methods that can compare to elements.
+
+208
+00:15:08,000 --> 00:15:14,000
+If you would open source code of the source method, you would discover a compromise that will be called
+
+209
+00:15:14,000 --> 00:15:17,000
+multiple times until all elements will be sorted.
+
+210
+00:15:17,000 --> 00:15:23,000
+Now, I believe you understand why we need to pass the parameters into our campaign method.
+
+211
+00:15:23,000 --> 00:15:26,000
+We did a great job today and learned a lot of things.
+
+212
+00:15:26,000 --> 00:15:29,000
+Let's recap what we have learned today.
+
+213
+00:15:29,000 --> 00:15:32,000
+Today we learned what comparator is.
+
+214
+00:15:32,000 --> 00:15:35,000
+We also learned what a comparable interface is.
+
+215
+00:15:35,000 --> 00:15:41,000
+We learned how to source elements in list by using natural and reverse ordering of elements.
+
+216
+00:15:41,000 --> 00:15:47,000
+Now, you know what the difference is between the compare and compare to methods and real examples we
+
+217
+00:15:47,000 --> 00:15:51,000
+learned when we need to use comparator and when we need to use comparable.
+
+218
+00:15:52,000 --> 00:15:57,000
+We created our custom comparable product and created comparison for existing type.
+
+219
+00:15:57,000 --> 00:16:00,000
+And at the end of the lesson we learned quicksort algorithm.
+
+220
+00:16:01,000 --> 00:16:03,000
+Now I suggest reviewing your homework.
+
+221
+00:16:04,000 --> 00:16:09,000
+And your homework, you have to implement comparison in the separate file that would search products
+
+222
+00:16:09,000 --> 00:16:13,000
+by category names, then by price and then by product name.
+
+223
+00:16:13,000 --> 00:16:19,000
+Here you may find links to the product interface type and implementation of product interface.
+
+224
+00:16:19,000 --> 00:16:25,000
+Also here you can see a list of products that you can use during the testing and believe that you will
+
+225
+00:16:25,000 --> 00:16:27,000
+be able to accomplish this task easily.
+
+226
+00:16:28,000 --> 00:16:29,000
+I believe in you.
+
+227
+00:16:30,000 --> 00:16:32,000
+That's all what I have for you for today.
+
+228
+00:16:32,000 --> 00:16:36,000
+Thanks a lot for your attention and see you in the next lesson.
+
diff --git a/19 - Java Collections Framework/008 Homework-Solution-Custom-Comparator.url b/19 - Java Collections Framework/008 Homework-Solution-Custom-Comparator.url
new file mode 100644
index 0000000000000000000000000000000000000000..aa3204b7e4b8d76ec1fe11ab438226b9b6b3511b
--- /dev/null
+++ b/19 - Java Collections Framework/008 Homework-Solution-Custom-Comparator.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/hw/onlinestore/withlist/utils/comparators/CustomProductComparator.java
\ No newline at end of file
diff --git a/19 - Java Collections Framework/008 Homework.url b/19 - Java Collections Framework/008 Homework.url
new file mode 100644
index 0000000000000000000000000000000000000000..03cef26b6cc749b540b365ad96fcea81737187b2
--- /dev/null
+++ b/19 - Java Collections Framework/008 Homework.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://docs.google.com/document/d/1senXk6JLFWsVQnJT5si_QgodHkXMFgIIPK447rgXSN0/edit?usp=sharing
\ No newline at end of file
diff --git a/19 - Java Collections Framework/008 Source-code-of-the-example-used-in-the-lesson.url b/19 - Java Collections Framework/008 Source-code-of-the-example-used-in-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..a6bd03fa6d7fc26b3e55eb6e046c631ea6f34683
--- /dev/null
+++ b/19 - Java Collections Framework/008 Source-code-of-the-example-used-in-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/sorting/ComparisonDemo.java
\ No newline at end of file
diff --git a/19 - Java Collections Framework/010 Homework-Solution-Custom-Iterator-and-ListIterator.url b/19 - Java Collections Framework/010 Homework-Solution-Custom-Iterator-and-ListIterator.url
new file mode 100644
index 0000000000000000000000000000000000000000..33ce188146cdf7754f0474dcdf7aa06928b272eb
--- /dev/null
+++ b/19 - Java Collections Framework/010 Homework-Solution-Custom-Iterator-and-ListIterator.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/collections/list/hw
\ No newline at end of file
diff --git a/19 - Java Collections Framework/010 Homework.url b/19 - Java Collections Framework/010 Homework.url
new file mode 100644
index 0000000000000000000000000000000000000000..51e9a3f8ae59218f87b7f21e2b869cf7cb685b78
--- /dev/null
+++ b/19 - Java Collections Framework/010 Homework.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://docs.google.com/document/d/1EAQRwHR1HbWt95T3FtS9EOdQsIc_3nZFYUvc6Qv4frQ/edit?usp=sharing
\ No newline at end of file
diff --git a/19 - Java Collections Framework/010 Iterable, Iterator & ListIterator_en.srt b/19 - Java Collections Framework/010 Iterable, Iterator & ListIterator_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..4b5dd143e6fc5428966fa76b17832ab1bf3707c9
--- /dev/null
+++ b/19 - Java Collections Framework/010 Iterable, Iterator & ListIterator_en.srt
@@ -0,0 +1,1080 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello, Jim.
+
+2
+00:00:06,000 --> 00:00:11,000
+In this lesson, we are going to talk about what iterable and iterator interfaces are.
+
+3
+00:00:11,000 --> 00:00:17,000
+We would investigate source code of these two interfaces and also will answer what is the role of these
+
+4
+00:00:17,000 --> 00:00:19,000
+two interfaces in Java collections framework.
+
+5
+00:00:20,000 --> 00:00:23,000
+After this lesson, you will never confuse these two interfaces.
+
+6
+00:00:23,000 --> 00:00:26,000
+We are going to learn three types of iterator.
+
+7
+00:00:26,000 --> 00:00:32,000
+And at the end of the lesson, I also want to demo what least Iterator is and how it is different from
+
+8
+00:00:32,000 --> 00:00:33,000
+Iterator.
+
+9
+00:00:33,000 --> 00:00:34,000
+Let's start.
+
+10
+00:00:34,000 --> 00:00:40,000
+I believe you remember that first time when we looked at collection interface, we found that collection
+
+11
+00:00:40,000 --> 00:00:43,000
+interface is extended from iterable interface.
+
+12
+00:00:43,000 --> 00:00:50,000
+You remember that as you can see on this class diagram, iterable interface has only one method iterator.
+
+13
+00:00:51,000 --> 00:00:53,000
+This method should return object of iterate type.
+
+14
+00:00:54,000 --> 00:00:59,000
+That means that each implementation of collection interfacing Java should have iterator.
+
+15
+00:00:59,000 --> 00:01:03,000
+I believe that is all what we can say about iterable interface.
+
+16
+00:01:03,000 --> 00:01:10,000
+This interface is to tell that I'm the type that has iterator more interesting to talk about what an
+
+17
+00:01:10,000 --> 00:01:17,000
+iterator is and to answer this question, I suggest reviewing source code of iterator type in eclipse
+
+18
+00:01:17,000 --> 00:01:18,000
+in few words.
+
+19
+00:01:18,000 --> 00:01:22,000
+Iterator is a type that can go over each element in a container.
+
+20
+00:01:22,000 --> 00:01:23,000
+That's it.
+
+21
+00:01:23,000 --> 00:01:27,000
+You might be wondering, is it really so hard and separate type is needed?
+
+22
+00:01:28,000 --> 00:01:31,000
+It is not so hard, but imagine two simple cases.
+
+23
+00:01:31,000 --> 00:01:34,000
+You have array lists and linked list.
+
+24
+00:01:34,000 --> 00:01:39,000
+In our list we are together elements from the array by the indexes in the linked list.
+
+25
+00:01:39,000 --> 00:01:44,000
+We have to get the reference to the next node from each node to iterate over elements.
+
+26
+00:01:44,000 --> 00:01:50,000
+Can you see that the way how to iterate over each element, even in these two collections, is completely
+
+27
+00:01:50,000 --> 00:01:51,000
+different?
+
+28
+00:01:52,000 --> 00:01:58,000
+That's exactly the reason why we need to come up with some abstract type like Iterator to set the interface
+
+29
+00:01:58,000 --> 00:02:02,000
+that should be implemented by specific implementations of collection interface.
+
+30
+00:02:02,000 --> 00:02:05,000
+So let's sum up what Iterator is.
+
+31
+00:02:06,000 --> 00:02:12,000
+Iterator is an interface that allows access to the elements in container and navigation in collection,
+
+32
+00:02:12,000 --> 00:02:19,000
+including iteration or in other words, looping over each element in any collection without knowing
+
+33
+00:02:19,000 --> 00:02:22,000
+the details of implementation of specific collection.
+
+34
+00:02:23,000 --> 00:02:30,000
+Now we are going to run the interface of iterate the type it has to abstract and two default methods.
+
+35
+00:02:31,000 --> 00:02:33,000
+Let me explain what each of these methods is about.
+
+36
+00:02:34,000 --> 00:02:37,000
+Has an X method returns true or false?
+
+37
+00:02:37,000 --> 00:02:43,000
+It tells us whether the next element is present will use this method in loops to check if it was to
+
+38
+00:02:43,000 --> 00:02:49,000
+go on with our loop or we reached the end of the collection and we have to break the loop.
+
+39
+00:02:50,000 --> 00:02:53,000
+Next method returns the next element in connection.
+
+40
+00:02:53,000 --> 00:02:54,000
+Be careful.
+
+41
+00:02:54,000 --> 00:03:01,000
+This method may throw no such element exception and interrupt your program execution in case you called
+
+42
+00:03:01,000 --> 00:03:02,000
+next method.
+
+43
+00:03:02,000 --> 00:03:04,000
+But there are no any elements there.
+
+44
+00:03:04,000 --> 00:03:07,000
+That is a contract of the Iterator interface.
+
+45
+00:03:07,000 --> 00:03:09,000
+We can do nothing about that.
+
+46
+00:03:09,000 --> 00:03:16,000
+That's why before calling next method, we have to always call has next method remove method supposed
+
+47
+00:03:16,000 --> 00:03:21,000
+to remove the last element returned by next method and now attention.
+
+48
+00:03:21,000 --> 00:03:25,000
+This method can be called only once after each next method call.
+
+49
+00:03:25,000 --> 00:03:31,000
+We can't call two times next method and after that call two times remove method.
+
+50
+00:03:31,000 --> 00:03:37,000
+That is the way how Iterator should work in case you would call remove method without calling next method
+
+51
+00:03:37,000 --> 00:03:42,000
+or we'll call remove two times in a row in your program, your program will be stopped with illegal
+
+52
+00:03:42,000 --> 00:03:43,000
+state exception.
+
+53
+00:03:44,000 --> 00:03:46,000
+But there is more interesting thing here.
+
+54
+00:03:46,000 --> 00:03:50,000
+By default, remove method throws and support the separation exception.
+
+55
+00:03:50,000 --> 00:03:56,000
+That means that in case we would call this method, our program will be stopped with the exceptional
+
+56
+00:03:56,000 --> 00:03:56,000
+situation.
+
+57
+00:03:57,000 --> 00:04:01,000
+Now I'm going to say not only my opinion, but opinion of different engineers too.
+
+58
+00:04:02,000 --> 00:04:06,000
+It is senseless to declare method in the interface that is not needed.
+
+59
+00:04:06,000 --> 00:04:07,000
+Yes, exactly.
+
+60
+00:04:08,000 --> 00:04:14,000
+This exception here and support the separation exception tells us that by default this method is not
+
+61
+00:04:14,000 --> 00:04:15,000
+supported.
+
+62
+00:04:15,000 --> 00:04:18,000
+Don't do that during the implementation of your interfaces.
+
+63
+00:04:19,000 --> 00:04:19,000
+Why?
+
+64
+00:04:20,000 --> 00:04:21,000
+Let me explain here.
+
+65
+00:04:21,000 --> 00:04:24,000
+We can see a violation of one of the solid principles.
+
+66
+00:04:25,000 --> 00:04:29,000
+Can you guess what solid principle is violated in the Iterator interface?
+
+67
+00:04:30,000 --> 00:04:31,000
+Exactly.
+
+68
+00:04:31,000 --> 00:04:34,000
+High principle interface aggregation principle.
+
+69
+00:04:34,000 --> 00:04:39,000
+According to this principle, no client should be forced to depend on methods it doesn't use.
+
+70
+00:04:40,000 --> 00:04:46,000
+Originally, according to the documentation, Iterator type was created to iterate over elements, but
+
+71
+00:04:46,000 --> 00:04:47,000
+not to remove them.
+
+72
+00:04:47,000 --> 00:04:50,000
+How would I recommend implementing this?
+
+73
+00:04:50,000 --> 00:04:56,000
+I would create something like removable iterator that extends iterate type and would let client of my
+
+74
+00:04:56,000 --> 00:05:03,000
+code to decide whether they need to remove method or no, because right now each implementation of Iterator.
+
+75
+00:05:03,000 --> 00:05:10,000
+Interface has removed MassArt, even if it is not a that this is default MassArt and there is no need
+
+76
+00:05:10,000 --> 00:05:10,000
+to override it.
+
+77
+00:05:11,000 --> 00:05:18,000
+But this does not make life of engineers easier because we still can call, remove by mistake and rely
+
+78
+00:05:18,000 --> 00:05:21,000
+on the fact that this behavior should be supported in iterator.
+
+79
+00:05:22,000 --> 00:05:24,000
+Now, you know that there is an exception here.
+
+80
+00:05:25,000 --> 00:05:30,000
+The other side of this violation is that in the case in Java collections framework, engineers would
+
+81
+00:05:30,000 --> 00:05:35,000
+follow all or P principles, including interface aggregation principle.
+
+82
+00:05:35,000 --> 00:05:42,000
+There would be big bank of interfaces that is hard to learn and hard to remember and even harder to
+
+83
+00:05:42,000 --> 00:05:42,000
+maintain.
+
+84
+00:05:43,000 --> 00:05:49,000
+So as you can see, programming like everything else in our lives is all about tradeoffs and compromises.
+
+85
+00:05:50,000 --> 00:05:56,000
+The last but not the least massaged here in Interactor interface is for each remaining, this matter
+
+86
+00:05:56,000 --> 00:06:01,000
+takes function that should be applied for each element that remains in the container.
+
+87
+00:06:01,000 --> 00:06:07,000
+The usage of this message requires knowledge of functional programming in Java and no interfaces from
+
+88
+00:06:07,000 --> 00:06:09,000
+the Java Wattyl function package.
+
+89
+00:06:10,000 --> 00:06:13,000
+That's why today will not Damul work of this method.
+
+90
+00:06:13,000 --> 00:06:16,000
+But we will damage it in the lesson about functional programming.
+
+91
+00:06:17,000 --> 00:06:23,000
+OK, now when we know iterate the interface, I suggest learning how it works and to practice a bit.
+
+92
+00:06:24,000 --> 00:06:28,000
+And I would like to visualize the way how Massaponax and remove works.
+
+93
+00:06:28,000 --> 00:06:30,000
+Let's take a look at this slide.
+
+94
+00:06:30,000 --> 00:06:36,000
+I want you to imagine that Iterator works like a cursor, namely at the beginning.
+
+95
+00:06:36,000 --> 00:06:38,000
+It stands right before the first element.
+
+96
+00:06:39,000 --> 00:06:43,000
+When we call next method, it returns the next element to us.
+
+97
+00:06:43,000 --> 00:06:49,000
+And now cursor stands between the first and the second element in case we call next method one more
+
+98
+00:06:49,000 --> 00:06:55,000
+time cursor is moved to the position between second and the third element like you see on the slide.
+
+99
+00:06:56,000 --> 00:07:02,000
+Now, when we call remove method Iterator works as a backspace key on the Windows machines, it removes
+
+100
+00:07:02,000 --> 00:07:05,000
+elements that stands right before the cursor.
+
+101
+00:07:05,000 --> 00:07:06,000
+Does it make sense?
+
+102
+00:07:07,000 --> 00:07:08,000
+Now let's get back to Eclipse.
+
+103
+00:07:09,000 --> 00:07:15,000
+For the sake of the drama, I created this demo file to practice a bit with Iterator, let me run this
+
+104
+00:07:15,000 --> 00:07:18,000
+program and walk you through the different cases that are listed here.
+
+105
+00:07:19,000 --> 00:07:24,000
+At the beginning, I created the list of integers to play with, you already know this construction,
+
+106
+00:07:25,000 --> 00:07:27,000
+so there is nothing special for you here.
+
+107
+00:07:27,000 --> 00:07:30,000
+Now, let's iterate over each element in container.
+
+108
+00:07:31,000 --> 00:07:37,000
+I call iterate a method on our list that returns iterator object parametrized by integer type.
+
+109
+00:07:37,000 --> 00:07:44,000
+This means that when I will call next Masset iterate, I will reach an object of type integer like it
+
+110
+00:07:44,000 --> 00:07:49,000
+specified here in Diamond Operator, but not the object of type object.
+
+111
+00:07:49,000 --> 00:07:55,000
+After that we have while loop and I check in condition statement here was an iterator has an extra element
+
+112
+00:07:55,000 --> 00:07:56,000
+or no.
+
+113
+00:07:56,000 --> 00:08:03,000
+And if yes I want to print it to cancel next match it returns me means a reference to the next element
+
+114
+00:08:03,000 --> 00:08:04,000
+in my container.
+
+115
+00:08:04,000 --> 00:08:06,000
+Is everything clear here.
+
+116
+00:08:06,000 --> 00:08:10,000
+Haubert is the next example is more like practical type.
+
+117
+00:08:11,000 --> 00:08:17,000
+Some of my students that I taught offline feel concerned that they can use the same iterator once we
+
+118
+00:08:17,000 --> 00:08:19,000
+iterate it over all elements.
+
+119
+00:08:19,000 --> 00:08:26,000
+So after the previous loop, our iterator cursor is at the end of the container and has an X method
+
+120
+00:08:26,000 --> 00:08:27,000
+will return false.
+
+121
+00:08:27,000 --> 00:08:31,000
+That is exactly the reason why we see this console output here.
+
+122
+00:08:32,000 --> 00:08:33,000
+But what to do now?
+
+123
+00:08:33,000 --> 00:08:40,000
+We can use the same variable and initialize it with a new iterator object because no message to reset
+
+124
+00:08:40,000 --> 00:08:44,000
+courser obliterated back again to the beginning like we did here.
+
+125
+00:08:45,000 --> 00:08:46,000
+So that is fine.
+
+126
+00:08:47,000 --> 00:08:49,000
+Now I want to them how remove method works.
+
+127
+00:08:50,000 --> 00:08:56,000
+Let's remove all even numbers from our container we call next method to get the element from the container.
+
+128
+00:08:57,000 --> 00:09:02,000
+After that, we check whether this number is A1 and if yes, then we remove it.
+
+129
+00:09:02,000 --> 00:09:06,000
+You can see that I don't violate the rules of remove method usage.
+
+130
+00:09:07,000 --> 00:09:10,000
+I call remove method only after I called next method.
+
+131
+00:09:11,000 --> 00:09:14,000
+And also there are no multiple locations of remove method.
+
+132
+00:09:15,000 --> 00:09:22,000
+You also can notice that iterator that is implemented in at least overwrites remove Masset and doesn't
+
+133
+00:09:22,000 --> 00:09:27,000
+throw and supports the separation exception like the full implementation of Remove Massud does.
+
+134
+00:09:28,000 --> 00:09:33,000
+Now, if you are not familiar with the exception topic yet, let me show you an example.
+
+135
+00:09:33,000 --> 00:09:36,000
+What exception means and how the writer may throw exceptions.
+
+136
+00:09:37,000 --> 00:09:43,000
+Lattman comments these lines of code I initialised again my iterative variable with the new iterator
+
+137
+00:09:43,000 --> 00:09:44,000
+object.
+
+138
+00:09:44,000 --> 00:09:47,000
+After that I call Remove Masset without calling.
+
+139
+00:09:47,000 --> 00:09:48,000
+Next Masset.
+
+140
+00:09:48,000 --> 00:09:50,000
+Let me run my program now.
+
+141
+00:09:50,000 --> 00:09:53,000
+And here we can see illegal state exception.
+
+142
+00:09:53,000 --> 00:09:58,000
+The same exceptions will be thrown in case we would call remove Massud two times in a row.
+
+143
+00:09:59,000 --> 00:10:04,000
+That is something what you have to remember at the end of the lesson I will share with your home task
+
+144
+00:10:04,000 --> 00:10:09,000
+where you will have opportunity to practice your skills in writing your custom iterators.
+
+145
+00:10:09,000 --> 00:10:14,000
+Let me comment these lines to be able to execute code that is written after this one.
+
+146
+00:10:15,000 --> 00:10:21,000
+Let me also show one more important exception that might be thrown by Iterator that is concurrent modification,
+
+147
+00:10:21,000 --> 00:10:25,000
+exception and uncommon these lines of code and will damage to you.
+
+148
+00:10:26,000 --> 00:10:32,000
+Imagine that we created Iterator and when we started iteration, we removed elements from the container,
+
+149
+00:10:33,000 --> 00:10:37,000
+but not with the help of Iterator, but just by using the removed method of our list.
+
+150
+00:10:38,000 --> 00:10:39,000
+This is just an example.
+
+151
+00:10:39,000 --> 00:10:45,000
+In real life, it might happen that you created an iterator on the list that is shared between different
+
+152
+00:10:45,000 --> 00:10:50,000
+threats of execution and somebody in another thread did some modifications to your list.
+
+153
+00:10:51,000 --> 00:10:56,000
+And after we would call next method, we would see concurrent modification exception.
+
+154
+00:10:56,000 --> 00:11:01,000
+That means somebody modified the collection after Iterator had been created.
+
+155
+00:11:02,000 --> 00:11:07,000
+Iterate an object, noticed that and want to let us know that collections that we are iterating over
+
+156
+00:11:07,000 --> 00:11:09,000
+is not up to date.
+
+157
+00:11:09,000 --> 00:11:15,000
+And that information about elements that I will read with the help of this iterator is not relevant
+
+158
+00:11:15,000 --> 00:11:15,000
+anymore.
+
+159
+00:11:16,000 --> 00:11:19,000
+This type of iterator is called fail fast iterator.
+
+160
+00:11:20,000 --> 00:11:25,000
+That is default implementation of iterators in majority of collection implementations that are not developed
+
+161
+00:11:25,000 --> 00:11:27,000
+to be used in multithreaded environment.
+
+162
+00:11:28,000 --> 00:11:34,000
+What to do in this case, in case you have iterate to make sure there is no other place in your code
+
+163
+00:11:34,000 --> 00:11:36,000
+where you modify the same collection simultaneously.
+
+164
+00:11:37,000 --> 00:11:43,000
+If you do modify collections from different sets of execution, then you need failsafe iterator.
+
+165
+00:11:43,000 --> 00:11:47,000
+That is a second type of iterator that usually called failsafe.
+
+166
+00:11:48,000 --> 00:11:53,000
+Let me Corman's the concurrent modification demo code to be able to proceed with the next one and I
+
+167
+00:11:53,000 --> 00:11:55,000
+ran the program again.
+
+168
+00:11:55,000 --> 00:12:02,000
+Usually thread safe implementation of collections also implements failsafe iterator to explain in short
+
+169
+00:12:02,000 --> 00:12:04,000
+how it works without going deep into the details.
+
+170
+00:12:05,000 --> 00:12:11,000
+Failsafe Iterate that makes a copy of the internal data structure and iterate over the corporate data
+
+171
+00:12:11,000 --> 00:12:11,000
+structure.
+
+172
+00:12:12,000 --> 00:12:17,000
+And a structural modification done to the Iterator doesn't affect the copied data structure.
+
+173
+00:12:17,000 --> 00:12:20,000
+So original data structure is changed.
+
+174
+00:12:21,000 --> 00:12:26,000
+This type of iterator creates a snapshot and iterate over elements in this snapshot.
+
+175
+00:12:27,000 --> 00:12:30,000
+The drawback of such iterator type is obvious.
+
+176
+00:12:30,000 --> 00:12:36,000
+In some cases, you may not receive latest and up to date version of elements in case collection is
+
+177
+00:12:36,000 --> 00:12:38,000
+modified from the different threats.
+
+178
+00:12:39,000 --> 00:12:41,000
+But sometimes it might be not critical for you.
+
+179
+00:12:42,000 --> 00:12:48,000
+Here we have thread safe list implementation copy and write a list I initialize.
+
+180
+00:12:48,000 --> 00:12:50,000
+It was elements that are in our integers list.
+
+181
+00:12:51,000 --> 00:12:55,000
+I create iterator interface of the that is the same everywhere.
+
+182
+00:12:56,000 --> 00:12:58,000
+That's why I use the same variables that I had created.
+
+183
+00:12:59,000 --> 00:13:05,000
+As I already mentioned, failsafe iterators creates a snapshot of the container to prove this.
+
+184
+00:13:05,000 --> 00:13:13,000
+Here I add another integer to this container and now when I iterate over elements and as in previous
+
+185
+00:13:13,000 --> 00:13:15,000
+example, I remove elements from collection.
+
+186
+00:13:15,000 --> 00:13:19,000
+Without Iterator, I still bring elements from the container to the console.
+
+187
+00:13:20,000 --> 00:13:23,000
+But why not print the collection to console?
+
+188
+00:13:23,000 --> 00:13:27,000
+It has only one number that we added after iterator creation.
+
+189
+00:13:27,000 --> 00:13:33,000
+This proves that Iterator creates a snapshot with elements, and this snapshot is not updated as we
+
+190
+00:13:33,000 --> 00:13:36,000
+update collection after creation of Iterator.
+
+191
+00:13:37,000 --> 00:13:41,000
+There is also a third type of iterator that is called weakly consistent.
+
+192
+00:13:42,000 --> 00:13:48,000
+It is called so because this type of iterator can reflect some, but not necessarily all of the changes
+
+193
+00:13:48,000 --> 00:13:52,000
+that have been made to the collection since Iterator is created.
+
+194
+00:13:52,000 --> 00:13:53,000
+Let me show you this.
+
+195
+00:13:53,000 --> 00:14:00,000
+I declare a new variable of collection type parametrized with integer type an aggregate object of concurrent
+
+196
+00:14:00,000 --> 00:14:01,000
+linked deck.
+
+197
+00:14:01,000 --> 00:14:05,000
+This collection implementation has weekly consistent Iterator implementation.
+
+198
+00:14:06,000 --> 00:14:11,000
+I create an iterator and now attention similar to the previous example.
+
+199
+00:14:11,000 --> 00:14:14,000
+I add new integer here and now.
+
+200
+00:14:14,000 --> 00:14:20,000
+When I'm iterating over each element, I can see that new integer already was taken into account here.
+
+201
+00:14:21,000 --> 00:14:26,000
+But as it is said in the documentation, there is no guarantee that all updates to the collection will
+
+202
+00:14:26,000 --> 00:14:31,000
+be taken into account by the moment Iterator would reach the specific element.
+
+203
+00:14:31,000 --> 00:14:34,000
+I understand now what is really consistent iterator.
+
+204
+00:14:35,000 --> 00:14:39,000
+So now we may say that we learned three types of the iterator.
+
+205
+00:14:39,000 --> 00:14:44,000
+The last thing that I would like to learn with you today is a list iterator.
+
+206
+00:14:44,000 --> 00:14:46,000
+Let's look at this interface.
+
+207
+00:14:46,000 --> 00:14:51,000
+The first thing that you can see is that list rate that extends iterate the interface.
+
+208
+00:14:52,000 --> 00:14:58,000
+The main feature that is introduced list, right, is to iterate over elements in the reverse direction.
+
+209
+00:14:58,000 --> 00:15:04,000
+If Iterator can go over elements from the beginning to the end, the list rate that can go from the
+
+210
+00:15:04,000 --> 00:15:06,000
+end to the beginning.
+
+211
+00:15:06,000 --> 00:15:12,000
+It also declares mass that absent in iterator interface, Zaya has Hesperus.
+
+212
+00:15:12,000 --> 00:15:14,000
+It is similar to his next.
+
+213
+00:15:14,000 --> 00:15:21,000
+But check if there any element in another direction, previs returns the reference to the previous element
+
+214
+00:15:21,000 --> 00:15:29,000
+in the container next index to get the index of the next element, previous index it returns.
+
+215
+00:15:29,000 --> 00:15:36,000
+The element that would be returned by previous MassArt set replaces the last element that was returned.
+
+216
+00:15:36,000 --> 00:15:38,000
+And this is important to understand.
+
+217
+00:15:39,000 --> 00:15:46,000
+It replaces elements that was returned after the next or previous method in case that method is called
+
+218
+00:15:46,000 --> 00:15:51,000
+without calling next the previous method before that illegal state exception strong.
+
+219
+00:15:51,000 --> 00:15:59,000
+Add method adds element to the container so you can see a few more important features of the list iterator.
+
+220
+00:15:59,000 --> 00:16:05,000
+It also allows us to add element to the container during the iteration over elements or to substitute
+
+221
+00:16:05,000 --> 00:16:05,000
+elements.
+
+222
+00:16:06,000 --> 00:16:08,000
+Let's look at the list, iterator them.
+
+223
+00:16:08,000 --> 00:16:11,000
+Now, I created a separate file for that.
+
+224
+00:16:11,000 --> 00:16:13,000
+Let me also execute this program.
+
+225
+00:16:14,000 --> 00:16:17,000
+I have the same container was integers as in previous example.
+
+226
+00:16:17,000 --> 00:16:19,000
+The list interface declares list.
+
+227
+00:16:19,000 --> 00:16:20,000
+Iterate the method.
+
+228
+00:16:20,000 --> 00:16:25,000
+As you remember, this method returns as the objects of list iterator type.
+
+229
+00:16:26,000 --> 00:16:27,000
+One more interesting feature.
+
+230
+00:16:27,000 --> 00:16:31,000
+We can get at least iterator from the specific position if we need.
+
+231
+00:16:31,000 --> 00:16:36,000
+I can't imagine the case when I would use it, but it is interesting feature to know about.
+
+232
+00:16:36,000 --> 00:16:39,000
+List Iterator, for example.
+
+233
+00:16:39,000 --> 00:16:41,000
+Here I set List Iterator as a second index.
+
+234
+00:16:42,000 --> 00:16:48,000
+Here is a position of the cursor in the index zero here, position of the cursor in the index one and
+
+235
+00:16:48,000 --> 00:16:49,000
+here is two.
+
+236
+00:16:50,000 --> 00:16:54,000
+So the next goal of the previous method should return number two.
+
+237
+00:16:55,000 --> 00:16:59,000
+And now you can see in the console output that two is returned.
+
+238
+00:16:59,000 --> 00:17:02,000
+Now I want to update this element.
+
+239
+00:17:02,000 --> 00:17:06,000
+I call set method and pass twenty two this method.
+
+240
+00:17:06,000 --> 00:17:10,000
+So the elements that was returned previously is substituted with twenty.
+
+241
+00:17:11,000 --> 00:17:17,000
+So my next goal of the next method should return twenty and he and console you can see at least Iterator
+
+242
+00:17:17,000 --> 00:17:20,000
+works exactly in the way we expect it to work.
+
+243
+00:17:21,000 --> 00:17:27,000
+In case I want to add an element with the help of this iterator, I call add method and the item is
+
+244
+00:17:27,000 --> 00:17:29,000
+inserted right before the cursor.
+
+245
+00:17:30,000 --> 00:17:36,000
+So in case I added twenty one, I can get it now by calling the previous method and here's twenty one
+
+246
+00:17:37,000 --> 00:17:42,000
+and remove mass at the last item that was returned either by next or previous method.
+
+247
+00:17:43,000 --> 00:17:50,000
+In this case after location of remove method twenty one will be removed and here we printed all elements
+
+248
+00:17:50,000 --> 00:17:51,000
+to console to prove this.
+
+249
+00:17:52,000 --> 00:17:57,000
+Now, I believe you have a full understanding of how Étretat enlisted radar works.
+
+250
+00:17:57,000 --> 00:17:59,000
+Let's recap what we have learned today.
+
+251
+00:18:00,000 --> 00:18:02,000
+Today, we learned what iterable is.
+
+252
+00:18:02,000 --> 00:18:06,000
+We also understand what Iterator is now.
+
+253
+00:18:06,000 --> 00:18:12,000
+We know the difference between these two interfaces when real examples, we saw how Iterator works in
+
+254
+00:18:12,000 --> 00:18:13,000
+this lesson.
+
+255
+00:18:13,000 --> 00:18:18,000
+We saw what exceptions might be thrown by iterator, including concurrent modification, exception,
+
+256
+00:18:18,000 --> 00:18:23,000
+illegal state exception, unsupported aliment exception and no such aliment exception.
+
+257
+00:18:24,000 --> 00:18:29,000
+We learned three types of iterator fail fast, fail safe and weakly consistent.
+
+258
+00:18:30,000 --> 00:18:34,000
+And at the end of the lesson we learned at least iterator and how it works.
+
+259
+00:18:34,000 --> 00:18:36,000
+Now let's review your homework.
+
+260
+00:18:37,000 --> 00:18:43,000
+In short, you have to coordinate exercises here, you have to implement Iterator and Lisa the for the
+
+261
+00:18:43,000 --> 00:18:50,000
+default Miley's class that you implemented in scoping her homework about lists, read attentively all
+
+262
+00:18:50,000 --> 00:18:54,000
+the requirements here I prepared for you method signatures and description of interfaces.
+
+263
+00:18:55,000 --> 00:18:57,000
+All you have to do is implement methods.
+
+264
+00:18:58,000 --> 00:19:03,000
+You will see here some requirements related to exceptions in case you are not familiar with exceptions
+
+265
+00:19:03,000 --> 00:19:04,000
+topic.
+
+266
+00:19:04,000 --> 00:19:09,000
+There is absolutely no harm because I wrote the line of code that you have to write.
+
+267
+00:19:09,000 --> 00:19:15,000
+One exceptions should be thrown that said, don't skip this homework.
+
+268
+00:19:15,000 --> 00:19:17,000
+It is important for understanding of the topic.
+
+269
+00:19:18,000 --> 00:19:19,000
+Thanks a lot for your attention.
+
+270
+00:19:19,000 --> 00:19:21,000
+See you in the next lesson.
+
diff --git a/19 - Java Collections Framework/010 Source-code-of-the-examples-used-in-the-lesson.url b/19 - Java Collections Framework/010 Source-code-of-the-examples-used-in-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..35829c9b5653b53658183de8c02f6203b8821577
--- /dev/null
+++ b/19 - Java Collections Framework/010 Source-code-of-the-examples-used-in-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/collections/iterator
\ No newline at end of file
diff --git a/19 - Java Collections Framework/012 Homework.url b/19 - Java Collections Framework/012 Homework.url
new file mode 100644
index 0000000000000000000000000000000000000000..8c4c3272b974141032134f627fd7f1bc589d38f3
--- /dev/null
+++ b/19 - Java Collections Framework/012 Homework.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://docs.google.com/document/d/1EJinEXmADmEbqDnRdz9y6OITVDwhCN7K7FLMjbtE4zs/edit?usp=sharing
\ No newline at end of file
diff --git a/19 - Java Collections Framework/012 Queue and Deque_en.srt b/19 - Java Collections Framework/012 Queue and Deque_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..88732403d15a685e84b0bbead1d058e5cf80f6ce
--- /dev/null
+++ b/19 - Java Collections Framework/012 Queue and Deque_en.srt
@@ -0,0 +1,1072 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello, Jim.
+
+2
+00:00:06,000 --> 00:00:10,000
+Today, we are going to lunch with you and other collections of Iraq.
+
+3
+00:00:10,000 --> 00:00:15,000
+Today we'll talk about you interface and one more important interface that extends you, that is that
+
+4
+00:00:15,000 --> 00:00:19,000
+interface with the masses in interface.
+
+5
+00:00:19,000 --> 00:00:24,000
+And I hope you didn't skip lessons because in previous lessons during the General Overy, we already
+
+6
+00:00:24,000 --> 00:00:28,000
+talked about you and discussed Masset that this interface has.
+
+7
+00:00:29,000 --> 00:00:31,000
+But today we'll dive into the details.
+
+8
+00:00:31,000 --> 00:00:34,000
+After that, we'll learn methods in that interface.
+
+9
+00:00:34,000 --> 00:00:38,000
+Today, we're going to learn what is the difference between these two interfaces.
+
+10
+00:00:39,000 --> 00:00:44,000
+Also, we'll learn what FTF old principle is and what LIFO principle is.
+
+11
+00:00:45,000 --> 00:00:51,000
+After we learn interfaces, we'll take a look at the most popular Q and deck implementations.
+
+12
+00:00:51,000 --> 00:00:54,000
+And I will share with you practical tips and practical cases.
+
+13
+00:00:55,000 --> 00:01:00,000
+And at the end of the lesson, we are going to review your home task and I will explain how you can
+
+14
+00:01:00,000 --> 00:01:01,000
+practice your skills.
+
+15
+00:01:01,000 --> 00:01:07,000
+Let's start and to understand what CU is, we have to understand what FTF old principle is.
+
+16
+00:01:08,000 --> 00:01:16,000
+If you don't skip lessons, then you remember that FCF also is a method of organizing of a data structure
+
+17
+00:01:16,000 --> 00:01:22,000
+where the first elements that enter the queue, the first leifs is a Q, in other words, the head of
+
+18
+00:01:22,000 --> 00:01:30,000
+the queue always processed first f i f o stands for first in first out here on the slide you may see
+
+19
+00:01:30,000 --> 00:01:34,000
+brutalisation of the Q the Q has the head and the tail.
+
+20
+00:01:35,000 --> 00:01:41,000
+Students usually wondered where the heart of the Q is and where style of the Q by convention.
+
+21
+00:01:41,000 --> 00:01:49,000
+The end of the queue at which elements are added is called the tail back Oriya of the Q The end at which
+
+22
+00:01:49,000 --> 00:01:53,000
+elements are removed is called the hat or front of the Q.
+
+23
+00:01:53,000 --> 00:01:58,000
+Analogously two words used when people line up to wait for goods or services.
+
+24
+00:01:58,000 --> 00:02:00,000
+Does it make sense now?
+
+25
+00:02:00,000 --> 00:02:03,000
+If yes, then let's answer our next question.
+
+26
+00:02:03,000 --> 00:02:05,000
+Where Q is used.
+
+27
+00:02:05,000 --> 00:02:07,000
+Imagine that you have two services.
+
+28
+00:02:07,000 --> 00:02:11,000
+The first service is in charge of onboarding of new customer.
+
+29
+00:02:11,000 --> 00:02:18,000
+This service process information about the user verifies his payment method at him to the theorem,
+
+30
+00:02:18,000 --> 00:02:24,000
+checks whether this user already registered, etc. Let's call it onboarding service.
+
+31
+00:02:24,000 --> 00:02:30,000
+And another service is in charge of handling all payments from the user for his subscription on a monthly
+
+32
+00:02:30,000 --> 00:02:30,000
+basis.
+
+33
+00:02:31,000 --> 00:02:33,000
+Let's call this payment service.
+
+34
+00:02:33,000 --> 00:02:39,000
+Those are two independent services because the first one is in charge of selling subscriptions to customer
+
+35
+00:02:39,000 --> 00:02:41,000
+only on one side.
+
+36
+00:02:41,000 --> 00:02:47,000
+But they are different of the similar marketing sites that promotes different products and services
+
+37
+00:02:47,000 --> 00:02:47,000
+of the company.
+
+38
+00:02:48,000 --> 00:02:54,000
+Our onboarding service is one out of many services, but the service that is responsible for charging
+
+39
+00:02:54,000 --> 00:03:00,000
+clients on a monthly basis is used by all websites and systems within the same company.
+
+40
+00:03:01,000 --> 00:03:06,000
+This is real life scenarios that my team implemented in simplified form also.
+
+41
+00:03:06,000 --> 00:03:08,000
+But still, I believe you got my point.
+
+42
+00:03:08,000 --> 00:03:14,000
+And before process payment information from any of the website, the queue exists.
+
+43
+00:03:14,000 --> 00:03:21,000
+It exists right in the middle between all services and charge and service and all services, including
+
+44
+00:03:21,000 --> 00:03:25,000
+our onboarding service submits the message in the queue.
+
+45
+00:03:25,000 --> 00:03:33,000
+The message contains payment profile of our customer and product details and our payment service process.
+
+46
+00:03:33,000 --> 00:03:39,000
+All these messages one by one and implements all necessary logic related for recurring payments.
+
+47
+00:03:40,000 --> 00:03:41,000
+Does it make more sense now?
+
+48
+00:03:42,000 --> 00:03:43,000
+Can you understand now?
+
+49
+00:03:43,000 --> 00:03:45,000
+Why do we need Kyuss hope?
+
+50
+00:03:45,000 --> 00:03:49,000
+This brings more clarity and you understand why we need to use Qs.
+
+51
+00:03:50,000 --> 00:03:57,000
+OK, if you understood cuz let's understand what a deck is and to understand that we have to understand
+
+52
+00:03:57,000 --> 00:03:59,000
+what LIFO principle is.
+
+53
+00:04:00,000 --> 00:04:06,000
+LIFO is a method of organizing the manipulation of a data, whereas the last element that entered the
+
+54
+00:04:06,000 --> 00:04:09,000
+container should be processed first.
+
+55
+00:04:09,000 --> 00:04:12,000
+LIFO stands for Last In, First Out.
+
+56
+00:04:13,000 --> 00:04:19,000
+If you remember stack class that extends vector, that is also implementation of LIFO principle.
+
+57
+00:04:20,000 --> 00:04:23,000
+And on the screen you can see visualisation of stack.
+
+58
+00:04:23,000 --> 00:04:30,000
+But where we might want to apply LIFO principle, the easiest example of that usage, which you are
+
+59
+00:04:30,000 --> 00:04:32,000
+faced with on a daily basis, is in the clips.
+
+60
+00:04:33,000 --> 00:04:36,000
+Have you ever used and do operations in Eclipse?
+
+61
+00:04:36,000 --> 00:04:38,000
+How do you think the operation works?
+
+62
+00:04:39,000 --> 00:04:45,000
+Each batch of changes is put in the stack and then the case and those short cards is correct.
+
+63
+00:04:45,000 --> 00:04:48,000
+The latest separation is removed from the stack.
+
+64
+00:04:48,000 --> 00:04:51,000
+For example, you wrote Hello World.
+
+65
+00:04:51,000 --> 00:04:54,000
+The World World is on top of your stack.
+
+66
+00:04:54,000 --> 00:04:58,000
+When you want to run the operation, it leaves the stack first.
+
+67
+00:04:58,000 --> 00:05:00,000
+Or imagine your browser history.
+
+68
+00:05:00,000 --> 00:05:02,000
+You open new pages and then you need.
+
+69
+00:05:03,000 --> 00:05:10,000
+The return on the previous page or asset allocation in your Java program, we can call one message from
+
+70
+00:05:10,000 --> 00:05:16,000
+another one and after that call one more method how to track the flow of program execution only with
+
+71
+00:05:16,000 --> 00:05:23,000
+the help of the stack data structure that stores elements according to LIFO method that it makes more
+
+72
+00:05:23,000 --> 00:05:23,000
+sense.
+
+73
+00:05:23,000 --> 00:05:26,000
+Now, can you understand now when do we need stack?
+
+74
+00:05:27,000 --> 00:05:27,000
+Awesome.
+
+75
+00:05:28,000 --> 00:05:34,000
+And now when you understood what CU and DEC is and why we need them, I suggest dive deeper into the
+
+76
+00:05:34,000 --> 00:05:36,000
+details and learn interfaces.
+
+77
+00:05:36,000 --> 00:05:40,000
+Here is a new interface we have at and of a message here.
+
+78
+00:05:41,000 --> 00:05:43,000
+Both exist to add elements to the queue.
+
+79
+00:05:44,000 --> 00:05:47,000
+Both returns through in case element was added to the queue.
+
+80
+00:05:48,000 --> 00:05:52,000
+Then why do we need two similar methods and why do we need add method here?
+
+81
+00:05:52,000 --> 00:05:54,000
+If it is present in collection interface?
+
+82
+00:05:55,000 --> 00:06:01,000
+Let's understand the difference at that is present in queue interface to highlight the specific behavior
+
+83
+00:06:01,000 --> 00:06:06,000
+of that method in queue type add method adds elements to the queue.
+
+84
+00:06:06,000 --> 00:06:12,000
+But as you can see from the documentation here in legal state, exceptions will be thrown in case element
+
+85
+00:06:12,000 --> 00:06:15,000
+couldn't be added because of the capacity restrictions.
+
+86
+00:06:16,000 --> 00:06:21,000
+To be honest, in most of the cases you wouldn't see this error while working with the implementation
+
+87
+00:06:21,000 --> 00:06:23,000
+of the queue interface.
+
+88
+00:06:23,000 --> 00:06:23,000
+Why?
+
+89
+00:06:24,000 --> 00:06:29,000
+Because most of the implementations have no restrictions on capacity and their unbounded.
+
+90
+00:06:30,000 --> 00:06:34,000
+And in this case there is no difference between at and of.
+
+91
+00:06:34,000 --> 00:06:41,000
+A method of a method doesn't throw exception in case element is not added because of the capacity restrictions.
+
+92
+00:06:41,000 --> 00:06:44,000
+It also can return false hope.
+
+93
+00:06:44,000 --> 00:06:49,000
+This knowledge will help you during the interview, in case you will be asked what the difference is
+
+94
+00:06:49,000 --> 00:06:52,000
+between add and offer method in queue interface.
+
+95
+00:06:52,000 --> 00:06:53,000
+Let's move on.
+
+96
+00:06:53,000 --> 00:06:58,000
+We have two methods to retrieve elements from the heart of the queue and remove it from the queue.
+
+97
+00:06:59,000 --> 00:07:01,000
+Zaya, remove and pull.
+
+98
+00:07:01,000 --> 00:07:06,000
+The only difference between them is the way how they behave in case there are no more elements in the
+
+99
+00:07:06,000 --> 00:07:07,000
+queue.
+
+100
+00:07:07,000 --> 00:07:13,000
+Remove Masset in this case will throw no such element exception and Paul MassArt will just returns.
+
+101
+00:07:13,000 --> 00:07:16,000
+And now what do you see in real life?
+
+102
+00:07:16,000 --> 00:07:19,000
+I would say evaluate the logic of execution of your program.
+
+103
+00:07:19,000 --> 00:07:26,000
+First, in case you would ask me what method I would use, I would use full method and would just perform
+
+104
+00:07:26,000 --> 00:07:26,000
+null check.
+
+105
+00:07:27,000 --> 00:07:31,000
+I just afraid of all exceptions and I would rather opt for options.
+
+106
+00:07:31,000 --> 00:07:37,000
+That doesn't throw an exception, but all cases and programming styles are different and I can accept
+
+107
+00:07:37,000 --> 00:07:38,000
+that.
+
+108
+00:07:38,000 --> 00:07:40,000
+And that's why it's up to you.
+
+109
+00:07:40,000 --> 00:07:44,000
+Which method to choose is a similar situation with the next two methods.
+
+110
+00:07:45,000 --> 00:07:50,000
+We have two methods that allows us to get the elements from the head of the queue, but that don't remove
+
+111
+00:07:50,000 --> 00:07:54,000
+element from the queue zaya element and pick.
+
+112
+00:07:55,000 --> 00:07:58,000
+The only difference is that element Masad Maestro.
+
+113
+00:07:58,000 --> 00:08:03,000
+No such element exception in case there is no more aliments and big method would just return.
+
+114
+00:08:03,000 --> 00:08:06,000
+Now you already know what I would choose.
+
+115
+00:08:06,000 --> 00:08:09,000
+That's all methods that are declared in queue interface.
+
+116
+00:08:09,000 --> 00:08:14,000
+Let's move further and let's investigate what message do we have in that interface.
+
+117
+00:08:14,000 --> 00:08:22,000
+So as we already discussed, that extends queue interface and organizes data according to LIFG principle.
+
+118
+00:08:23,000 --> 00:08:28,000
+Let's review methods now that are present here in the top of our list.
+
+119
+00:08:28,000 --> 00:08:34,000
+We can find a lot of similar methods that can work with the head and with the tail of the queue at first
+
+120
+00:08:34,000 --> 00:08:37,000
+and at last of a first and of last.
+
+121
+00:08:38,000 --> 00:08:44,000
+Remove first and remove last, both first and last week first and pick last.
+
+122
+00:08:44,000 --> 00:08:46,000
+I believe it is clear how they work.
+
+123
+00:08:46,000 --> 00:08:52,000
+Since we discussed similar methods in queue interface, I noticed that there is no element first and
+
+124
+00:08:52,000 --> 00:08:57,000
+element last method if to follow the analogy in is naming.
+
+125
+00:08:57,000 --> 00:09:03,000
+But do we have methods that doesn't remove element from the queue and throws an exception in case there
+
+126
+00:09:03,000 --> 00:09:03,000
+is no element?
+
+127
+00:09:04,000 --> 00:09:08,000
+Yes, we have aget first and last method here.
+
+128
+00:09:08,000 --> 00:09:14,000
+They here also to interest in masses, remove first Securus and remove last appearance.
+
+129
+00:09:14,000 --> 00:09:20,000
+When we are referring to the first occurrence, we mean first in case we would reverse elements from
+
+130
+00:09:20,000 --> 00:09:21,000
+the had the tail.
+
+131
+00:09:21,000 --> 00:09:27,000
+So the first Securus will be closer to the heart of the queue and the last appearance is closer to the
+
+132
+00:09:27,000 --> 00:09:28,000
+tail of the queue.
+
+133
+00:09:29,000 --> 00:09:36,000
+After that abasic message from the queue go here and en masse, it adds all elements to the container,
+
+134
+00:09:36,000 --> 00:09:39,000
+the same as it is declared in connection interface.
+
+135
+00:09:39,000 --> 00:09:45,000
+There is only one clarification that all elements will be inserted into the end of the queue.
+
+136
+00:09:45,000 --> 00:09:47,000
+And here are static methods.
+
+137
+00:09:47,000 --> 00:09:53,000
+We already discussed what the stack is and here's a mass to manage stack push.
+
+138
+00:09:53,000 --> 00:09:55,000
+It adds element in the heart of the queue.
+
+139
+00:09:55,000 --> 00:09:58,000
+This method will throw illegal state exception in the case.
+
+140
+00:09:58,000 --> 00:10:02,000
+Element can't be added due to capacity restrictions.
+
+141
+00:10:02,000 --> 00:10:05,000
+This method is similar to at first method.
+
+142
+00:10:05,000 --> 00:10:08,000
+This is even specified in general documentation.
+
+143
+00:10:08,000 --> 00:10:10,000
+Then why do we need it at all?
+
+144
+00:10:11,000 --> 00:10:16,000
+For compatibility reasons with legacy class stack, the push and pop methods exist.
+
+145
+00:10:16,000 --> 00:10:21,000
+This means that they're only to make a transition of all code easier for programa.
+
+146
+00:10:22,000 --> 00:10:26,000
+The pop method is here and it is equivalent of remove first MassArt.
+
+147
+00:10:27,000 --> 00:10:32,000
+And I believe you already understood why Oracle left this method in this interface.
+
+148
+00:10:32,000 --> 00:10:36,000
+The last message that we didn't talk about is the sending iterator.
+
+149
+00:10:37,000 --> 00:10:42,000
+This message, according to the interface, should return iterator objects that can iterate over the
+
+150
+00:10:42,000 --> 00:10:44,000
+elements in reverse sequential order.
+
+151
+00:10:45,000 --> 00:10:50,000
+That is from the last element from our tail to the first element to our hat.
+
+152
+00:10:51,000 --> 00:10:54,000
+That's all matters that we have in our back interface.
+
+153
+00:10:54,000 --> 00:10:58,000
+Now let's investigate the most popular Q and deck implementations.
+
+154
+00:10:59,000 --> 00:11:05,000
+On this slide, you can see the most popular implementations of Q and back interfaces, I recommend
+
+155
+00:11:05,000 --> 00:11:08,000
+you post the video and read the slide attentively.
+
+156
+00:11:09,000 --> 00:11:13,000
+I believe there is no need to investigate each of these class in details.
+
+157
+00:11:13,000 --> 00:11:19,000
+It is better to put our focus on the most popular implementations, the most popular implementation,
+
+158
+00:11:19,000 --> 00:11:26,000
+in my opinion, and based on the official Oracle tutorials can be split in two major categories implementations
+
+159
+00:11:26,000 --> 00:11:30,000
+of the interface and implementations of just rescue interface.
+
+160
+00:11:30,000 --> 00:11:36,000
+In case you need the implementations, then most likely you will be happy with slinked list or array
+
+161
+00:11:36,000 --> 00:11:37,000
+that class.
+
+162
+00:11:37,000 --> 00:11:43,000
+If you need Q implementations, most likely you will opt for lenth list of priority queue if you need
+
+163
+00:11:43,000 --> 00:11:45,000
+thread safe implementations of the queue.
+
+164
+00:11:45,000 --> 00:11:50,000
+I would like to draw attention to avoid blocking Q and priority blocking queue.
+
+165
+00:11:50,000 --> 00:11:55,000
+If you need thread safe implementations of DEC, then your choice is linked lock and DEC.
+
+166
+00:11:56,000 --> 00:11:58,000
+As you can see there is really a lot of options.
+
+167
+00:11:59,000 --> 00:12:06,000
+But in my opinion and based on my experience in 95 percent of cases when you would need to use DEC implementation
+
+168
+00:12:06,000 --> 00:12:12,000
+to implement some stack or in case you would need Q you would use in case class the rest five percent
+
+169
+00:12:12,000 --> 00:12:17,000
+of cases is for thread safe implementation of the Q and DEC and also priority.
+
+170
+00:12:17,000 --> 00:12:25,000
+Q taking into account we already had lesson about Lindley's and we already learned the Q and DEC interfaces.
+
+171
+00:12:25,000 --> 00:12:29,000
+There will be nothing hard for you just to call these methods on linked list.
+
+172
+00:12:29,000 --> 00:12:34,000
+And that is why, for the sake of the demo, I would like to show you how AQ works on the example of
+
+173
+00:12:34,000 --> 00:12:35,000
+priority.
+
+174
+00:12:35,000 --> 00:12:38,000
+Q So here I prepared them file.
+
+175
+00:12:38,000 --> 00:12:43,000
+I will leave link to this file in attachments to the lesson so that you could copy and run this file
+
+176
+00:12:43,000 --> 00:12:44,000
+on your local computer.
+
+177
+00:12:45,000 --> 00:12:47,000
+Here I declare it variable of type.
+
+178
+00:12:47,000 --> 00:12:51,000
+Q Parametrized with the integer type here I created object of.
+
+179
+00:12:52,000 --> 00:12:57,000
+Q And in these lines you can see that I added to the Q five elements.
+
+180
+00:12:57,000 --> 00:13:00,000
+They are two eight three one then.
+
+181
+00:13:01,000 --> 00:13:05,000
+So in the case I'd like to take the first element in the Q what it would be.
+
+182
+00:13:06,000 --> 00:13:10,000
+Take your time to think about this question because this is a trick question.
+
+183
+00:13:11,000 --> 00:13:17,000
+We all know how Q works and what is a five for principle, but priority Q has interesting feature.
+
+184
+00:13:18,000 --> 00:13:22,000
+It automatically source elements according to the natural order.
+
+185
+00:13:22,000 --> 00:13:26,000
+I hope you didn't skip the lesson about comparator uncomparable.
+
+186
+00:13:26,000 --> 00:13:32,000
+And you know that natural order is an order that is described in the compared to method because of implementation
+
+187
+00:13:32,000 --> 00:13:33,000
+of comparable interface.
+
+188
+00:13:34,000 --> 00:13:40,000
+And that's where a provocative word comes from in the name of the Q it prioritize elements.
+
+189
+00:13:40,000 --> 00:13:46,000
+So in case I would prefer to control the elements from the head of the Q this would be one even despite
+
+190
+00:13:46,000 --> 00:13:50,000
+integer object was well your one wasn't inserted the first.
+
+191
+00:13:51,000 --> 00:13:53,000
+Let me run the program to show you this.
+
+192
+00:13:53,000 --> 00:13:57,000
+I used polymathic to get elements from the Q and remove it.
+
+193
+00:13:57,000 --> 00:14:04,000
+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,
+
+194
+00:14:04,000 --> 00:14:07,000
+but don't remove element here.
+
+195
+00:14:07,000 --> 00:14:11,000
+You can see in console output that our next object and our priority.
+
+196
+00:14:11,000 --> 00:14:13,000
+Q is to and the size of the peak.
+
+197
+00:14:14,000 --> 00:14:21,000
+It is still four because I didn't remove elements from the Q Pay attention to the fact that all elements
+
+198
+00:14:21,000 --> 00:14:22,000
+that you put into the priority.
+
+199
+00:14:22,000 --> 00:14:28,000
+Q should implement comparable interface because in case type doesn't implement comparable interface,
+
+200
+00:14:28,000 --> 00:14:35,000
+Breuer's UCU object would throw exception, glossiest exception that would say that your type cannot
+
+201
+00:14:35,000 --> 00:14:37,000
+be cast to comparable type.
+
+202
+00:14:37,000 --> 00:14:39,000
+Let me show you an example.
+
+203
+00:14:39,000 --> 00:14:46,000
+Let me comment these lines of code here, you can see that I create Q Parametrized by product type.
+
+204
+00:14:46,000 --> 00:14:53,000
+Just to remind you, product is our custom type that we created during our work on online store implementation.
+
+205
+00:14:53,000 --> 00:14:56,000
+After that, I want to place my product into this.
+
+206
+00:14:56,000 --> 00:15:04,000
+Q Let me run the program to show you what would happen and here you can see glass cast exception.
+
+207
+00:15:04,000 --> 00:15:05,000
+What to do now?
+
+208
+00:15:06,000 --> 00:15:07,000
+We have two options here.
+
+209
+00:15:08,000 --> 00:15:13,000
+The first one is to use only types that implement comparable interface.
+
+210
+00:15:13,000 --> 00:15:16,000
+The second option is to set our priority.
+
+211
+00:15:16,000 --> 00:15:18,000
+Q How to compare elements.
+
+212
+00:15:18,000 --> 00:15:23,000
+Let me comment these lines of code to show you the next example here.
+
+213
+00:15:23,000 --> 00:15:29,000
+You can see that I created the same Q Parametrized by product type, but I pass the product comparison
+
+214
+00:15:29,000 --> 00:15:31,000
+to the constructor of prosecute.
+
+215
+00:15:32,000 --> 00:15:40,000
+Now my project knows how to compare products and saw them let me run the program and we can't see error
+
+216
+00:15:40,000 --> 00:15:40,000
+anymore.
+
+217
+00:15:41,000 --> 00:15:47,000
+That is because our Q knows how to prioritize products, where to use priority.
+
+218
+00:15:47,000 --> 00:15:51,000
+Q Imagine that you want to implement helpdesk during the day.
+
+219
+00:15:51,000 --> 00:15:57,000
+You receive tons of requests and complaints, but you have limited number of operators in your company
+
+220
+00:15:57,000 --> 00:15:58,000
+that can.
+
+221
+00:15:58,000 --> 00:16:05,000
+These requests and you have special app for your operators where each operator can click a button,
+
+222
+00:16:05,000 --> 00:16:12,000
+they can request and move it in progress, and it is obvious that most critical requests should be processed
+
+223
+00:16:12,000 --> 00:16:18,000
+first in case a customer can't make a payment in the online store or customer already paid.
+
+224
+00:16:18,000 --> 00:16:23,000
+But some error happened and he or she can't get details of his order.
+
+225
+00:16:23,000 --> 00:16:29,000
+That is more critical than some random question, like one sorting by manufacturer will be implemented
+
+226
+00:16:29,000 --> 00:16:30,000
+on your site.
+
+227
+00:16:30,000 --> 00:16:37,000
+They agree with me and what you have to do probably on the front end, you would implement some dropdown
+
+228
+00:16:37,000 --> 00:16:40,000
+where you would ask your customer to categorize request.
+
+229
+00:16:41,000 --> 00:16:47,000
+For example, here on the slide you can see example of support of Panya in your system.
+
+230
+00:16:47,000 --> 00:16:50,000
+You have some object, something like support ticket type.
+
+231
+00:16:50,000 --> 00:16:54,000
+You also have to implement logic that would assign support ticket type.
+
+232
+00:16:54,000 --> 00:17:00,000
+And based on the type of the request, you would assign priority, high, medium or low.
+
+233
+00:17:00,000 --> 00:17:04,000
+And after that you would pull your support ticket object into the queue.
+
+234
+00:17:05,000 --> 00:17:11,000
+And you already know that we have to either implement compatible interface in our support ticket or
+
+235
+00:17:11,000 --> 00:17:14,000
+we have to create a competitor and pass it to priority queue.
+
+236
+00:17:14,000 --> 00:17:15,000
+Interesting.
+
+237
+00:17:15,000 --> 00:17:17,000
+I hope it is.
+
+238
+00:17:17,000 --> 00:17:23,000
+And moreover, implementing something like this already a real life task for our software engineer.
+
+239
+00:17:23,000 --> 00:17:25,000
+This will be your homework.
+
+240
+00:17:25,000 --> 00:17:30,000
+But before I would share with you the details of your homework, let's recap what we have learned today.
+
+241
+00:17:31,000 --> 00:17:33,000
+Today we learned Q and DEC interfaces.
+
+242
+00:17:34,000 --> 00:17:38,000
+We learned in detail how matters that are described in these interfaces work.
+
+243
+00:17:39,000 --> 00:17:43,000
+We learned what a FFO and LIFO data store methods are.
+
+244
+00:17:44,000 --> 00:17:49,000
+We used you and DEC implementations and learned the most popular ones after that.
+
+245
+00:17:49,000 --> 00:17:56,000
+On the real example, we learned how particular works and now I suggest reviewing your homework.
+
+246
+00:17:56,000 --> 00:18:02,000
+You have to implement helpdesk facades that would serve as a main interface for a support engineer to
+
+247
+00:18:02,000 --> 00:18:09,000
+interact with the system, helpdesk facade interface has only three masses that you support.
+
+248
+00:18:09,000 --> 00:18:16,000
+You could get next support ticket and get a number of tickets according to our requirements, get next
+
+249
+00:18:16,000 --> 00:18:16,000
+support ticket.
+
+250
+00:18:16,000 --> 00:18:20,000
+Masset will be called when your support engineer would click on the button.
+
+251
+00:18:21,000 --> 00:18:24,000
+This message should return top priority item.
+
+252
+00:18:24,000 --> 00:18:29,000
+I almost explained to you how to implement Help Desk in the online store.
+
+253
+00:18:29,000 --> 00:18:35,000
+Here you can find the details about what request type might be and priority for specific request type
+
+254
+00:18:36,000 --> 00:18:42,000
+during the creation of the support ticket will specify only typos request and its priority is defined
+
+255
+00:18:42,000 --> 00:18:45,000
+automatically based on the Moppin that are written down in the table.
+
+256
+00:18:46,000 --> 00:18:48,000
+And there is one more requirement in the case.
+
+257
+00:18:48,000 --> 00:18:51,000
+Support tickets have the same priority.
+
+258
+00:18:51,000 --> 00:18:54,000
+The one that was created earlier should be processed first.
+
+259
+00:18:55,000 --> 00:18:57,000
+I can give you a small hint here.
+
+260
+00:18:57,000 --> 00:18:58,000
+You can implement counter.
+
+261
+00:18:59,000 --> 00:19:04,000
+This even might be static field and you may consider the value of this field when you would compare
+
+262
+00:19:04,000 --> 00:19:06,000
+to support tickets, for example.
+
+263
+00:19:06,000 --> 00:19:08,000
+Does it make sense home?
+
+264
+00:19:08,000 --> 00:19:09,000
+The task is clear for you.
+
+265
+00:19:10,000 --> 00:19:15,000
+This is a really interesting task that will help you a lot in understanding of the cues and will give
+
+266
+00:19:15,000 --> 00:19:17,000
+you some clues to real life experience.
+
+267
+00:19:18,000 --> 00:19:19,000
+Thank you all for your attention.
+
+268
+00:19:19,000 --> 00:19:22,000
+Have a great day and see you in the next lesson.
+
diff --git a/19 - Java Collections Framework/012 Solution-for-Homework-Back-end-system-for-help-desk.url b/19 - Java Collections Framework/012 Solution-for-Homework-Back-end-system-for-help-desk.url
new file mode 100644
index 0000000000000000000000000000000000000000..ed0e82cace692999aa0e9e9252f63c3046269179
--- /dev/null
+++ b/19 - Java Collections Framework/012 Solution-for-Homework-Back-end-system-for-help-desk.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/hw/onlinestore/withlist/helpdesk
\ No newline at end of file
diff --git a/19 - Java Collections Framework/012 Source-code-of-the-example-used-in-the-lesson.url b/19 - Java Collections Framework/012 Source-code-of-the-example-used-in-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..a6cde62a061a9a924ac0b8728174105663d0dded
--- /dev/null
+++ b/19 - Java Collections Framework/012 Source-code-of-the-example-used-in-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/collections/queue/QueueDemo.java
\ No newline at end of file
diff --git a/19 - Java Collections Framework/014 Map Hierarchy_en.srt b/19 - Java Collections Framework/014 Map Hierarchy_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..a82fc55f6abf3c6bb5f79e61d478ffaebad4cefd
--- /dev/null
+++ b/19 - Java Collections Framework/014 Map Hierarchy_en.srt
@@ -0,0 +1,876 @@
+1
+00:00:06,000 --> 00:00:11,000
+Hello, dear students, today we have important topic we are going to review another Iraq of Java collections
+
+2
+00:00:11,000 --> 00:00:14,000
+framework that is MOP Iraqi today.
+
+3
+00:00:14,000 --> 00:00:16,000
+We are going to run map interface.
+
+4
+00:00:16,000 --> 00:00:20,000
+We are also going to review such interfaces like sorted map and navigable map.
+
+5
+00:00:21,000 --> 00:00:26,000
+I'm going to hold overview of implementations of map interface and what features they have.
+
+6
+00:00:27,000 --> 00:00:32,000
+Also, we'll talk about what the dictionary is and how hash tablecloth is different from hash map.
+
+7
+00:00:32,000 --> 00:00:37,000
+After we learn, Ceri will focus on map interface and its methods.
+
+8
+00:00:37,000 --> 00:00:39,000
+Your review of map interface.
+
+9
+00:00:39,000 --> 00:00:41,000
+We also will learn what entry type is.
+
+10
+00:00:42,000 --> 00:00:46,000
+As you can see that we have a lot of things to learn in our plans.
+
+11
+00:00:46,000 --> 00:00:53,000
+Let's start and I'd like to start with you from the overview of Map Iraqi first and the key features
+
+12
+00:00:53,000 --> 00:00:53,000
+of MAP.
+
+13
+00:00:54,000 --> 00:01:00,000
+And after we learn this, we are going to dive deeper in the details to investigate each interface in
+
+14
+00:01:00,000 --> 00:01:04,000
+particular on the top of our Iraqi, we have map interface.
+
+15
+00:01:04,000 --> 00:01:07,000
+This type exists to map keys to values.
+
+16
+00:01:07,000 --> 00:01:11,000
+All keys are unique, various may be duplicated.
+
+17
+00:01:11,000 --> 00:01:15,000
+And there are a lot of places and our programs where we can apply map implementations.
+
+18
+00:01:16,000 --> 00:01:22,000
+If you remember on one of the lessons I showed you example of mobile app for sports betting tips, for
+
+19
+00:01:22,000 --> 00:01:26,000
+example, we can receive from server a lot of sports events.
+
+20
+00:01:26,000 --> 00:01:33,000
+After that, we can group them by date and your keyword would be the specific date and the value would
+
+21
+00:01:33,000 --> 00:01:38,000
+be a collection of sporting events on this day or another example, recently you have implemented Home
+
+22
+00:01:38,000 --> 00:01:40,000
+Task Help Desk.
+
+23
+00:01:40,000 --> 00:01:41,000
+In that task.
+
+24
+00:01:41,000 --> 00:01:44,000
+You also could use map implementations to map support.
+
+25
+00:01:44,000 --> 00:01:47,000
+Request type was its priority.
+
+26
+00:01:47,000 --> 00:01:53,000
+In this case, support request type would be the key and it will be unique and priority would be the
+
+27
+00:01:53,000 --> 00:01:55,000
+value and can be duplicated.
+
+28
+00:01:56,000 --> 00:02:01,000
+And I keep creating examples on the fly because there really are a lot of cases where you need some
+
+29
+00:02:01,000 --> 00:02:04,000
+data structure where you would store key value pass.
+
+30
+00:02:04,000 --> 00:02:07,000
+OK, so we really understood why we need map.
+
+31
+00:02:07,000 --> 00:02:14,000
+Now let's understand what specific different implementations of map interface have abstract map use
+
+32
+00:02:14,000 --> 00:02:21,000
+implementations for some of the methods of map interface, hash map implementation of map interface.
+
+33
+00:02:21,000 --> 00:02:27,000
+IT stores element using the mechanism of hash tables that guarantees constant amount of time for each
+
+34
+00:02:27,000 --> 00:02:29,000
+region and place elements.
+
+35
+00:02:29,000 --> 00:02:33,000
+That's why everyone loves hash map linked hash map.
+
+36
+00:02:33,000 --> 00:02:38,000
+Besides storing elements also memorized the sequence of adding entries in the map.
+
+37
+00:02:39,000 --> 00:02:46,000
+So the order of elements during the iteration is predictable because linked hash map maintains the list
+
+38
+00:02:46,000 --> 00:02:48,000
+ran through all of its entries.
+
+39
+00:02:48,000 --> 00:02:55,000
+If we need thread safe implementation of the map, we would opt for concurrent hash map that implements
+
+40
+00:02:55,000 --> 00:02:56,000
+concurrent map.
+
+41
+00:02:56,000 --> 00:02:58,000
+That in turn extends map interface.
+
+42
+00:02:59,000 --> 00:03:03,000
+We have a few more interfaces that extend map interface.
+
+43
+00:03:03,000 --> 00:03:10,000
+Zaya sorted map and navigable map sort of map provides ordering of a map based on its case.
+
+44
+00:03:11,000 --> 00:03:17,000
+The map is ordered according to the natural order of its keys that is defined according to implementation
+
+45
+00:03:17,000 --> 00:03:25,000
+of comparable interface or alternatively, Solin order may be defined by comparator navigable map extensors
+
+46
+00:03:25,000 --> 00:03:31,000
+map and provides developers with possibility to return the closest matches for given such targets.
+
+47
+00:03:31,000 --> 00:03:38,000
+The most popular implementations of this interface are three map and concurrence key place map for multithreaded
+
+48
+00:03:38,000 --> 00:03:39,000
+environment.
+
+49
+00:03:40,000 --> 00:03:42,000
+We also have APSA class dictionary.
+
+50
+00:03:42,000 --> 00:03:48,000
+How it is different from the map interface you can reclass was created in Java version one and supposed
+
+51
+00:03:48,000 --> 00:03:52,000
+to be a parent class for all types that map keys to values.
+
+52
+00:03:52,000 --> 00:03:58,000
+Since multiple inheritance in Java is not supported by the map interface was introduced in Java version
+
+53
+00:03:58,000 --> 00:03:58,000
+two.
+
+54
+00:03:59,000 --> 00:04:05,000
+So I would say that dictionary is an old version of map interface and that is considered as an obsolete
+
+55
+00:04:05,000 --> 00:04:07,000
+and use of map is preferred.
+
+56
+00:04:08,000 --> 00:04:13,000
+But still, you might be asked about dictionary during the interview and for your common Java literacy,
+
+57
+00:04:13,000 --> 00:04:15,000
+you have to be aware about it.
+
+58
+00:04:16,000 --> 00:04:21,000
+Hash table is a concrete class that extends the dictionary type and internments map interface.
+
+59
+00:04:22,000 --> 00:04:27,000
+It was considered as a thread safe version of hash map unless concurrent hash map was introduced in
+
+60
+00:04:27,000 --> 00:04:33,000
+Java version five, the synchronization mechanism is not so efficient as it is implemented in concurrent
+
+61
+00:04:33,000 --> 00:04:37,000
+Hashmat, in case you are not familiar with the trending topic.
+
+62
+00:04:37,000 --> 00:04:42,000
+That would explain the difference in the implementation of low interest rate and support in these classes.
+
+63
+00:04:42,000 --> 00:04:46,000
+In simple words, hash table closes the door in your home.
+
+64
+00:04:46,000 --> 00:04:53,000
+Concurrent hash map closes a separate doors in your home to allow everyone to walk around the home until
+
+65
+00:04:53,000 --> 00:04:54,000
+only one room is closed.
+
+66
+00:04:55,000 --> 00:05:01,000
+Can you feel the difference in implementation of concurrency support in these two classes and meet later
+
+67
+00:05:01,000 --> 00:05:02,000
+in the separate lessons?
+
+68
+00:05:02,000 --> 00:05:08,000
+We are going to learn multithreaded together and we will get back to a thread safe map implementations.
+
+69
+00:05:09,000 --> 00:05:11,000
+That's how MAP Iraqis look like.
+
+70
+00:05:11,000 --> 00:05:16,000
+Before we proceed with the details, I want to finish the topic of differences between hash map and
+
+71
+00:05:16,000 --> 00:05:17,000
+hash table.
+
+72
+00:05:18,000 --> 00:05:24,000
+So the first thing that is different we already discussed on MassArt and hash table are synchronized.
+
+73
+00:05:24,000 --> 00:05:28,000
+And that's why hash table is considered to be a thread safe map.
+
+74
+00:05:28,000 --> 00:05:33,000
+Hash table also does not allow news, a new case nor new values.
+
+75
+00:05:33,000 --> 00:05:39,000
+On the other hand, hash map allows us to store one key and multiple values.
+
+76
+00:05:39,000 --> 00:05:43,000
+Hash table is a legacy class, whereas hash map is newer.
+
+77
+00:05:44,000 --> 00:05:50,000
+And now I suggest opening the source code of map interface to learn that the communication and methods
+
+78
+00:05:50,000 --> 00:05:53,000
+of this interface here is map interface.
+
+79
+00:05:53,000 --> 00:06:00,000
+Pay attention to this interface doesn't extend iterable interface like collection while review and map
+
+80
+00:06:00,000 --> 00:06:00,000
+interface.
+
+81
+00:06:00,000 --> 00:06:06,000
+I'm going to use and work by saying entry, I would always mean the key value pair.
+
+82
+00:06:06,000 --> 00:06:11,000
+Is it clear, for example, size returns, amount of entries in the map.
+
+83
+00:06:12,000 --> 00:06:16,000
+In other words, a number of key value pairs is empty.
+
+84
+00:06:16,000 --> 00:06:18,000
+This is self-described Macit.
+
+85
+00:06:18,000 --> 00:06:25,000
+It checks whether the current map is empty or no, contains key verifies whether a map contains specific
+
+86
+00:06:25,000 --> 00:06:32,000
+contains value, similar method to check value in map, yet method to get value from the map we have
+
+87
+00:06:32,000 --> 00:06:32,000
+to use.
+
+88
+00:06:33,000 --> 00:06:37,000
+So we ask you to get Masset to retrieve our value.
+
+89
+00:06:37,000 --> 00:06:39,000
+There is no method in map.
+
+90
+00:06:39,000 --> 00:06:41,000
+Instead, we have put method.
+
+91
+00:06:41,000 --> 00:06:44,000
+We can put key value pair in map.
+
+92
+00:06:44,000 --> 00:06:47,000
+That's why put method takes two arguments.
+
+93
+00:06:48,000 --> 00:06:50,000
+Pay attention to the return tab here.
+
+94
+00:06:50,000 --> 00:06:56,000
+Imagine that you put in map integer value one and some customer reference type user as a value to the
+
+95
+00:06:56,000 --> 00:07:01,000
+map in this case, but will return now and now.
+
+96
+00:07:01,000 --> 00:07:07,000
+Imagine that you put new value but with the same key you call put MassArt again was integer value one
+
+97
+00:07:07,000 --> 00:07:09,000
+and new user object.
+
+98
+00:07:09,000 --> 00:07:15,000
+In this case, both method will return the value that was previously associated with the key.
+
+99
+00:07:15,000 --> 00:07:16,000
+That means previous user.
+
+100
+00:07:17,000 --> 00:07:18,000
+Does it make sense?
+
+101
+00:07:18,000 --> 00:07:24,000
+If you want to remove some entry from the map, you have to call remove Masset and Paskey as a method
+
+102
+00:07:24,000 --> 00:07:29,000
+argument map interface, declare methods for bulk operations, for example.
+
+103
+00:07:29,000 --> 00:07:33,000
+Put all method can add all entries from one object to another.
+
+104
+00:07:34,000 --> 00:07:35,000
+Clear message.
+
+105
+00:07:35,000 --> 00:07:38,000
+Remove all mappings from the current map object.
+
+106
+00:07:38,000 --> 00:07:44,000
+He has said massive returns contain the offset type that contains only keys from this map object.
+
+107
+00:07:44,000 --> 00:07:45,000
+Why set?
+
+108
+00:07:46,000 --> 00:07:48,000
+Because all keys are unique and map.
+
+109
+00:07:48,000 --> 00:07:51,000
+That's why I said type is returned.
+
+110
+00:07:51,000 --> 00:07:57,000
+In case we want to retrieve all whaler's from the map, we have to call values method that returns collection
+
+111
+00:07:57,000 --> 00:07:58,000
+of elements.
+
+112
+00:07:58,000 --> 00:07:59,000
+Why collection?
+
+113
+00:08:00,000 --> 00:08:03,000
+Because values are not unique and collection is returned.
+
+114
+00:08:04,000 --> 00:08:10,000
+Here's one more very useful method and set this massive return set of entries of this map.
+
+115
+00:08:10,000 --> 00:08:15,000
+Each key value pair is represented as a single object of type entry.
+
+116
+00:08:15,000 --> 00:08:17,000
+You really understand why set returned?
+
+117
+00:08:18,000 --> 00:08:23,000
+Because each key value pair is unique and three is in our interface in map.
+
+118
+00:08:24,000 --> 00:08:25,000
+Let's look at it.
+
+119
+00:08:25,000 --> 00:08:29,000
+Entry type has to match assets that are used more often than others.
+
+120
+00:08:29,000 --> 00:08:32,000
+They are yet key and get value.
+
+121
+00:08:32,000 --> 00:08:39,000
+For example, we can iterate over a set of entries in foreach loop and in the foreach loop body we can
+
+122
+00:08:39,000 --> 00:08:42,000
+use reference to the entry object together is a key or value.
+
+123
+00:08:43,000 --> 00:08:45,000
+It depends on what exactly we need.
+
+124
+00:08:45,000 --> 00:08:46,000
+According to our logic.
+
+125
+00:08:47,000 --> 00:08:51,000
+There are also other methods that data on my opinion are not used very often.
+
+126
+00:08:51,000 --> 00:08:53,000
+For example, set value.
+
+127
+00:08:53,000 --> 00:08:57,000
+It allows us to set value associated with the current key in the entry.
+
+128
+00:08:57,000 --> 00:09:03,000
+In my opinion, if there would be such need, I mean to update the value associated with a specific
+
+129
+00:09:03,000 --> 00:09:09,000
+key, most likely you want to do this with entry time, but instead we'll just call good method with
+
+130
+00:09:09,000 --> 00:09:12,000
+the same key on map object to update the value.
+
+131
+00:09:13,000 --> 00:09:18,000
+But probably one day you would face with the case that while iterating over entries, you need to implement
+
+132
+00:09:18,000 --> 00:09:24,000
+logic that under some specific conditions you have to update value that is associated with a specific
+
+133
+00:09:24,000 --> 00:09:25,000
+key.
+
+134
+00:09:25,000 --> 00:09:29,000
+And for this case, you already know what method can help you with that.
+
+135
+00:09:30,000 --> 00:09:32,000
+You can see equals and hash code.
+
+136
+00:09:32,000 --> 00:09:38,000
+You already know these methods and also entry has a few interesting static methods.
+
+137
+00:09:38,000 --> 00:09:41,000
+We are going to use them in our next lessons.
+
+138
+00:09:41,000 --> 00:09:41,000
+Right now.
+
+139
+00:09:41,000 --> 00:09:48,000
+Let me explain you and see what I say about we have comparing biochem assets at source entries by case
+
+140
+00:09:48,000 --> 00:09:55,000
+in case there implement comparable interface and we compare the parameter in case keys don't implement
+
+141
+00:09:55,000 --> 00:09:56,000
+comparable interface.
+
+142
+00:09:57,000 --> 00:10:03,000
+These methods return compared to that we can use to search and now attention to search our entries set,
+
+143
+00:10:04,000 --> 00:10:06,000
+but not elements in map bytes key.
+
+144
+00:10:07,000 --> 00:10:12,000
+And we also have comparing by value method that returns comparisons that can compare entries set by
+
+145
+00:10:12,000 --> 00:10:13,000
+values.
+
+146
+00:10:13,000 --> 00:10:16,000
+Imagine that you want to search your map by.
+
+147
+00:10:16,000 --> 00:10:21,000
+Well, to be honest, compared to that source, my case is not so cool.
+
+148
+00:10:21,000 --> 00:10:21,000
+Why?
+
+149
+00:10:22,000 --> 00:10:27,000
+Because we can create object of three map and put all elements from any map there and elements will
+
+150
+00:10:27,000 --> 00:10:31,000
+be sorted automatically by case, but sorting by various.
+
+151
+00:10:31,000 --> 00:10:36,000
+That is really helpful compared to now when we answer it, what entry type is.
+
+152
+00:10:36,000 --> 00:10:43,000
+Let's investigate what matters are left here in the map interface equals and hash good methods and.
+
+153
+00:10:44,000 --> 00:10:49,000
+The default message I described, for example, here is interesting and useful message.
+
+154
+00:10:49,000 --> 00:10:55,000
+Imagine that you need to get away from that, but you don't want to get new in case Element is absent
+
+155
+00:10:55,000 --> 00:10:56,000
+in map.
+
+156
+00:10:56,000 --> 00:11:03,000
+Instead, you would like to get some default value we can call yet or default to retrieve element by
+
+157
+00:11:03,000 --> 00:11:09,000
+key in case and market for such key present or to return default value in case there is no mapping for
+
+158
+00:11:09,000 --> 00:11:10,000
+such key.
+
+159
+00:11:10,000 --> 00:11:17,000
+Pay attention to the fact that in case we exist and values that is associated with this key is no value,
+
+160
+00:11:18,000 --> 00:11:19,000
+then no will be returned.
+
+161
+00:11:20,000 --> 00:11:24,000
+Default value will be returned only in case there is no such key in the map.
+
+162
+00:11:25,000 --> 00:11:30,000
+For each matsutake takes function that should be applied for each and every one will return functional
+
+163
+00:11:30,000 --> 00:11:31,000
+programming with Java.
+
+164
+00:11:32,000 --> 00:11:34,000
+That will show you how you can apply this method.
+
+165
+00:11:35,000 --> 00:11:41,000
+Replace all text functions that will be applied to each entry and each entry in turn will be substituted
+
+166
+00:11:41,000 --> 00:11:44,000
+with the result that will be returned by this function.
+
+167
+00:11:44,000 --> 00:11:51,000
+But if absent method should be used when you don't want to override the values that is already associated
+
+168
+00:11:51,000 --> 00:11:52,000
+with a specific key.
+
+169
+00:11:52,000 --> 00:11:59,000
+So new value will be put into the map only in case there is no entry with such key or keys associated
+
+170
+00:11:59,000 --> 00:11:59,000
+with no value.
+
+171
+00:12:00,000 --> 00:12:05,000
+The removal method can help you to remove entry by specifying the key value pair here.
+
+172
+00:12:05,000 --> 00:12:06,000
+Also replace MassArt.
+
+173
+00:12:07,000 --> 00:12:12,000
+They are different from Puth method because you can say that you want to replace Element only with a
+
+174
+00:12:12,000 --> 00:12:19,000
+specific key and with a specific value, or in case of overall that method only in case such key exists.
+
+175
+00:12:20,000 --> 00:12:24,000
+Comparative absence method allows you to compute value in case he is absent.
+
+176
+00:12:24,000 --> 00:12:30,000
+We can pass the keys that doesn't exist in map and function that can compute new value.
+
+177
+00:12:30,000 --> 00:12:34,000
+In case such care exists, the value won't be updated.
+
+178
+00:12:34,000 --> 00:12:41,000
+Compute if present method takes key and functions that can compute the value based on the current key
+
+179
+00:12:41,000 --> 00:12:47,000
+and previous value that is associated with it in case he exists and previous value is not.
+
+180
+00:12:47,000 --> 00:12:53,000
+Now, the result of the function will be associated with this key compute method.
+
+181
+00:12:53,000 --> 00:12:59,000
+Attempts to compute and mapping for the specified key and its current mapped value is there is no current
+
+182
+00:12:59,000 --> 00:12:59,000
+mapping.
+
+183
+00:13:00,000 --> 00:13:02,000
+Mersch method works in the following way.
+
+184
+00:13:03,000 --> 00:13:08,000
+It is a specified key, is not already associated with a value or is associated with.
+
+185
+00:13:08,000 --> 00:13:11,000
+Now associate it with the given no new value.
+
+186
+00:13:12,000 --> 00:13:19,000
+Otherwise replace the associated value with the results of the given remapping function or removes if
+
+187
+00:13:19,000 --> 00:13:21,000
+the result is now lost for assets.
+
+188
+00:13:21,000 --> 00:13:24,000
+Require knowledge of functional programming in Java.
+
+189
+00:13:24,000 --> 00:13:29,000
+That's why they will be reviewed in detail separately in the lessons about functional programming.
+
+190
+00:13:30,000 --> 00:13:37,000
+Right now it is enough high level understanding what this message do, and now we are done with all
+
+191
+00:13:37,000 --> 00:13:42,000
+default methods in my interface and it is time to review static methods in this interface.
+
+192
+00:13:43,000 --> 00:13:49,000
+Here we see overloaded static method with the name of this method, say here since Java version nine
+
+193
+00:13:49,000 --> 00:13:51,000
+and they can create immutable.
+
+194
+00:13:51,000 --> 00:13:56,000
+That also means unverifiable map that contains a limited number of mappings.
+
+195
+00:13:57,000 --> 00:14:02,000
+And you can see that the only difference between all of these methods is a number of mappings that it
+
+196
+00:14:02,000 --> 00:14:04,000
+takes as a parameter.
+
+197
+00:14:05,000 --> 00:14:10,000
+Here's a method that takes variable lengths, argument of type entry, and based on these creates and
+
+198
+00:14:10,000 --> 00:14:18,000
+modifiable map and remasters returns and modifiable entry type based on the key value pair that is passed
+
+199
+00:14:18,000 --> 00:14:20,000
+to the method, why this method is needed.
+
+200
+00:14:20,000 --> 00:14:26,000
+This method is needed, for example, for the previous method that we have just discussed, because
+
+201
+00:14:26,000 --> 00:14:31,000
+you want to eliminate the case when your entries changed because somebody got access to it by reference.
+
+202
+00:14:32,000 --> 00:14:35,000
+That's why you might want to create an modifiable entry first.
+
+203
+00:14:35,000 --> 00:14:37,000
+And this method will help you in that.
+
+204
+00:14:38,000 --> 00:14:41,000
+And the last but not least method for today is copy of.
+
+205
+00:14:42,000 --> 00:14:48,000
+If we want to create the copy of the map that nobody will be able to modify, we have to call this method
+
+206
+00:14:48,000 --> 00:14:52,000
+and parse the map that we want to copy as an argument to this method.
+
+207
+00:14:53,000 --> 00:14:55,000
+That's all method for map interface.
+
+208
+00:14:55,000 --> 00:15:00,000
+I believe that right now, you know, map interface even better than some senior software engineers.
+
+209
+00:15:01,000 --> 00:15:03,000
+Let's recap what we have learned today.
+
+210
+00:15:03,000 --> 00:15:05,000
+Today, we learned Map Iraqi.
+
+211
+00:15:05,000 --> 00:15:10,000
+We talked about features that are introduced in the implementations of map interface.
+
+212
+00:15:11,000 --> 00:15:14,000
+We also talked about source, map and navigable map.
+
+213
+00:15:14,000 --> 00:15:16,000
+We discussed what dictionary is.
+
+214
+00:15:17,000 --> 00:15:21,000
+Now, you know what the difference is between Hash Table and Hashmat.
+
+215
+00:15:21,000 --> 00:15:24,000
+After that, we learned methods of map interface.
+
+216
+00:15:25,000 --> 00:15:27,000
+We also learned what entry type is.
+
+217
+00:15:28,000 --> 00:15:29,000
+That's all what we have for today.
+
+218
+00:15:30,000 --> 00:15:31,000
+Thanks a lot for your attention.
+
+219
+00:15:31,000 --> 00:15:33,000
+See you in the next lesson.
+
diff --git a/19 - Java Collections Framework/015 Hash Tables & HashMap_en.srt b/19 - Java Collections Framework/015 Hash Tables & HashMap_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..6bdce7f3edb7b2bb5922ac3cc5ecff90a39b3829
--- /dev/null
+++ b/19 - Java Collections Framework/015 Hash Tables & HashMap_en.srt
@@ -0,0 +1,1328 @@
+1
+00:00:06,000 --> 00:00:11,000
+Hello, the students in this lesson, we are going to learn how hash tables work and an example of hash
+
+2
+00:00:11,000 --> 00:00:13,000
+map will learn how to use maps.
+
+3
+00:00:14,000 --> 00:00:19,000
+This is important because a lot of the most popular map implementations are based on the hash tables
+
+4
+00:00:20,000 --> 00:00:26,000
+to understand how hash tables work and how to override equals and hash code methods.
+
+5
+00:00:26,000 --> 00:00:29,000
+In our times today, we'll have practice with hash map.
+
+6
+00:00:30,000 --> 00:00:35,000
+You're going to learn what the capacity of hash map is and what load factor is.
+
+7
+00:00:35,000 --> 00:00:40,000
+I'll share with you the best practices of selecting keys for map urines and lesson.
+
+8
+00:00:40,000 --> 00:00:43,000
+We are going to answer the question what immutable objects are.
+
+9
+00:00:44,000 --> 00:00:48,000
+Also, I will show you how you can search entries in your Mambi keys and by values.
+
+10
+00:00:48,000 --> 00:00:49,000
+Let's start.
+
+11
+00:00:50,000 --> 00:00:54,000
+Probably you already know from the previous lessons that it takes constant amount of time from hash
+
+12
+00:00:54,000 --> 00:01:02,000
+map to perform its major operations like get both remove and connotation for major operation of hash.
+
+13
+00:01:02,000 --> 00:01:06,000
+Map is all of one, but what implementation brings are such performance.
+
+14
+00:01:07,000 --> 00:01:13,000
+This is because Hashmat the same as Linc's hash map, concurrent hash map and hash table use hash tables
+
+15
+00:01:13,000 --> 00:01:14,000
+to store and retrieve data.
+
+16
+00:01:15,000 --> 00:01:21,000
+And for us it is important to understand how hash tables work so that we could use and tune our hash
+
+17
+00:01:21,000 --> 00:01:23,000
+map when needed for better performance.
+
+18
+00:01:23,000 --> 00:01:30,000
+Let's learn what hash table is and try to explain hash table in very simple words that are easy to understand.
+
+19
+00:01:30,000 --> 00:01:33,000
+I can explain it in the Wikipedia language, but I won't.
+
+20
+00:01:34,000 --> 00:01:40,000
+In simple words, hash table consists of buckets or also sometimes they called slots where you might
+
+21
+00:01:40,000 --> 00:01:41,000
+put any value.
+
+22
+00:01:41,000 --> 00:01:44,000
+I want you also to learn things on example.
+
+23
+00:01:44,000 --> 00:01:49,000
+So we would discuss also a few things that are specific for hash map implementation.
+
+24
+00:01:49,000 --> 00:01:53,000
+By default, hash map object has initial capacity of sixteen buckets.
+
+25
+00:01:53,000 --> 00:01:59,000
+That means that at the beginning when we only created hash map object, we have sixteen buckets.
+
+26
+00:01:59,000 --> 00:02:02,000
+Load factor is equal to zero point seventy five.
+
+27
+00:02:03,000 --> 00:02:04,000
+What is the load factor.
+
+28
+00:02:05,000 --> 00:02:11,000
+Load factor is a value that tells when our hash table has to be resized and increased inside the hash
+
+29
+00:02:11,000 --> 00:02:15,000
+map type you would find in variable with the name threshold.
+
+30
+00:02:15,000 --> 00:02:18,000
+That is a result of multiplication of capacity and load factor.
+
+31
+00:02:19,000 --> 00:02:23,000
+So 16 times zero point seventy five equals to twelve.
+
+32
+00:02:23,000 --> 00:02:29,000
+That means that when twelve buckets will store some value, our hash map will be resized.
+
+33
+00:02:29,000 --> 00:02:34,000
+After similar situation of hash map source code, we would find that threshold is doubled when we need
+
+34
+00:02:34,000 --> 00:02:36,000
+to increase our hash map.
+
+35
+00:02:36,000 --> 00:02:38,000
+One new threshold has reached.
+
+36
+00:02:38,000 --> 00:02:44,000
+A hash table is rehashed so that the hash table has approximately twice the number of brackets.
+
+37
+00:02:44,000 --> 00:02:47,000
+Can you understand what capacity and load factor is?
+
+38
+00:02:47,000 --> 00:02:53,000
+A hash map has specific constructor that allows you to pass integer value to initialize capacity and
+
+39
+00:02:53,000 --> 00:02:58,000
+flow, add value to initialize load factor in case you want to tune Hashmat performance.
+
+40
+00:02:58,000 --> 00:03:01,000
+But in real life, default values are used most often.
+
+41
+00:03:02,000 --> 00:03:04,000
+OK, let's move on now.
+
+42
+00:03:04,000 --> 00:03:07,000
+Let's imagine that I want to put new entry in my hash map here.
+
+43
+00:03:07,000 --> 00:03:11,000
+You can see that I have entries that consist of the key and value.
+
+44
+00:03:11,000 --> 00:03:14,000
+Let it be some string object, key one here and some value.
+
+45
+00:03:14,000 --> 00:03:21,000
+OK, what happens next after that hash function is applied to compute index of a bucket of the key hash
+
+46
+00:03:21,000 --> 00:03:24,000
+code, Masset is invoked on the key object.
+
+47
+00:03:24,000 --> 00:03:30,000
+After we received hash code, we may perform module separation and the reminder would be the index of
+
+48
+00:03:30,000 --> 00:03:30,000
+a bucket.
+
+49
+00:03:31,000 --> 00:03:35,000
+After that I place key to the bucket and associated the value with that key.
+
+50
+00:03:36,000 --> 00:03:39,000
+And after that, each new element is placed in a new bucket.
+
+51
+00:03:40,000 --> 00:03:45,000
+Based on this, can you understand why adding elements in the hash map always took a constant amount
+
+52
+00:03:45,000 --> 00:03:46,000
+of time?
+
+53
+00:03:46,000 --> 00:03:51,000
+Because to put element we need to define bucket for that element and just put it there.
+
+54
+00:03:51,000 --> 00:03:54,000
+And the separation doesn't depend on a number of elements.
+
+55
+00:03:55,000 --> 00:03:58,000
+OK, what happens in Case to Case has the same hash called?
+
+56
+00:03:59,000 --> 00:04:02,000
+The situation may happen because of the hash collision.
+
+57
+00:04:02,000 --> 00:04:05,000
+I will explain in detail why this might happen a bit later.
+
+58
+00:04:06,000 --> 00:04:11,000
+For now, just take as a fact that theoretically two different objects may have the same hash code.
+
+59
+00:04:11,000 --> 00:04:16,000
+According to the flow that I have described, the elements would be put in the same back.
+
+60
+00:04:16,000 --> 00:04:19,000
+It is a true yes, it is inside.
+
+61
+00:04:19,000 --> 00:04:21,000
+Each bucket linked list is created.
+
+62
+00:04:22,000 --> 00:04:24,000
+This is not double list.
+
+63
+00:04:24,000 --> 00:04:26,000
+It is connected only in one direction.
+
+64
+00:04:26,000 --> 00:04:33,000
+And it looks like this element in the bucket has reference to the next object with one exception.
+
+65
+00:04:33,000 --> 00:04:38,000
+In general version eight additional improvement was introduced in performance of hash tables in case
+
+66
+00:04:38,000 --> 00:04:41,000
+type of key object implements comparable interface.
+
+67
+00:04:41,000 --> 00:04:47,000
+That means keys might be sorted and in case there are multiple objects in one bucket, there is no link
+
+68
+00:04:47,000 --> 00:04:49,000
+list with its all of end.
+
+69
+00:04:50,000 --> 00:04:52,000
+That is linear algorithm complexity.
+
+70
+00:04:53,000 --> 00:05:00,000
+Instead of the list, there is a binary tree that brings us all of logarithm and complexity of the algorithm.
+
+71
+00:05:00,000 --> 00:05:01,000
+Does it make sense?
+
+72
+00:05:01,000 --> 00:05:02,000
+Let's move forward.
+
+73
+00:05:03,000 --> 00:05:08,000
+To understand why the treatment of animals stay constant amount of time, let me show you how element
+
+74
+00:05:08,000 --> 00:05:12,000
+is retrieved from the hash map to retrieve elements from the map.
+
+75
+00:05:12,000 --> 00:05:13,000
+We paskey object.
+
+76
+00:05:13,000 --> 00:05:15,000
+Hash function is applied to the key.
+
+77
+00:05:16,000 --> 00:05:18,000
+This allows to define the bucket.
+
+78
+00:05:18,000 --> 00:05:22,000
+After bucket is defined, keys are checked for quality.
+
+79
+00:05:23,000 --> 00:05:23,000
+Why?
+
+80
+00:05:23,000 --> 00:05:27,000
+As you already know, there might be two different objects with the same hash.
+
+81
+00:05:27,000 --> 00:05:32,000
+That's why algorithm should call equals Masset to compare to objects.
+
+82
+00:05:32,000 --> 00:05:37,000
+And in the case there are multiple objects in one bucket, algorithm will check a quality until it finds
+
+83
+00:05:37,000 --> 00:05:38,000
+the match.
+
+84
+00:05:39,000 --> 00:05:43,000
+That's why it is said that hash code and equals method and work in PR..
+
+85
+00:05:43,000 --> 00:05:47,000
+Can you stand now on each step hash code and equals method is used.
+
+86
+00:05:48,000 --> 00:05:48,000
+Awesome.
+
+87
+00:05:49,000 --> 00:05:55,000
+Now imagine that we have times where we have overridden hash quote masset and hash code returns constant
+
+88
+00:05:55,000 --> 00:05:55,000
+value.
+
+89
+00:05:55,000 --> 00:05:57,000
+Imagine that has got message.
+
+90
+00:05:57,000 --> 00:06:00,000
+Just looks like this on one all the times.
+
+91
+00:06:01,000 --> 00:06:03,000
+What that would mean for the hash map.
+
+92
+00:06:03,000 --> 00:06:07,000
+That means that bucket for all objects of this type would be the same.
+
+93
+00:06:08,000 --> 00:06:13,000
+And instead of taking advantage of hash table and constant amount of time for retrieving elements,
+
+94
+00:06:13,000 --> 00:06:18,000
+we would get linear time because all elements will be stored in one bucket.
+
+95
+00:06:19,000 --> 00:06:24,000
+That is exactly the reason why we need to override hash code functions that would return the most unique
+
+96
+00:06:24,000 --> 00:06:24,000
+integer.
+
+97
+00:06:25,000 --> 00:06:28,000
+Now let's talk about the requirements for hash code and equals mass.
+
+98
+00:06:28,000 --> 00:06:34,000
+That should be during the methods overriding the three major requirements that hash could function should
+
+99
+00:06:34,000 --> 00:06:38,000
+meet Zaya multiple invocation of hash code.
+
+100
+00:06:38,000 --> 00:06:41,000
+MassArt must consistently return the same integer.
+
+101
+00:06:41,000 --> 00:06:47,000
+The second requirement if two objects are equal, that means if equal message returns true, then the
+
+102
+00:06:47,000 --> 00:06:49,000
+hash code also should be equal.
+
+103
+00:06:50,000 --> 00:06:56,000
+What another statement is follows from this rule that fields that that used to compare objects and feel
+
+104
+00:06:56,000 --> 00:06:58,000
+that they used to calculate hash.
+
+105
+00:06:58,000 --> 00:07:00,000
+Code of the object should be the same.
+
+106
+00:07:00,000 --> 00:07:01,000
+Does it make sense?
+
+107
+00:07:02,000 --> 00:07:06,000
+And the search requirement includes two objects are not equal.
+
+108
+00:07:06,000 --> 00:07:08,000
+It is possible that hash codes will be the same.
+
+109
+00:07:09,000 --> 00:07:10,000
+Let me comment on the statement.
+
+110
+00:07:11,000 --> 00:07:13,000
+Probably you are wondering how this may happen.
+
+111
+00:07:13,000 --> 00:07:15,000
+It is an easy mass rule.
+
+112
+00:07:16,000 --> 00:07:19,000
+Hypothetically, the set of objects is infinite.
+
+113
+00:07:19,000 --> 00:07:23,000
+We can create as much objects as our hip size will allow us.
+
+114
+00:07:23,000 --> 00:07:27,000
+And as we increase keep size, we can create even more objects than before.
+
+115
+00:07:28,000 --> 00:07:34,000
+Whereas Hershkowitz value is not infinite, it exists only within the integer range, no more and no
+
+116
+00:07:34,000 --> 00:07:35,000
+less.
+
+117
+00:07:35,000 --> 00:07:39,000
+That's why, hypothetically, hedgcock collisions may happen.
+
+118
+00:07:39,000 --> 00:07:40,000
+Hash collisions.
+
+119
+00:07:40,000 --> 00:07:45,000
+That is a state when two different objects that are not equal have the same hash.
+
+120
+00:07:45,000 --> 00:07:48,000
+Could hope that things are clearer now.
+
+121
+00:07:49,000 --> 00:07:55,000
+Now let's talk about rules that equals that should meet equals mass should meet five rules.
+
+122
+00:07:55,000 --> 00:07:57,000
+Zaya equals mass.
+
+123
+00:07:57,000 --> 00:07:58,000
+It should be reflexive.
+
+124
+00:07:58,000 --> 00:08:04,000
+This means that for any non non reference value x X equals X should return.
+
+125
+00:08:04,000 --> 00:08:04,000
+True.
+
+126
+00:08:05,000 --> 00:08:05,000
+That is obvious.
+
+127
+00:08:05,000 --> 00:08:10,000
+But still it is worth to mention for complete understanding equals mass.
+
+128
+00:08:10,000 --> 00:08:12,000
+That should be symmetric.
+
+129
+00:08:12,000 --> 00:08:19,000
+This means that for any non non reference values, X and Y X equals Y should be true if and only if
+
+130
+00:08:19,000 --> 00:08:21,000
+Y equals X returns.
+
+131
+00:08:21,000 --> 00:08:21,000
+True.
+
+132
+00:08:22,000 --> 00:08:28,000
+Equals mass, it shouldn't be transitive for any non reference value is X, Y and Z.
+
+133
+00:08:28,000 --> 00:08:37,000
+If X equals Y returns true and Y equals that return true, then X equals Z should return true equals
+
+134
+00:08:37,000 --> 00:08:37,000
+mass.
+
+135
+00:08:37,000 --> 00:08:44,000
+It should be consistent for any nominal reference values X and Y, multiple invocations of X equals
+
+136
+00:08:44,000 --> 00:08:45,000
+Y should be consistent.
+
+137
+00:08:46,000 --> 00:08:53,000
+And last but not the list requirement is that for any non reference value x x equals now should return
+
+138
+00:08:53,000 --> 00:08:53,000
+false.
+
+139
+00:08:54,000 --> 00:08:59,000
+A bit later today during the practice, we'll review how to override hash code and equals MassArt.
+
+140
+00:09:00,000 --> 00:09:06,000
+Let's start our practice exercises, we have in now theoretical knowledge right now to understand the
+
+141
+00:09:06,000 --> 00:09:07,000
+next examples.
+
+142
+00:09:08,000 --> 00:09:13,000
+Before the lesson, I prepared a file with examples that will help you to understand how maps work.
+
+143
+00:09:14,000 --> 00:09:17,000
+Let me run the program and walk you through council output.
+
+144
+00:09:17,000 --> 00:09:22,000
+Here I declare a map very similar to collection and types.
+
+145
+00:09:22,000 --> 00:09:24,000
+Map type is also parametrized.
+
+146
+00:09:25,000 --> 00:09:31,000
+Hope you don't skip lessons about least implementations where I explained on the high level how Diament
+
+147
+00:09:31,000 --> 00:09:32,000
+operator works.
+
+148
+00:09:33,000 --> 00:09:35,000
+We're also going to learn genetics and a separate lesson.
+
+149
+00:09:35,000 --> 00:09:38,000
+So don't worry much about that.
+
+150
+00:09:38,000 --> 00:09:45,000
+Handyman's operator specifies that keys in this map would have integer type and values and this map
+
+151
+00:09:45,000 --> 00:09:48,000
+would have string type I initialize.
+
+152
+00:09:48,000 --> 00:09:51,000
+This object was a reference to the Hashmat object.
+
+153
+00:09:51,000 --> 00:09:57,000
+If we want to put entries in the map, you can see example here, I just called Put Masset and pass
+
+154
+00:09:57,000 --> 00:09:58,000
+integer and string.
+
+155
+00:09:59,000 --> 00:10:02,000
+If I want to get a map, I have to use key.
+
+156
+00:10:03,000 --> 00:10:10,000
+For example, if I want to retrieve string one, I just want to get MassArt like this and console.
+
+157
+00:10:10,000 --> 00:10:16,000
+You can see that we printed the values that is associated with the key take into account key set returns,
+
+158
+00:10:16,000 --> 00:10:18,000
+the implementation of that interface.
+
+159
+00:10:18,000 --> 00:10:21,000
+And we already know that that extends collection.
+
+160
+00:10:21,000 --> 00:10:23,000
+That in turn extends iterable.
+
+161
+00:10:24,000 --> 00:10:28,000
+This means I can use foreach loop to iterate over elements.
+
+162
+00:10:29,000 --> 00:10:35,000
+And here I printed all keys to console the next thing I want to show you is an example how you might
+
+163
+00:10:35,000 --> 00:10:37,000
+iterate over all entries in MAP.
+
+164
+00:10:38,000 --> 00:10:45,000
+I take entries said from my map here and specify in variable here of map entry type since entry interface
+
+165
+00:10:45,000 --> 00:10:47,000
+is declared inside map interface.
+
+166
+00:10:47,000 --> 00:10:50,000
+From the syntax standpoint, I have to put DOT here.
+
+167
+00:10:51,000 --> 00:10:57,000
+My entry will be parametrized by integer and string that the same types that keys and values have.
+
+168
+00:10:57,000 --> 00:11:02,000
+In my map you can see that I use central variable to retrieve key and value.
+
+169
+00:11:05,000 --> 00:11:11,000
+Here also damos of the get on the fourth method, I want to draw your attention that in case our entry
+
+170
+00:11:11,000 --> 00:11:18,000
+exists in the map, like entry was a key for default, value won't be returned even in case the value
+
+171
+00:11:18,000 --> 00:11:23,000
+is not, the default value will be returned only in case the entry doesn't exist.
+
+172
+00:11:23,000 --> 00:11:26,000
+And that was entry was the key five.
+
+173
+00:11:27,000 --> 00:11:33,000
+Would have absolute mass, it will put value associated with the key in case if he is not already associated
+
+174
+00:11:33,000 --> 00:11:39,000
+with the value or associated with it now and here you can see that I call this method for the entry
+
+175
+00:11:39,000 --> 00:11:46,000
+was key for and after that, I checked what the value is updated and it was successfully updated.
+
+176
+00:11:46,000 --> 00:11:52,000
+And now let me show you a few examples that are related to old maps that are implemented on the basis
+
+177
+00:11:52,000 --> 00:11:53,000
+of hash tables.
+
+178
+00:11:54,000 --> 00:11:58,000
+Imagine that we have some type called default product and default user.
+
+179
+00:11:58,000 --> 00:12:04,000
+If you don't remember these types, they are from your previous homework about implementation of online
+
+180
+00:12:04,000 --> 00:12:04,000
+store.
+
+181
+00:12:05,000 --> 00:12:06,000
+Let me read map work.
+
+182
+00:12:06,000 --> 00:12:10,000
+Use will be of type user and values will be of type product.
+
+183
+00:12:10,000 --> 00:12:14,000
+I create the false user object and the full product object.
+
+184
+00:12:14,000 --> 00:12:16,000
+Now let me put one entry to the map.
+
+185
+00:12:17,000 --> 00:12:24,000
+Now imagine that in some other part of my program I retrieve user from the database or receive user
+
+186
+00:12:24,000 --> 00:12:30,000
+information from the front end and I create the new Java object, but with the same state for my John
+
+187
+00:12:30,000 --> 00:12:31,000
+Smith user.
+
+188
+00:12:31,000 --> 00:12:38,000
+And after that I want to get product objects for this user from the map by my user key I receive now
+
+189
+00:12:39,000 --> 00:12:41,000
+known how hash tables work.
+
+190
+00:12:41,000 --> 00:12:45,000
+Can you understand why I receive now and why my product value is lost in my map?
+
+191
+00:12:46,000 --> 00:12:49,000
+Post the media for a second and try to answer this question.
+
+192
+00:12:50,000 --> 00:12:51,000
+Let me answer this.
+
+193
+00:12:51,000 --> 00:12:55,000
+This is because hash function is applied for the user object.
+
+194
+00:12:55,000 --> 00:12:57,000
+But what value is returned?
+
+195
+00:12:57,000 --> 00:13:03,000
+Schenkkan So you can see what has caused massive returns for my user object and user copy object.
+
+196
+00:13:03,000 --> 00:13:04,000
+They're different.
+
+197
+00:13:05,000 --> 00:13:10,000
+That means I have to override hash code message in user class so that it will constantly return the
+
+198
+00:13:10,000 --> 00:13:13,000
+same hash code for equal users to save time.
+
+199
+00:13:13,000 --> 00:13:19,000
+During the lesson I created one more implementation of user interface that overrides hash code and equals
+
+200
+00:13:19,000 --> 00:13:19,000
+method.
+
+201
+00:13:19,000 --> 00:13:20,000
+Let's look at it.
+
+202
+00:13:21,000 --> 00:13:24,000
+So here you can see that I have hash code and equals method overridden.
+
+203
+00:13:25,000 --> 00:13:26,000
+How to override method.
+
+204
+00:13:27,000 --> 00:13:29,000
+Personally, I use Eclipse for that.
+
+205
+00:13:29,000 --> 00:13:37,000
+In most of the cases I press hotkeys alz shift as in case you forgot hotkeys just press mouse right
+
+206
+00:13:37,000 --> 00:13:41,000
+click source and find here generate hash code and equals.
+
+207
+00:13:42,000 --> 00:13:45,000
+Eclipse asks whether I need to override this method one more time.
+
+208
+00:13:45,000 --> 00:13:48,000
+Taking into account I already have this method.
+
+209
+00:13:48,000 --> 00:13:54,000
+I will click here to show user interface of eclipse here can you can choose fields that you want to
+
+210
+00:13:54,000 --> 00:13:56,000
+use for equals and has called massive.
+
+211
+00:13:57,000 --> 00:14:02,000
+Please pay attention that you will now want to use static fields in equals and hash code methods.
+
+212
+00:14:03,000 --> 00:14:04,000
+Can you understand why?
+
+213
+00:14:04,000 --> 00:14:09,000
+Because static fields are related to the class itself rather than to object of this class.
+
+214
+00:14:10,000 --> 00:14:16,000
+And in case you will use static fields for calculating hash code or equals, these masses wouldn't meet
+
+215
+00:14:16,000 --> 00:14:19,000
+the requirements which we talked about in this lesson.
+
+216
+00:14:20,000 --> 00:14:24,000
+Here's one checkbox that I usually check is to use methods from object class.
+
+217
+00:14:25,000 --> 00:14:28,000
+This makes our methods written in a different way.
+
+218
+00:14:28,000 --> 00:14:32,000
+That takes less lines of code than without using objects class.
+
+219
+00:14:32,000 --> 00:14:36,000
+There is also one another checkbox that you might want to select.
+
+220
+00:14:36,000 --> 00:14:38,000
+Sometimes I will show you the difference.
+
+221
+00:14:39,000 --> 00:14:42,000
+So here you just click generate and methods are generated.
+
+222
+00:14:42,000 --> 00:14:45,000
+I will cancel because I already generated masjids.
+
+223
+00:14:46,000 --> 00:14:48,000
+Here's a hash code method.
+
+224
+00:14:48,000 --> 00:14:51,000
+Optionally, you can investigate how hash method is implemented.
+
+225
+00:14:52,000 --> 00:14:58,000
+You can see that I call hash method on object class and pass all fields that I want to be taken into
+
+226
+00:14:58,000 --> 00:15:00,000
+account to compute the hash of the object.
+
+227
+00:15:01,000 --> 00:15:04,000
+Now, multiple invocation of code method and different objects.
+
+228
+00:15:04,000 --> 00:15:09,000
+All the channels, the same integer value here is our equals method.
+
+229
+00:15:09,000 --> 00:15:14,000
+At the beginning we check equality by references if references as a same religion.
+
+230
+00:15:14,000 --> 00:15:19,000
+True, if objects that we pass to the method is now, then we return false.
+
+231
+00:15:19,000 --> 00:15:25,000
+Now I get class of the current object and get class of the object that we got from that argument.
+
+232
+00:15:26,000 --> 00:15:31,000
+And potentially you can use here instance of operator, for example, in the case it is not critical
+
+233
+00:15:31,000 --> 00:15:36,000
+for you that objects are created on the basis of different classes, sometimes for use.
+
+234
+00:15:36,000 --> 00:15:42,000
+The fact that two different objects are compatible with type and have the same state is enough to tell
+
+235
+00:15:42,000 --> 00:15:43,000
+that both of them are equal.
+
+236
+00:15:44,000 --> 00:15:47,000
+But it depends personally in most cases.
+
+237
+00:15:47,000 --> 00:15:53,000
+I use that clause here, but I have to warn you that you might want to use instances of operator here
+
+238
+00:15:53,000 --> 00:15:55,000
+to check compatibility and that is also fine.
+
+239
+00:15:56,000 --> 00:16:03,000
+After this check, we can cast object to the current class type and check for quality field by field
+
+240
+00:16:03,000 --> 00:16:09,000
+in case all state from the other object is the same as state of this object, then very trencher.
+
+241
+00:16:10,000 --> 00:16:15,000
+Can you understand now why the set of fields that we use in equals and hash code MassArt should be the
+
+242
+00:16:15,000 --> 00:16:16,000
+same?
+
+243
+00:16:16,000 --> 00:16:17,000
+Great.
+
+244
+00:16:17,000 --> 00:16:20,000
+Let's get back to our demo file now.
+
+245
+00:16:20,000 --> 00:16:26,000
+We create the object of our type that overrides hash code and equals method, we put it.
+
+246
+00:16:26,000 --> 00:16:29,000
+As a key in our map and map it against our product.
+
+247
+00:16:30,000 --> 00:16:36,000
+After that, I read the same copy of our user analysis that we did previous time, and now I want to
+
+248
+00:16:36,000 --> 00:16:38,000
+get my product by the key.
+
+249
+00:16:38,000 --> 00:16:39,000
+And here it is.
+
+250
+00:16:40,000 --> 00:16:45,000
+I managed to retrieve product from a map because my hash table was managed to find the right market
+
+251
+00:16:45,000 --> 00:16:46,000
+and the value in it.
+
+252
+00:16:47,000 --> 00:16:52,000
+Now imagine that for some reasons, the state of the user is changed in the database.
+
+253
+00:16:52,000 --> 00:16:59,000
+Let's imagine that John Smith decided to change his email address and now he uses new email domain.
+
+254
+00:16:59,000 --> 00:17:03,000
+Lets retrieve that product again and then consult with him.
+
+255
+00:17:03,000 --> 00:17:06,000
+Now, can you understand why?
+
+256
+00:17:06,000 --> 00:17:11,000
+Because in our case, we use all fields of user to compute hash code, as you remember.
+
+257
+00:17:12,000 --> 00:17:16,000
+And when email was changed, hash code also was changed.
+
+258
+00:17:16,000 --> 00:17:23,000
+But the object that is used for key in the map still uses the old email and definitely our hash map
+
+259
+00:17:23,000 --> 00:17:28,000
+can't find the right market was our key to return a product.
+
+260
+00:17:28,000 --> 00:17:32,000
+That's why it is recommended to use immutable objects for keys.
+
+261
+00:17:32,000 --> 00:17:34,000
+What are immutable objects?
+
+262
+00:17:34,000 --> 00:17:39,000
+The objects, the state of which is never changed after its creation.
+
+263
+00:17:39,000 --> 00:17:42,000
+The example of a mutable type is strength.
+
+264
+00:17:42,000 --> 00:17:48,000
+This object is designed in the way that there is no any method that can change state of the original
+
+265
+00:17:48,000 --> 00:17:50,000
+object after its creation.
+
+266
+00:17:50,000 --> 00:17:55,000
+The intention to replace method, for example, it should replace some characters with others.
+
+267
+00:17:56,000 --> 00:18:01,000
+You would notice that this method returns new objects of string, but not modifies the previous one.
+
+268
+00:18:02,000 --> 00:18:08,000
+In case you use mutable keys and hash map, pay extra attention that the key is stable, but usually
+
+269
+00:18:08,000 --> 00:18:10,000
+is a string or integer.
+
+270
+00:18:10,000 --> 00:18:11,000
+Objects are used as keys.
+
+271
+00:18:12,000 --> 00:18:18,000
+I believe we learned a lot about hash tables and the last thing that I would like to share with you
+
+272
+00:18:18,000 --> 00:18:21,000
+is to show you how to sort my bike keys and values.
+
+273
+00:18:22,000 --> 00:18:26,000
+Here is a separate file with the examples of maps stored in the same hash map.
+
+274
+00:18:26,000 --> 00:18:30,000
+Object is created here with a similar data set as we had in previous example.
+
+275
+00:18:31,000 --> 00:18:36,000
+Now, if you remember from the last about map interface we have comparing bickie and comparing Vivarium
+
+276
+00:18:36,000 --> 00:18:43,000
+assets in our entry type to search entries in the map, you already know that list interface has search
+
+277
+00:18:43,000 --> 00:18:44,000
+method, musical action.
+
+278
+00:18:44,000 --> 00:18:47,000
+Nawzad interface has sought MassArt.
+
+279
+00:18:47,000 --> 00:18:54,000
+That's why we have to use the latest object and create variable of this type parametrized by entry type.
+
+280
+00:18:54,000 --> 00:18:57,000
+That in turn is parametrized by integer and string.
+
+281
+00:18:57,000 --> 00:19:01,000
+Probably you notice that I use just entry word in this file.
+
+282
+00:19:01,000 --> 00:19:05,000
+That is because I have a statement here for map entry time.
+
+283
+00:19:06,000 --> 00:19:11,000
+After that I create a real E object and pass to the constructor and reset of my map.
+
+284
+00:19:12,000 --> 00:19:19,000
+Now I can search elements in this list and enter type has default method that returns comparator to
+
+285
+00:19:19,000 --> 00:19:20,000
+source entries by key.
+
+286
+00:19:21,000 --> 00:19:27,000
+I want to shuffle elements before Soden to make sure that certain work is expected to shuffle elements
+
+287
+00:19:27,000 --> 00:19:33,000
+and your special message from collections class with utility methods nonwar will review this class in
+
+288
+00:19:33,000 --> 00:19:34,000
+the separate lesson.
+
+289
+00:19:35,000 --> 00:19:39,000
+Right now I will use only one method from that class for the demo purposes.
+
+290
+00:19:40,000 --> 00:19:44,000
+I print shuffled elements to console to prove that they are not sorted.
+
+291
+00:19:45,000 --> 00:19:49,000
+After that, I saw the elements and print source at least to the console.
+
+292
+00:19:49,000 --> 00:19:54,000
+Let me run the program and here you can see that all elements and least assorted now.
+
+293
+00:19:55,000 --> 00:19:55,000
+Awesome.
+
+294
+00:19:56,000 --> 00:19:57,000
+Just want to pay attention.
+
+295
+00:19:57,000 --> 00:20:04,000
+This sort only four keys that implements comparable interface if your key doesn't implement comparable
+
+296
+00:20:05,000 --> 00:20:11,000
+Xeros overloaded version of comparing by key method that also takes Comparator as an argument.
+
+297
+00:20:11,000 --> 00:20:15,000
+And we already had separate lesson and homework regarding Khambatta.
+
+298
+00:20:15,000 --> 00:20:17,000
+That's why I will not stop on this.
+
+299
+00:20:18,000 --> 00:20:22,000
+In case you would face issues, let me know and write in comments.
+
+300
+00:20:22,000 --> 00:20:24,000
+I will help you to source my keys.
+
+301
+00:20:24,000 --> 00:20:30,000
+It is also super easy to create an object of three map and add entries to that map.
+
+302
+00:20:30,000 --> 00:20:32,000
+To put all entries to three map.
+
+303
+00:20:32,000 --> 00:20:36,000
+I use special constructor that takes any map as an argument.
+
+304
+00:20:36,000 --> 00:20:40,000
+We are going to have separate lesson about sorted map and three map.
+
+305
+00:20:40,000 --> 00:20:46,000
+But you already familiar with key features of this interface and class from the map Iraqi lesson and
+
+306
+00:20:46,000 --> 00:20:47,000
+take into account.
+
+307
+00:20:47,000 --> 00:20:49,000
+We are talking about sorting of elements.
+
+308
+00:20:49,000 --> 00:20:56,000
+It was dimension to the map here and last but not least for today, is how to search your map by values.
+
+309
+00:20:56,000 --> 00:20:58,000
+We again shuffle entries before sorting.
+
+310
+00:20:59,000 --> 00:21:02,000
+After that, we use comparator that can be created by entry type.
+
+311
+00:21:03,000 --> 00:21:06,000
+And again, this comparing by value method has overloaded versions.
+
+312
+00:21:06,000 --> 00:21:12,000
+That takes Comparator as an argument that is in case your values don't implement comparable.
+
+313
+00:21:13,000 --> 00:21:16,000
+And here we print list of entries sorted by value.
+
+314
+00:21:17,000 --> 00:21:23,000
+You remember that to convert an array of entries to map, we have a special method of entries, but
+
+315
+00:21:23,000 --> 00:21:24,000
+they use it efficiently.
+
+316
+00:21:24,000 --> 00:21:26,000
+We have to understand functional from.
+
+317
+00:21:26,000 --> 00:21:30,000
+Ramin Anjelah, so conversion looks something like this.
+
+318
+00:21:30,000 --> 00:21:36,000
+This is one of the options I showed you that just to make you understand that I remember everything
+
+319
+00:21:36,000 --> 00:21:40,000
+and I want to separate lessons in the way you would understand.
+
+320
+00:21:40,000 --> 00:21:41,000
+Amerson Don't worry.
+
+321
+00:21:41,000 --> 00:21:44,000
+We will cover the topic separately in other lessons.
+
+322
+00:21:45,000 --> 00:21:48,000
+Right now, I want to recap what we have learned today.
+
+323
+00:21:49,000 --> 00:21:52,000
+In this lesson, we learned how hash tables work.
+
+324
+00:21:52,000 --> 00:21:58,000
+Now you know how to override equals and hash code masset and water requirements exist for these methods.
+
+325
+00:21:59,000 --> 00:22:01,000
+Today, we had a lot of practice with Hashmat.
+
+326
+00:22:02,000 --> 00:22:05,000
+You main message and how to work with Hashmat.
+
+327
+00:22:05,000 --> 00:22:11,000
+Also, we learned what immutable objects are and understood why immutable objects and good keys for
+
+328
+00:22:11,000 --> 00:22:12,000
+our maps.
+
+329
+00:22:12,000 --> 00:22:17,000
+And at the end of the lesson we learned how to search Mambi keys and Beverley's.
+
+330
+00:22:17,000 --> 00:22:20,000
+I believe this was extremely fruitful lesson.
+
+331
+00:22:20,000 --> 00:22:22,000
+Thanks a lot for your attention.
+
+332
+00:22:22,000 --> 00:22:24,000
+See you in the next lesson.
+
diff --git a/19 - Java Collections Framework/015 Source-code-of-MapDemo-class.url b/19 - Java Collections Framework/015 Source-code-of-MapDemo-class.url
new file mode 100644
index 0000000000000000000000000000000000000000..df97fa65d276a111a97bc294a5c3de8eac3118f5
--- /dev/null
+++ b/19 - Java Collections Framework/015 Source-code-of-MapDemo-class.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/maps/MapDemo.java
\ No newline at end of file
diff --git a/19 - Java Collections Framework/015 Source-code-of-MapSortingDemo-class.url b/19 - Java Collections Framework/015 Source-code-of-MapSortingDemo-class.url
new file mode 100644
index 0000000000000000000000000000000000000000..6a0323c73c0528d794ae378604d6bec6b5be2e3b
--- /dev/null
+++ b/19 - Java Collections Framework/015 Source-code-of-MapSortingDemo-class.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/sorting/MapSortingDemo.java
\ No newline at end of file
diff --git a/19 - Java Collections Framework/016 Homework-LRU-Cache-Implementation.url b/19 - Java Collections Framework/016 Homework-LRU-Cache-Implementation.url
new file mode 100644
index 0000000000000000000000000000000000000000..c8641322a969e7da907f74fcae6d1cb6c8153d25
--- /dev/null
+++ b/19 - Java Collections Framework/016 Homework-LRU-Cache-Implementation.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://docs.google.com/document/d/17FzSLVtFx9JRIsRle78nYTuXaCknj2DR6AMXNPP5Rtg/edit?usp=sharing
\ No newline at end of file
diff --git a/19 - Java Collections Framework/016 Homework-solution.url b/19 - Java Collections Framework/016 Homework-solution.url
new file mode 100644
index 0000000000000000000000000000000000000000..802cc2cebec2362d661abf1cc8823ad3f41687ad
--- /dev/null
+++ b/19 - Java Collections Framework/016 Homework-solution.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/maps/hw
\ No newline at end of file
diff --git a/19 - Java Collections Framework/016 LinkedHashMap_en.srt b/19 - Java Collections Framework/016 LinkedHashMap_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..26a28499495506d510935f098ace71fe7bd103b6
--- /dev/null
+++ b/19 - Java Collections Framework/016 LinkedHashMap_en.srt
@@ -0,0 +1,492 @@
+1
+00:00:05,000 --> 00:00:10,000
+Hello, dear students in this class, and we are going to talk about one more implementation of map
+
+2
+00:00:10,000 --> 00:00:16,000
+interface linked hash map, we're going to understand how the hash map is different from hash map will
+
+3
+00:00:16,000 --> 00:00:20,000
+review structure of link, hash map and we'll review methods that it has.
+
+4
+00:00:21,000 --> 00:00:26,000
+I'm going to explain to you what the cash is and how we can implement our own cash with the help of
+
+5
+00:00:26,000 --> 00:00:27,000
+the hash map.
+
+6
+00:00:27,000 --> 00:00:32,000
+Also, we'll learn how to implement logic that would keep fixed number of elements in our linked hash
+
+7
+00:00:32,000 --> 00:00:33,000
+map object.
+
+8
+00:00:33,000 --> 00:00:36,000
+Let's start to understand how linked hash map work.
+
+9
+00:00:36,000 --> 00:00:38,000
+Let's look at this slide.
+
+10
+00:00:38,000 --> 00:00:44,000
+First of all, what we have to understand is that hash map is also implemented on the base of hash table.
+
+11
+00:00:44,000 --> 00:00:47,000
+Then hash map has projectable iteration order.
+
+12
+00:00:48,000 --> 00:00:49,000
+How is this achieved?
+
+13
+00:00:49,000 --> 00:00:53,000
+It is achieved because of the support of double placed inside.
+
+14
+00:00:53,000 --> 00:00:54,000
+On the screen.
+
+15
+00:00:54,000 --> 00:00:59,000
+You can see the image that represents the structure of each bucket and hash table and in addition to
+
+16
+00:00:59,000 --> 00:01:03,000
+that, the properties that allows us to link elements in both directions.
+
+17
+00:01:04,000 --> 00:01:10,000
+That's why when we insert each new entry in the hash map, each entry now is about the next and previous
+
+18
+00:01:10,000 --> 00:01:15,000
+entry that allows us to iterate over this data structure with predictable order.
+
+19
+00:01:16,000 --> 00:01:20,000
+There are also a few more differences in length hash map that I would like to show you in the source
+
+20
+00:01:20,000 --> 00:01:20,000
+code.
+
+21
+00:01:21,000 --> 00:01:24,000
+Here is a source code of linked hash map class.
+
+22
+00:01:24,000 --> 00:01:29,000
+Notice that it extends hash map class and implements map interface.
+
+23
+00:01:29,000 --> 00:01:35,000
+I'd like to draw attention to the special constructor that also takes Boolean Flag as one of the arguments.
+
+24
+00:01:35,000 --> 00:01:41,000
+This documentation set that we have to pass through for access, order and force for insertion order.
+
+25
+00:01:41,000 --> 00:01:47,000
+When I read this first time for me it is not obvious what is the difference between axis order and insertion
+
+26
+00:01:47,000 --> 00:01:47,000
+order.
+
+27
+00:01:48,000 --> 00:01:51,000
+I would say that these are two a different order mechanism.
+
+28
+00:01:51,000 --> 00:01:58,000
+By default it is insertion order, but we can set access order by passing through into this constructor
+
+29
+00:01:59,000 --> 00:01:59,000
+access.
+
+30
+00:01:59,000 --> 00:02:05,000
+So the strategy will ensure that order of iteration of elements is the order of in which the elements
+
+31
+00:02:05,000 --> 00:02:10,000
+were last accessed from the list recently accessed, the most recently accessed.
+
+32
+00:02:10,000 --> 00:02:13,000
+You might be wondering when this can be used.
+
+33
+00:02:13,000 --> 00:02:18,000
+I know that the things are better learned when you know that you can apply your knowledge and practice
+
+34
+00:02:19,000 --> 00:02:22,000
+access order maybe come in handy when you want to implement cache.
+
+35
+00:02:23,000 --> 00:02:23,000
+Probably.
+
+36
+00:02:24,000 --> 00:02:25,000
+You heard those words the first time.
+
+37
+00:02:25,000 --> 00:02:27,000
+Let me explain you what a cache is.
+
+38
+00:02:28,000 --> 00:02:35,000
+Cash is a hardware or software component that stores data so that future requests for that data can
+
+39
+00:02:35,000 --> 00:02:36,000
+be served faster.
+
+40
+00:02:36,000 --> 00:02:42,000
+The data stored in the cache might be as a result of an earlier computation or a copy of data stored
+
+41
+00:02:42,000 --> 00:02:43,000
+elsewhere.
+
+42
+00:02:43,000 --> 00:02:48,000
+For example, you can always keep in cache information about products that attribute most of the times
+
+43
+00:02:49,000 --> 00:02:52,000
+to save time on retrieving all information for product details.
+
+44
+00:02:52,000 --> 00:02:53,000
+Page.
+
+45
+00:02:53,000 --> 00:02:59,000
+We can just store these products in cash and retrieve them only when it is needed to be cost effective
+
+46
+00:02:59,000 --> 00:03:03,000
+and to enable efficient use of data caches must be relatively small.
+
+47
+00:03:04,000 --> 00:03:09,000
+That's why there are several content eviction policies that keep size of the cache fixed.
+
+48
+00:03:09,000 --> 00:03:12,000
+Sometimes it is also called cache replacements.
+
+49
+00:03:12,000 --> 00:03:13,000
+Algorithms.
+
+50
+00:03:14,000 --> 00:03:19,000
+Once a cash flow algorithm should choose which items to discard to make room for the new ones.
+
+51
+00:03:20,000 --> 00:03:23,000
+There really a lot of different election policies.
+
+52
+00:03:23,000 --> 00:03:27,000
+Some of them are first in, first out, last in, first out.
+
+53
+00:03:28,000 --> 00:03:33,000
+You already know what FCF oh, and LIFO means last recently used.
+
+54
+00:03:34,000 --> 00:03:38,000
+According to the strategy, we discard elements that were not used for a long time.
+
+55
+00:03:38,000 --> 00:03:43,000
+The logic that stands behind that is in the case element is not used.
+
+56
+00:03:43,000 --> 00:03:48,000
+There is no science to keep it in cash and it is better to substitute it with a new element.
+
+57
+00:03:49,000 --> 00:03:56,000
+And in case here is a good new element already in the element that counts as usage and element is moved
+
+58
+00:03:56,000 --> 00:04:00,000
+on the new place in this data structure to not be removed.
+
+59
+00:04:01,000 --> 00:04:03,000
+By the way, this is one of the most popular ones.
+
+60
+00:04:04,000 --> 00:04:10,000
+You're going to have a homework to implement your own cache with the help of the hash map most recently
+
+61
+00:04:10,000 --> 00:04:11,000
+used the eviction strategy.
+
+62
+00:04:12,000 --> 00:04:15,000
+It works in the opposite way from least recently use cache.
+
+63
+00:04:15,000 --> 00:04:17,000
+Among the other eviction strategies.
+
+64
+00:04:17,000 --> 00:04:24,000
+It is also possible to mention random replacement, least frequently used, least frequently recently
+
+65
+00:04:24,000 --> 00:04:25,000
+used, etc..
+
+66
+00:04:26,000 --> 00:04:31,000
+So I believe now when you know what the cache is, you can imagine how we can use length hash laced
+
+67
+00:04:31,000 --> 00:04:32,000
+to implement cache.
+
+68
+00:04:33,000 --> 00:04:39,000
+The Access Order EnLink hash map allows us to implement LRU cache an easy way, but what else?
+
+69
+00:04:39,000 --> 00:04:42,000
+We need to implement cache with the help of the cache map.
+
+70
+00:04:43,000 --> 00:04:49,000
+We need to set the size of our cash and then cache map can help us to support fixed size of our cache.
+
+71
+00:04:50,000 --> 00:04:56,000
+How not to get back to the source code in the source code of link Hashmat we can find Remove Alessandri
+
+72
+00:04:56,000 --> 00:04:57,000
+remastered.
+
+73
+00:04:57,000 --> 00:05:03,000
+This method is invoked by Puth and put all methods after incertain and you entry into the map.
+
+74
+00:05:03,000 --> 00:05:08,000
+And in case this message returns through, that means maps should remove its earliest entry.
+
+75
+00:05:09,000 --> 00:05:12,000
+You can see that it has protected access modifier.
+
+76
+00:05:12,000 --> 00:05:18,000
+That means it is not available by default outside of this package and outside of this class and its
+
+77
+00:05:18,000 --> 00:05:19,000
+child classes.
+
+78
+00:05:19,000 --> 00:05:25,000
+The idea is, in case you have to implement cash, we have to override this method and implement the
+
+79
+00:05:25,000 --> 00:05:29,000
+rule that would tell us when we have to remove the Elvis element.
+
+80
+00:05:29,000 --> 00:05:30,000
+Does it make sense?
+
+81
+00:05:31,000 --> 00:05:35,000
+And prepare, for example, to show you this, here is a class that extends length.
+
+82
+00:05:35,000 --> 00:05:42,000
+Hashmat, I also declared filled with a name capacity that contains the value of max elements in the
+
+83
+00:05:42,000 --> 00:05:46,000
+current map, how elements will be removed automatically.
+
+84
+00:05:46,000 --> 00:05:49,000
+I will let little hash map to handle or remorse.
+
+85
+00:05:50,000 --> 00:05:56,000
+What I have to do is to override or remove Alessandri and return true when elements should be removed
+
+86
+00:05:56,000 --> 00:05:56,000
+from map.
+
+87
+00:05:57,000 --> 00:06:04,000
+So when the size of map will become more than capacity, then we have to remove the our capacity by
+
+88
+00:06:04,000 --> 00:06:06,000
+default is three elements.
+
+89
+00:06:06,000 --> 00:06:11,000
+Now, let me create the object of the current class and add four entries here.
+
+90
+00:06:11,000 --> 00:06:14,000
+By default, I insertion order.
+
+91
+00:06:14,000 --> 00:06:20,000
+And that means that when I add force element, the first one should be removed here.
+
+92
+00:06:20,000 --> 00:06:21,000
+Aberrant elements to cancel.
+
+93
+00:06:22,000 --> 00:06:25,000
+Let me run the program to show you console output.
+
+94
+00:06:25,000 --> 00:06:28,000
+And here we can see that the first entry is removed.
+
+95
+00:06:29,000 --> 00:06:35,000
+Now you have enough information that will help you to implement your homework from the public interface
+
+96
+00:06:35,000 --> 00:06:36,000
+that link Hashmat provides.
+
+97
+00:06:36,000 --> 00:06:43,000
+There is no massive that present in this class and absent in hash map since this class extends Hashmat.
+
+98
+00:06:43,000 --> 00:06:48,000
+That means all methods that were reviewed and Hashmat lesson and that were reviewed during the review
+
+99
+00:06:48,000 --> 00:06:53,000
+of map interface are also available for objects of the hash map type.
+
+100
+00:06:53,000 --> 00:06:56,000
+That's why we want to review those methods again.
+
+101
+00:06:57,000 --> 00:07:00,000
+So that's all what I wanted to share with you regarding the hash map.
+
+102
+00:07:01,000 --> 00:07:06,000
+Now let's recap what we have learned today in this lesson we reviewed and in fact, map class.
+
+103
+00:07:07,000 --> 00:07:11,000
+We learned how law enforcement works and what are key features of this type.
+
+104
+00:07:11,000 --> 00:07:17,000
+Now we know what the difference between insertion, order and access order is and how to change the
+
+105
+00:07:17,000 --> 00:07:18,000
+smooth inline hash map.
+
+106
+00:07:19,000 --> 00:07:21,000
+After that, we learned what a cache is.
+
+107
+00:07:22,000 --> 00:07:27,000
+Now, you know, the theory of different election policies and you know that Lenfest map can be used
+
+108
+00:07:27,000 --> 00:07:28,000
+to create LRU cache.
+
+109
+00:07:29,000 --> 00:07:34,000
+Also, we learned how to override the method that would keep constant number of elements.
+
+110
+00:07:34,000 --> 00:07:35,000
+EnLink hash map.
+
+111
+00:07:35,000 --> 00:07:37,000
+Now I suggest reviewing your homework.
+
+112
+00:07:38,000 --> 00:07:43,000
+You have to implement Alario Cash on the basis of little cash map here.
+
+113
+00:07:43,000 --> 00:07:46,000
+I provided you with an interface that you have to implement.
+
+114
+00:07:46,000 --> 00:07:52,000
+According to this task, you have to implement three methods yet that returns value by key on minus
+
+115
+00:07:52,000 --> 00:07:54,000
+one in case the key is not found.
+
+116
+00:07:55,000 --> 00:08:01,000
+Good method that should put key value pair of jeans or update the value for key if such already exists
+
+117
+00:08:02,000 --> 00:08:07,000
+and set capacity method that sets maximum number of elements that can be stored in cash.
+
+118
+00:08:08,000 --> 00:08:12,000
+Try to use knowledge that you gained in this lesson to implement this task.
+
+119
+00:08:12,000 --> 00:08:16,000
+I also share my solution for this task in attachments to this lesson.
+
+120
+00:08:16,000 --> 00:08:19,000
+After you're done, you can compare two solutions if you wish.
+
+121
+00:08:20,000 --> 00:08:21,000
+That's all for today.
+
+122
+00:08:22,000 --> 00:08:23,000
+Thanks a lot for your attention.
+
+123
+00:08:23,000 --> 00:08:25,000
+See you in the next lesson.
+
diff --git a/19 - Java Collections Framework/016 Source-code-of-the-example-used-in-the-lesson.url b/19 - Java Collections Framework/016 Source-code-of-the-example-used-in-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..5ca4d32f02fce30a69fb8738b05fb025c45470ef
--- /dev/null
+++ b/19 - Java Collections Framework/016 Source-code-of-the-example-used-in-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/maps/LinkedHashMapDemo.java
\ No newline at end of file
diff --git a/19 - Java Collections Framework/018 SortedMap, NavigableMap & TreeMap_en.srt b/19 - Java Collections Framework/018 SortedMap, NavigableMap & TreeMap_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..44892a3e5884f7551736ec7b5d545ac69c805ef4
--- /dev/null
+++ b/19 - Java Collections Framework/018 SortedMap, NavigableMap & TreeMap_en.srt
@@ -0,0 +1,732 @@
+1
+00:00:06,000 --> 00:00:10,000
+Hello, adjustments in this lesson, we're going to learn another implementation of map interface,
+
+2
+00:00:10,000 --> 00:00:16,000
+let us dream that we are going to learn in detail such interfaces as sort of map and navigable map.
+
+3
+00:00:17,000 --> 00:00:20,000
+This would help us a lot in understanding of dreama behavior.
+
+4
+00:00:20,000 --> 00:00:25,000
+And at the end of the lesson, we'll have practice with three map and I'll show you how you can use
+
+5
+00:00:25,000 --> 00:00:31,000
+this map with keys that are implements comparable interface and with keys that don't implement comparable
+
+6
+00:00:31,000 --> 00:00:32,000
+interface.
+
+7
+00:00:32,000 --> 00:00:38,000
+We are going to learn what the minority is, what red black minority is and why big ol notational three
+
+8
+00:00:38,000 --> 00:00:42,000
+map for its major operations is all of luck.
+
+9
+00:00:42,000 --> 00:00:48,000
+And let's start and to start with, I'd like to jump to the source code of the sort of map interface
+
+10
+00:00:48,000 --> 00:00:53,000
+to investigate what message I introduce that here is the source code of sorts of map interface.
+
+11
+00:00:53,000 --> 00:00:55,000
+It extends map interface.
+
+12
+00:00:55,000 --> 00:01:02,000
+As you can see here, the first method here in our list is compared to this message of return comparatives
+
+13
+00:01:02,000 --> 00:01:08,000
+that is used in map to source keys or now if such comparator is absent and MAP uses natural ordering
+
+14
+00:01:08,000 --> 00:01:09,000
+of keys.
+
+15
+00:01:10,000 --> 00:01:16,000
+To be honest, this method was not used by me and I think it is not very popular because if you use
+
+16
+00:01:16,000 --> 00:01:21,000
+some comparator to source keys in the map, that means you have the reference to this computer already
+
+17
+00:01:21,000 --> 00:01:25,000
+somewhere in your program and there is no need to get it from the map.
+
+18
+00:01:25,000 --> 00:01:28,000
+And in keys are sorted according to natural order.
+
+19
+00:01:28,000 --> 00:01:32,000
+And there is no sense to call this method because now will be returned.
+
+20
+00:01:32,000 --> 00:01:37,000
+But now you at least known about this method and can use it someday in the future when this will be
+
+21
+00:01:37,000 --> 00:01:38,000
+named.
+
+22
+00:01:38,000 --> 00:01:41,000
+The next method here is some map.
+
+23
+00:01:41,000 --> 00:01:45,000
+I would even say that it is similar to subleased from Liste interface.
+
+24
+00:01:45,000 --> 00:01:47,000
+The principle applied is the same here.
+
+25
+00:01:47,000 --> 00:01:55,000
+We have to specify a key from inclusively and key to exclusively and we will get new sorted map in response.
+
+26
+00:01:55,000 --> 00:02:01,000
+It is also worth to mention that the majority of methods and so that map potentially Mistral class cost
+
+27
+00:02:01,000 --> 00:02:08,000
+exception in the case keys can't be cost to comparable interface or in case there is no comparison available
+
+28
+00:02:08,000 --> 00:02:08,000
+in this map.
+
+29
+00:02:09,000 --> 00:02:14,000
+Besides, with exceptions, there are also a few more potential exceptions that are pretty straightforward.
+
+30
+00:02:14,000 --> 00:02:17,000
+Not pass now as Massata argument.
+
+31
+00:02:17,000 --> 00:02:22,000
+In case you don't want to catch Northpoint exception and do not pass from Ki's that is greater than
+
+32
+00:02:22,000 --> 00:02:25,000
+Tukey to not get a legal argument exception.
+
+33
+00:02:25,000 --> 00:02:27,000
+The next method is HapMap.
+
+34
+00:02:27,000 --> 00:02:30,000
+It returns the view of the map that is less than key given.
+
+35
+00:02:30,000 --> 00:02:36,000
+For example, if you to retrieve all entries at the last and some specific key you can use.
+
+36
+00:02:36,000 --> 00:02:39,000
+This method to map works in the opposite way.
+
+37
+00:02:39,000 --> 00:02:44,000
+It returns the view of the map that contains entries with keys that are greater than or equal to the
+
+38
+00:02:44,000 --> 00:02:48,000
+keys that will be passed as method argument here also.
+
+39
+00:02:48,000 --> 00:02:53,000
+So that map provides the massive that allows us to access first and Laskey.
+
+40
+00:02:53,000 --> 00:02:57,000
+That in turn will allow us to retrieve value from map by this key.
+
+41
+00:02:57,000 --> 00:03:01,000
+That's why we have first massive that returns the lowest key.
+
+42
+00:03:01,000 --> 00:03:07,000
+And Laskey, Massachusetts returns the highest key key said the method similar to the one we have in
+
+43
+00:03:07,000 --> 00:03:08,000
+our map interface.
+
+44
+00:03:08,000 --> 00:03:15,000
+But with clarifications to its implementation, the set that will be returned has iterator that returns
+
+45
+00:03:15,000 --> 00:03:17,000
+the keys in ascending order.
+
+46
+00:03:17,000 --> 00:03:19,000
+Well, this method returns collections.
+
+47
+00:03:19,000 --> 00:03:26,000
+That has iterator, that returns the values in ascending order of the corresponding case and last method
+
+48
+00:03:26,000 --> 00:03:27,000
+here that is also familiar to you.
+
+49
+00:03:27,000 --> 00:03:34,000
+That is entry, said Estrogen's entries in ascending key order that's so massive that introduced and
+
+50
+00:03:34,000 --> 00:03:35,000
+studied map interface.
+
+51
+00:03:35,000 --> 00:03:40,000
+Let's move further and look at the popular interface that extends the solid map interface.
+
+52
+00:03:40,000 --> 00:03:42,000
+I'm talking about navigable map.
+
+53
+00:03:42,000 --> 00:03:45,000
+Here is the source code of navigable map interface.
+
+54
+00:03:46,000 --> 00:03:49,000
+Let's look through the massive data declared here and I will give my comments.
+
+55
+00:03:50,000 --> 00:03:56,000
+The main feature of this map is that it returns the closest matches for given search Target's main message
+
+56
+00:03:56,000 --> 00:04:00,000
+that they introduced in this interface and created to reach this goal.
+
+57
+00:04:00,000 --> 00:04:04,000
+For example, here's the first matter now at least lower entry.
+
+58
+00:04:04,000 --> 00:04:10,000
+It returns an entry that is key value mapping associated with the greatest key that is strictly less
+
+59
+00:04:10,000 --> 00:04:11,000
+than the given key.
+
+60
+00:04:12,000 --> 00:04:16,000
+I'm going to show you this massive difference, the demo in a few minutes to make you understand how
+
+61
+00:04:16,000 --> 00:04:17,000
+this method works.
+
+62
+00:04:17,000 --> 00:04:22,000
+On example, lower key, Masset returns not entry, but on the key.
+
+63
+00:04:22,000 --> 00:04:25,000
+It returns the greatest keys that is typically less than the given.
+
+64
+00:04:25,000 --> 00:04:28,000
+Key to next method is floor entry.
+
+65
+00:04:28,000 --> 00:04:34,000
+It is different from low entry because it returns key value mapping associated with the greatest key.
+
+66
+00:04:34,000 --> 00:04:40,000
+That is not strictly less of the key, but is a less than or equal to the given keys that will be passed
+
+67
+00:04:40,000 --> 00:04:43,000
+as method argument for key regions.
+
+68
+00:04:43,000 --> 00:04:47,000
+Not entry, but only key according to the logic that we have just discussed.
+
+69
+00:04:48,000 --> 00:04:53,000
+Celan entry regions entry associated with the Leskie greater than or equal to the given key.
+
+70
+00:04:54,000 --> 00:05:00,000
+I always do analogy for myself with the real ceiling in my house to remember the logic for this matter.
+
+71
+00:05:00,000 --> 00:05:03,000
+So this message should return the.
+
+72
+00:05:03,000 --> 00:05:08,000
+That is right on my ceiling or above it, but not the element from the next floor.
+
+73
+00:05:08,000 --> 00:05:14,000
+That's why it is set about liste entry greater than or equal to the given key.
+
+74
+00:05:14,000 --> 00:05:16,000
+Does it make more sense now?
+
+75
+00:05:17,000 --> 00:05:24,000
+Holmes's understanding will help you the same as it helps me see key returns key according to the ceiling
+
+76
+00:05:24,000 --> 00:05:31,000
+logic that we have just talked about, the next Masad higher entry written entry with the key that is
+
+77
+00:05:31,000 --> 00:05:33,000
+strictly greater than the given key.
+
+78
+00:05:34,000 --> 00:05:40,000
+In this particular case, I always want to get aliment from the next floor, the disclosers and other
+
+79
+00:05:40,000 --> 00:05:41,000
+elements to my ceiling.
+
+80
+00:05:42,000 --> 00:05:47,000
+This this example, in case we want to continue a real life analogy with the house that we started during
+
+81
+00:05:47,000 --> 00:05:50,000
+the learning of previous Masset hierarchy.
+
+82
+00:05:51,000 --> 00:05:54,000
+I believe you already understood the way how these methods are structured here.
+
+83
+00:05:55,000 --> 00:06:00,000
+Also, navigable map will provide you fast access to the first entry in the map.
+
+84
+00:06:00,000 --> 00:06:07,000
+That is the answer was at least key to yet it just called for a center method and also access will be
+
+85
+00:06:07,000 --> 00:06:10,000
+provided to the last element in the tree to get it.
+
+86
+00:06:10,000 --> 00:06:17,000
+Jesco last entry here you can find a method similar to those that you saw in Q and DEC interfaces.
+
+87
+00:06:17,000 --> 00:06:21,000
+We can get and remove first entry from the map for that pole.
+
+88
+00:06:21,000 --> 00:06:22,000
+First entry.
+
+89
+00:06:22,000 --> 00:06:27,000
+MassArt exists and we can get and remove last entry from the map by Colin Powell.
+
+90
+00:06:27,000 --> 00:06:32,000
+Last entry, take into account the navigable map is sorted map.
+
+91
+00:06:32,000 --> 00:06:35,000
+We also can get navigable map in reverse order.
+
+92
+00:06:35,000 --> 00:06:37,000
+We have to call Distending Map.
+
+93
+00:06:37,000 --> 00:06:44,000
+In this case we also can get navigable set and the standard set by the method name and believe it is
+
+94
+00:06:44,000 --> 00:06:48,000
+clear that order of keys in the he said is reversed.
+
+95
+00:06:49,000 --> 00:06:55,000
+He said life message that we also saw in sort of map, but it works with additional MassArt parameters.
+
+96
+00:06:55,000 --> 00:07:02,000
+In this case, developer can specify whether we want from key inclusively or not the same as we stookey
+
+97
+00:07:02,000 --> 00:07:07,000
+that the level of flexibility that is added in addition to some map from sorted map interface.
+
+98
+00:07:08,000 --> 00:07:15,000
+We also have had map and tail map massas declared in this interface with only one difference that we
+
+99
+00:07:15,000 --> 00:07:20,000
+can specify boolean flag to include or exclude the key from the result.
+
+100
+00:07:21,000 --> 00:07:26,000
+And the last three matters here are equivalent to the ones that are declared in solid map interface.
+
+101
+00:07:26,000 --> 00:07:28,000
+Now it is time to practice a bit.
+
+102
+00:07:29,000 --> 00:07:32,000
+And for the sake of the demo, I prepared the file with examples.
+
+103
+00:07:32,000 --> 00:07:37,000
+I will also share it with you so that you could practice and run the code on your computer.
+
+104
+00:07:38,000 --> 00:07:44,000
+Let me run the program and walk you through the console output here and declare the variable of navigable
+
+105
+00:07:44,000 --> 00:07:51,000
+map type and initialize it with three map object, three map extents, observe map and implements navigable
+
+106
+00:07:51,000 --> 00:07:51,000
+map.
+
+107
+00:07:52,000 --> 00:07:57,000
+It is considered as the most popular implementation of navigable and sorted map interfaces.
+
+108
+00:07:58,000 --> 00:07:59,000
+For the sake of the demo.
+
+109
+00:07:59,000 --> 00:08:03,000
+I just put integers and strings into this map like this.
+
+110
+00:08:03,000 --> 00:08:09,000
+And here you can see different examples of me using the first entry, lower entry, floor entry, higher
+
+111
+00:08:09,000 --> 00:08:11,000
+entry and Celan entry methods.
+
+112
+00:08:11,000 --> 00:08:18,000
+I used three as a key for all Magidson and locations so that you could see the difference here.
+
+113
+00:08:18,000 --> 00:08:24,000
+You can see that even despite the order in which we put entries when we retrieve first entry, we got
+
+114
+00:08:24,000 --> 00:08:32,000
+one because integer object implements comparable interface and integer objects know how to compare themselves
+
+115
+00:08:32,000 --> 00:08:33,000
+with the other integers.
+
+116
+00:08:34,000 --> 00:08:36,000
+Does it make sense now?
+
+117
+00:08:36,000 --> 00:08:42,000
+When I call lower entry, I receive two because the condition for this method is that entry with the
+
+118
+00:08:42,000 --> 00:08:45,000
+greatest key that is strictly less will be returned.
+
+119
+00:08:46,000 --> 00:08:51,000
+But when I call floor entry for keys three, I receive entry with the key three because condition is
+
+120
+00:08:51,000 --> 00:08:57,000
+different and it allows the key would be equal to the one even as method argument.
+
+121
+00:08:58,000 --> 00:09:04,000
+Similar story with higher entry and Celan entry, but in another direction here, a printed map and
+
+122
+00:09:04,000 --> 00:09:06,000
+you can see that it is ordered.
+
+123
+00:09:06,000 --> 00:09:11,000
+I can easily get map in descending order by calling the standing map method.
+
+124
+00:09:11,000 --> 00:09:15,000
+And here you can see in console's at all entries assaulted in the reverse order.
+
+125
+00:09:16,000 --> 00:09:22,000
+Now the thing that you should remember is that we will throw class cost exception in case you would
+
+126
+00:09:22,000 --> 00:09:25,000
+put objects that don't implement comparable interface.
+
+127
+00:09:26,000 --> 00:09:28,000
+But what to do in such cases?
+
+128
+00:09:28,000 --> 00:09:34,000
+We have to pass comparator to the three map constructor that is going to be used to compare keys inside
+
+129
+00:09:35,000 --> 00:09:40,000
+here I created one more map where our keys will be of type products that we used for our online store
+
+130
+00:09:40,000 --> 00:09:44,000
+creation and our values would be of type user.
+
+131
+00:09:44,000 --> 00:09:50,000
+But the type of the value does not make a big difference since Shorten is performed by keys.
+
+132
+00:09:50,000 --> 00:09:56,000
+And here you can see that I created object of comparison that we implemented during one of our homeworks
+
+133
+00:09:56,000 --> 00:09:58,000
+and put this object in constructor here.
+
+134
+00:09:59,000 --> 00:10:05,000
+Now I add few entries here and when I printed to console each key from you, I you can see that all
+
+135
+00:10:05,000 --> 00:10:09,000
+of them are sorted in order that is defined by our comparator.
+
+136
+00:10:10,000 --> 00:10:14,000
+That's why three map is often used to sort map by its case.
+
+137
+00:10:14,000 --> 00:10:21,000
+That said, regarding examples of how you can use to map the next things that I'd like to talk about
+
+138
+00:10:21,000 --> 00:10:25,000
+is performance of three map and how Swardson is implemented in this container.
+
+139
+00:10:26,000 --> 00:10:31,000
+The first thing that is worth to mention is that we map is not based on hash table.
+
+140
+00:10:31,000 --> 00:10:34,000
+It is based on red, black, self balanced binary tree.
+
+141
+00:10:35,000 --> 00:10:42,000
+That's why complexity of algorithms for main operations like get put remove is a big O of logarithm
+
+142
+00:10:42,000 --> 00:10:48,000
+at the dive into the details and explain what an algorithm is I and to try to explain it in these words.
+
+143
+00:10:49,000 --> 00:10:50,000
+The performance is not linear.
+
+144
+00:10:50,000 --> 00:10:56,000
+That means it doesn't depend on a number of elements in the map in one to one proportion.
+
+145
+00:10:56,000 --> 00:11:01,000
+But performance is Calan as we have more elements to visualize this in your head.
+
+146
+00:11:02,000 --> 00:11:03,000
+Take a look at this slide.
+
+147
+00:11:03,000 --> 00:11:09,000
+You can see the visualization of mapping between number of elements and times that it takes for specific
+
+148
+00:11:09,000 --> 00:11:12,000
+operations mapped to the connotation.
+
+149
+00:11:12,000 --> 00:11:18,000
+You also can find the core of the algorithm and on the picture how this makes things clearer.
+
+150
+00:11:19,000 --> 00:11:23,000
+How is this achieved because of the red black self balance binary tree.
+
+151
+00:11:23,000 --> 00:11:24,000
+Let's learn.
+
+152
+00:11:24,000 --> 00:11:25,000
+What is it?
+
+153
+00:11:25,000 --> 00:11:30,000
+Let me start from explaining what a binary tree is in simple words.
+
+154
+00:11:30,000 --> 00:11:37,000
+This is such an algorithm that consists of the nodes or leaves that source links to notes that are greater
+
+155
+00:11:37,000 --> 00:11:40,000
+on the right and notes that are less on the left.
+
+156
+00:11:40,000 --> 00:11:46,000
+This tree has the root and that's why we can say that all elements that are greater than the root are
+
+157
+00:11:46,000 --> 00:11:51,000
+stored on the right and all elements that are less than the root are stored on the left.
+
+158
+00:11:52,000 --> 00:11:57,000
+That's why when I need to find a specific element, I don't iterate over all elements.
+
+159
+00:11:57,000 --> 00:12:00,000
+I go only to show this past.
+
+160
+00:12:00,000 --> 00:12:02,000
+I have to go to find the elements that I need.
+
+161
+00:12:03,000 --> 00:12:06,000
+One potential problem you can see in binary tree.
+
+162
+00:12:07,000 --> 00:12:08,000
+The problem is.
+
+163
+00:12:08,000 --> 00:12:14,000
+Defines the root of the tree in case will define the root and all foreign elements will be greater than
+
+164
+00:12:14,000 --> 00:12:16,000
+the root and will be placed on the right.
+
+165
+00:12:17,000 --> 00:12:23,000
+Then I will get linked list and performance of main operations will be worse than in binary three and
+
+166
+00:12:23,000 --> 00:12:24,000
+will be linear.
+
+167
+00:12:24,000 --> 00:12:30,000
+What to do in this case, it might be a good idea to recalculate the root of the tree on regular basis,
+
+168
+00:12:30,000 --> 00:12:36,000
+to have the same or almost the same number of elements on the right and on the left side of the root.
+
+169
+00:12:37,000 --> 00:12:45,000
+That the moment when red black tree comes into the game, each node stores an extra to and caller used
+
+170
+00:12:45,000 --> 00:12:50,000
+to ensure that the tree remains approximately balanced urine insertions or deletions.
+
+171
+00:12:50,000 --> 00:12:58,000
+That also ensures because of the algorithm and complexity for main operations with red black tree tracking,
+
+172
+00:12:58,000 --> 00:13:04,000
+the color of each node requires only one bit of information overload because there are only two colors.
+
+173
+00:13:05,000 --> 00:13:07,000
+Does it make sense now?
+
+174
+00:13:07,000 --> 00:13:11,000
+You know how sordidness performed into map and how it works inside.
+
+175
+00:13:12,000 --> 00:13:14,000
+That's all what I wanted to share with you.
+
+176
+00:13:14,000 --> 00:13:16,000
+Let's recap what we have learned today.
+
+177
+00:13:17,000 --> 00:13:20,000
+Labellers sorted map interface and navigable map interface.
+
+178
+00:13:21,000 --> 00:13:24,000
+Now, you know, nattered that are declared in these interfaces.
+
+179
+00:13:24,000 --> 00:13:29,000
+Also we had the practice Westry map and now you know how you can use it.
+
+180
+00:13:29,000 --> 00:13:33,000
+We learned what a binary tree is and what a red black binary tree is.
+
+181
+00:13:34,000 --> 00:13:40,000
+Now, you know why performance of major operations of tree map has logarithmic connotation.
+
+182
+00:13:40,000 --> 00:13:41,000
+That's it for today.
+
+183
+00:13:42,000 --> 00:13:45,000
+Thanks a lot for your attention and see you in the next lesson.
+
diff --git a/19 - Java Collections Framework/018 Source-code-of-the-example-used-in-the-lesson.url b/19 - Java Collections Framework/018 Source-code-of-the-example-used-in-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..81bdc8857acee590a48f0905b6fffacd80a59141
--- /dev/null
+++ b/19 - Java Collections Framework/018 Source-code-of-the-example-used-in-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/maps/TreeMapDemo.java
\ No newline at end of file
diff --git a/19 - Java Collections Framework/019 Set Implementations (HashSet practice) & java.util.Colelctions class_en.srt b/19 - Java Collections Framework/019 Set Implementations (HashSet practice) & java.util.Colelctions class_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..1cb6eac7349d51ef521583f5b8225bbfafdfc122
--- /dev/null
+++ b/19 - Java Collections Framework/019 Set Implementations (HashSet practice) & java.util.Colelctions class_en.srt
@@ -0,0 +1,864 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello.
+
+2
+00:00:06,000 --> 00:00:12,000
+Yes, students, today we're going to learn implementations of set interface and talk about utility
+
+3
+00:00:12,000 --> 00:00:18,000
+methods from Collection's class on how that works inside when we review hashad source code.
+
+4
+00:00:18,000 --> 00:00:24,000
+After this lesson, you'll understand how set are different from list will answer what mechanisms is
+
+5
+00:00:24,000 --> 00:00:27,000
+used to keep only unique elements inside the set.
+
+6
+00:00:28,000 --> 00:00:33,000
+I'm going to show you straight safe implementation of that interface and we'll have practice today.
+
+7
+00:00:33,000 --> 00:00:38,000
+And at the end of the lesson, we'll review with your class, with utility methods.
+
+8
+00:00:38,000 --> 00:00:39,000
+That is collections class.
+
+9
+00:00:39,000 --> 00:00:46,000
+Let's start, as you remember, said Interface is located in the collection Iraqi and does not introduce
+
+10
+00:00:46,000 --> 00:00:47,000
+any new methods.
+
+11
+00:00:47,000 --> 00:00:54,000
+Do not forget that that is not a list and said by default does not guarantee any order of elements and
+
+12
+00:00:54,000 --> 00:00:56,000
+index access to the elements.
+
+13
+00:00:56,000 --> 00:01:03,000
+The main feature of that interface and all of its implementations is that it contains only unique elements
+
+14
+00:01:04,000 --> 00:01:10,000
+that various business cases when you need to use set, for example, you are retrieving data from different
+
+15
+00:01:10,000 --> 00:01:16,000
+data sources and you know that data might be duplicated, but you don't need any duplication in this
+
+16
+00:01:16,000 --> 00:01:17,000
+case.
+
+17
+00:01:17,000 --> 00:01:24,000
+You just add elements to the set that takes control over all duplicates, or in the case you interact
+
+18
+00:01:24,000 --> 00:01:29,000
+with user and want to avoid any duplication in information that was provided by user.
+
+19
+00:01:29,000 --> 00:01:35,000
+You you said there are really a lot of cases where you can understand that you need set.
+
+20
+00:01:35,000 --> 00:01:41,000
+And now imagine that if you would be asked to implement something that keeps only unique elements and
+
+21
+00:01:41,000 --> 00:01:43,000
+contain it, how would you do that?
+
+22
+00:01:44,000 --> 00:01:49,000
+Would you use any other containers that you already know something that's already stores?
+
+23
+00:01:49,000 --> 00:01:50,000
+Only unique elements?
+
+24
+00:01:51,000 --> 00:01:58,000
+Try to think for a second before I would give my answer on map implementation store set of keys.
+
+25
+00:01:58,000 --> 00:01:59,000
+And each key is unique.
+
+26
+00:02:00,000 --> 00:02:02,000
+There is no sense to have duplicated keys.
+
+27
+00:02:02,000 --> 00:02:06,000
+That's why in the case we would need to implement set interface.
+
+28
+00:02:06,000 --> 00:02:12,000
+Most likely we would use any map implementation and delegate method invocations to the map.
+
+29
+00:02:12,000 --> 00:02:19,000
+But from the side perspective, it would look like we interact only with keys and we have regular collection,
+
+30
+00:02:19,000 --> 00:02:20,000
+but not the map.
+
+31
+00:02:21,000 --> 00:02:24,000
+Let's review the most popular implementations of that interface.
+
+32
+00:02:25,000 --> 00:02:31,000
+I would say that one of the most popular set implementations is a hash set based on my experience and
+
+33
+00:02:31,000 --> 00:02:35,000
+most of the cases when I need that implementation, I use hash set.
+
+34
+00:02:35,000 --> 00:02:42,000
+It extends abstract set that gives implementation to some basic operations, namely two equals hash
+
+35
+00:02:42,000 --> 00:02:45,000
+code and remove all methods and implements.
+
+36
+00:02:45,000 --> 00:02:52,000
+Set interface hash that is based on the hash map hash that aggregates map inside.
+
+37
+00:02:52,000 --> 00:02:58,000
+And we'll see this today when we investigate the source code and other popular implementation of that
+
+38
+00:02:58,000 --> 00:02:59,000
+interface.
+
+39
+00:02:59,000 --> 00:03:03,000
+Israel hash set this one user linked hash map inside.
+
+40
+00:03:03,000 --> 00:03:10,000
+It extends hash said main feature of link hash said is that it provides predictable iteration order.
+
+41
+00:03:10,000 --> 00:03:14,000
+The next set implementation is called Resat.
+
+42
+00:03:14,000 --> 00:03:16,000
+Can you guess what it is based on?
+
+43
+00:03:16,000 --> 00:03:17,000
+You are right.
+
+44
+00:03:17,000 --> 00:03:23,000
+We said use a stream mapping site to keep all elements sorted according to natural ordering, what with
+
+45
+00:03:23,000 --> 00:03:27,000
+the help of comparator that was provided during the construction of the object.
+
+46
+00:03:28,000 --> 00:03:35,000
+It also extends Absaroka set and implements navigable set interface that in turn extend sort of set
+
+47
+00:03:35,000 --> 00:03:35,000
+interface.
+
+48
+00:03:36,000 --> 00:03:41,000
+And I really believe there will be no need to investigate these interfaces from scratch.
+
+49
+00:03:41,000 --> 00:03:46,000
+Take into account we reviewed in detail, sorted map and navigable map interfaces.
+
+50
+00:03:46,000 --> 00:03:48,000
+One will look at the source code.
+
+51
+00:03:48,000 --> 00:03:54,000
+You understand that implementation of set interface is pretty straightforward for you in case you learned
+
+52
+00:03:54,000 --> 00:03:54,000
+maps.
+
+53
+00:03:54,000 --> 00:03:59,000
+Well, that's why I always, along with my students, map interfaces.
+
+54
+00:03:59,000 --> 00:04:05,000
+First, if you need thread safe implementation of set, you have to choose among different options.
+
+55
+00:04:05,000 --> 00:04:12,000
+Some of them are Kapyong Right array set the said that is based on compound right or at least that keep
+
+56
+00:04:12,000 --> 00:04:15,000
+on the unique elements in container concurrence.
+
+57
+00:04:15,000 --> 00:04:18,000
+Keep list set that is based on concurrence.
+
+58
+00:04:18,000 --> 00:04:24,000
+Keep list map where elements are sorted according to natural ordering or according to the comparator.
+
+59
+00:04:24,000 --> 00:04:28,000
+In other words, this is thread safe implementation of navigable set.
+
+60
+00:04:28,000 --> 00:04:34,000
+And there's also one more option is to use utility methods from collections glass that will churn any
+
+61
+00:04:34,000 --> 00:04:35,000
+map to set.
+
+62
+00:04:36,000 --> 00:04:42,000
+There's also one more implementation of set interface that is usually mentioned in books that is and
+
+63
+00:04:42,000 --> 00:04:42,000
+set.
+
+64
+00:04:43,000 --> 00:04:46,000
+This type exists specifically to store only enum elements.
+
+65
+00:04:47,000 --> 00:04:51,000
+To be honest, I didn't use it very often, but it worth to match it.
+
+66
+00:04:52,000 --> 00:04:58,000
+OK, it looks like now you are familiar with the set Iraqi and now you're ready for the demo, and we'll
+
+67
+00:04:58,000 --> 00:05:02,000
+start our demo today from overview of hash that Scott.
+
+68
+00:05:03,000 --> 00:05:09,000
+Here you can see the property of Type Hashmat Parametrized by any type four keys and object for values.
+
+69
+00:05:10,000 --> 00:05:16,000
+Also, you can see here a constant object that is damage value that will be used as a value that will
+
+70
+00:05:16,000 --> 00:05:19,000
+be associated with all keys in this map.
+
+71
+00:05:20,000 --> 00:05:24,000
+Take into account and have said we are not bothering about the values in the internal map.
+
+72
+00:05:24,000 --> 00:05:30,000
+There is a way to save some memory by putting always the same object as a value into the internal map.
+
+73
+00:05:31,000 --> 00:05:32,000
+Does it make sense?
+
+74
+00:05:32,000 --> 00:05:39,000
+You can find different variations of constructors here, but also considering the fact that Hashad is
+
+75
+00:05:39,000 --> 00:05:43,000
+based on the Hashmat, that in turn is based on the hash table.
+
+76
+00:05:43,000 --> 00:05:48,000
+We can specify initial capacity and load factor in case we want to change performance a bit.
+
+77
+00:05:49,000 --> 00:05:55,000
+And after that you can see that implementation of all methods just delegated the course to the map and
+
+78
+00:05:55,000 --> 00:05:57,000
+adopt interface when it is needed.
+
+79
+00:05:58,000 --> 00:06:01,000
+Here is a size method that just calls map size.
+
+80
+00:06:01,000 --> 00:06:07,000
+Inside here is is empty masset that just cause map is empty inside and so on.
+
+81
+00:06:08,000 --> 00:06:10,000
+Let's look at at method here.
+
+82
+00:06:10,000 --> 00:06:13,000
+You can see that we call Puth Masset from MAP.
+
+83
+00:06:13,000 --> 00:06:20,000
+We put the element that was passed as an argument to this set into its map and associate it with the
+
+84
+00:06:20,000 --> 00:06:24,000
+constant dummy object that we saw at the beginning of our view here.
+
+85
+00:06:24,000 --> 00:06:30,000
+According to collection interface at Mass, it should return true in the case element was inserted and
+
+86
+00:06:30,000 --> 00:06:34,000
+force in case element was not added to collection for some reasons.
+
+87
+00:06:34,000 --> 00:06:40,000
+I believe you remember that put method in map returns the last value associated with this key.
+
+88
+00:06:40,000 --> 00:06:43,000
+And in case this is in Uki, it returns now.
+
+89
+00:06:43,000 --> 00:06:48,000
+So in the case this statement is true, that means an element was added to set.
+
+90
+00:06:48,000 --> 00:06:52,000
+Does it make sense how this makes things clearer?
+
+91
+00:06:52,000 --> 00:06:58,000
+Let's quickly review Sodded set a navigable set interfaces to make sure that these interfaces are pretty
+
+92
+00:06:58,000 --> 00:07:01,000
+similar to sorted map and navigable map.
+
+93
+00:07:01,000 --> 00:07:04,000
+Here is the source code of sorted set interface.
+
+94
+00:07:04,000 --> 00:07:10,000
+You can see pretty familiar to you interface that has methods for retrieving first and last element
+
+95
+00:07:10,000 --> 00:07:13,000
+from container and creating different variations of a subset.
+
+96
+00:07:14,000 --> 00:07:16,000
+Now let's open navigable set interface.
+
+97
+00:07:16,000 --> 00:07:22,000
+If you remember navigable map interface, you already can see that massas name are familiar to you.
+
+98
+00:07:23,000 --> 00:07:29,000
+The only difference is there are no methods that returns entry type, but the rest is really similar.
+
+99
+00:07:30,000 --> 00:07:33,000
+Now let's practice a bit to see how that actually works.
+
+100
+00:07:34,000 --> 00:07:38,000
+I created this demo file to show you how you can interact with anisette implementation.
+
+101
+00:07:39,000 --> 00:07:43,000
+Here you can see that I declare the variable of type set parametrized by integer.
+
+102
+00:07:44,000 --> 00:07:49,000
+That means calculator will watch for me that I would add only integers in this set.
+
+103
+00:07:50,000 --> 00:07:56,000
+OK, let me add a few elements to the set here and print the output of each at Abberation.
+
+104
+00:07:56,000 --> 00:08:04,000
+After that, I will print all set to console, let me run this program and you can see that when I added
+
+105
+00:08:04,000 --> 00:08:10,000
+one the first time it was successfully inserted, but when I tried to insert one, the second time,
+
+106
+00:08:10,000 --> 00:08:13,000
+it wasn't inserted and we got false.
+
+107
+00:08:13,000 --> 00:08:15,000
+Two and three were added successfully.
+
+108
+00:08:15,000 --> 00:08:17,000
+And here you can see my set of numbers.
+
+109
+00:08:18,000 --> 00:08:23,000
+Only three unique numbers are here without any duplication, just one common here.
+
+110
+00:08:23,000 --> 00:08:29,000
+I believe you understand that uniqueness of elements is determined based on the hash code and equals
+
+111
+00:08:29,000 --> 00:08:33,000
+matters, because these two methods help us to place element in hash table.
+
+112
+00:08:34,000 --> 00:08:41,000
+Let me bring you this great new set parametrized by user type in case you missed homework about online
+
+113
+00:08:41,000 --> 00:08:41,000
+store.
+
+114
+00:08:41,000 --> 00:08:44,000
+That is our type from the online store application.
+
+115
+00:08:44,000 --> 00:08:52,000
+I create two objects of default user type that are the same, but the default user class does not override
+
+116
+00:08:52,000 --> 00:08:53,000
+hash code and equals masses.
+
+117
+00:08:54,000 --> 00:09:01,000
+That's why, even in case logically these two objects are equal, set will store both of these elements
+
+118
+00:09:01,000 --> 00:09:08,000
+and here print it all set elements to console and you can see that both users are in the container even
+
+119
+00:09:08,000 --> 00:09:08,000
+despised.
+
+120
+00:09:08,000 --> 00:09:10,000
+They seem to be logical the same.
+
+121
+00:09:11,000 --> 00:09:13,000
+Now, let me show you another example.
+
+122
+00:09:13,000 --> 00:09:18,000
+I agree to objects that overwrites equals and hash code matter.
+
+123
+00:09:18,000 --> 00:09:24,000
+If you remember, during one of the lessons we created the user for hash tables, and this is exactly
+
+124
+00:09:24,000 --> 00:09:27,000
+the object from our lesson about hash tables.
+
+125
+00:09:27,000 --> 00:09:31,000
+If you remember here, you can see equals and hash code overridden.
+
+126
+00:09:32,000 --> 00:09:37,000
+In case I would put these two objects in the set, only one will be added.
+
+127
+00:09:39,000 --> 00:09:44,000
+Here, I change the first name to William and set a different idea to distinguish users without hash
+
+128
+00:09:44,000 --> 00:09:49,000
+code and equals methods, and we use these methods of freedom here.
+
+129
+00:09:49,000 --> 00:09:55,000
+When I printed all users to console one by one, you can see that only one of them was added here.
+
+130
+00:09:56,000 --> 00:10:02,000
+Also, the things that you have already noticed is that you can use Iterator and foreach loop to iterate
+
+131
+00:10:02,000 --> 00:10:05,000
+over all elements in set take into account.
+
+132
+00:10:05,000 --> 00:10:09,000
+It is also implements iterable interface and has its iterator.
+
+133
+00:10:10,000 --> 00:10:16,000
+Now, you know how to use sets in your work, and the last thing that I wanted to share with you today
+
+134
+00:10:16,000 --> 00:10:17,000
+is collections glass.
+
+135
+00:10:18,000 --> 00:10:19,000
+Why do we need it?
+
+136
+00:10:19,000 --> 00:10:21,000
+Sometimes we need utility mass.
+
+137
+00:10:21,000 --> 00:10:22,000
+It's like sort of a collection.
+
+138
+00:10:22,000 --> 00:10:28,000
+For example, let me open the source code of this glass and explore it together with you.
+
+139
+00:10:28,000 --> 00:10:30,000
+It has really a lot of the masses.
+
+140
+00:10:31,000 --> 00:10:36,000
+I will not provide my comments for all the masses listed here, but I will tell Fumaroles about only
+
+141
+00:10:36,000 --> 00:10:38,000
+the most popular ones in my opinion.
+
+142
+00:10:39,000 --> 00:10:44,000
+And I encourage you to use a source code of this class after the lesson and practice and meet with this
+
+143
+00:10:44,000 --> 00:10:46,000
+class by calling different methods.
+
+144
+00:10:47,000 --> 00:10:48,000
+Here we can see Masset.
+
+145
+00:10:49,000 --> 00:10:55,000
+So sometimes instead of calling sort method on the least, we can call source method of collections
+
+146
+00:10:55,000 --> 00:10:59,000
+class, you can reverse order of elements in your list if you wish.
+
+147
+00:10:59,000 --> 00:11:04,000
+You can call reverse Masset and pass reference to any object there if you wish.
+
+148
+00:11:05,000 --> 00:11:10,000
+Here is a shuffle method that you saw we used for demo purposes in one of the lessons and past.
+
+149
+00:11:11,000 --> 00:11:17,000
+Also, you can see some of Masset to swap elements by specifying position indexes or field method to
+
+150
+00:11:17,000 --> 00:11:19,000
+feel content with the specific elements.
+
+151
+00:11:19,000 --> 00:11:25,000
+He is very useful copying method that allows you to copy list methods to find the least.
+
+152
+00:11:25,000 --> 00:11:29,000
+And the greatest elements in collection are also here and here.
+
+153
+00:11:29,000 --> 00:11:35,000
+And one of the coolest methods you can take is a list or said unnavigable, said unnavigable map or
+
+154
+00:11:35,000 --> 00:11:39,000
+anything other to get unverifiable object.
+
+155
+00:11:39,000 --> 00:11:47,000
+In other words, the methods that can rub your objects with unquantifiable ropa when in you just imagine
+
+156
+00:11:47,000 --> 00:11:53,000
+that you implement a method for cars or objects in online store and you don't want to return products
+
+157
+00:11:53,000 --> 00:11:59,000
+of cards and to let anyone else in other parts of the program to add products directly to the list.
+
+158
+00:11:59,000 --> 00:12:00,000
+Does it make sense?
+
+159
+00:12:01,000 --> 00:12:07,000
+What you want instead is that in case somebody wants to add product to the cart, they have to use that
+
+160
+00:12:07,000 --> 00:12:10,000
+product that contains additional business logic.
+
+161
+00:12:10,000 --> 00:12:14,000
+It can be tax free calculation or discount of card calculation.
+
+162
+00:12:14,000 --> 00:12:20,000
+And now we can say that we return on modifiable list because of clients of our cars.
+
+163
+00:12:20,000 --> 00:12:24,000
+Want to investigate what products in it they can look at them.
+
+164
+00:12:24,000 --> 00:12:25,000
+There is no harm in this.
+
+165
+00:12:26,000 --> 00:12:31,000
+But in case they would like to modify the cards, they will catch and unsupported separation exception,
+
+166
+00:12:31,000 --> 00:12:34,000
+the sad creation of wrappers for one modifiable collections.
+
+167
+00:12:34,000 --> 00:12:39,000
+We also can create wrappers to turn our regular containers to thread safe containers.
+
+168
+00:12:40,000 --> 00:12:45,000
+You can find a bunch of methods here that can return to synchronized list or map or set or anything
+
+169
+00:12:45,000 --> 00:12:46,000
+else.
+
+170
+00:12:46,000 --> 00:12:50,000
+If you wish, let me open another my file to show you a few more examples.
+
+171
+00:12:51,000 --> 00:12:51,000
+Collections.
+
+172
+00:12:51,000 --> 00:12:55,000
+Glass also has Masset that can turn any map implementation to set.
+
+173
+00:12:56,000 --> 00:13:01,000
+For example, I can create that safe set on the basis of concurrent Hashmat just like this.
+
+174
+00:13:02,000 --> 00:13:05,000
+Take into account en methods are static and collections class.
+
+175
+00:13:05,000 --> 00:13:12,000
+I write collections class name after that I call method new said from map and parse the concurrent hash
+
+176
+00:13:12,000 --> 00:13:16,000
+map object where keys are parametrized with the same type as my set.
+
+177
+00:13:17,000 --> 00:13:23,000
+According to interface, the values should be parametrized by boolean type and assign this object to
+
+178
+00:13:23,000 --> 00:13:23,000
+my set variable.
+
+179
+00:13:24,000 --> 00:13:30,000
+When you might want to use this, for example, you're extremely satisfied with the performance of concurrent
+
+180
+00:13:30,000 --> 00:13:35,000
+Hashmat and you don't want to use generalized wrapper suggested by collections class.
+
+181
+00:13:35,000 --> 00:13:41,000
+That's why you might want to use this method to create set implementation exactly on the basis of specific
+
+182
+00:13:41,000 --> 00:13:42,000
+map implementation.
+
+183
+00:13:43,000 --> 00:13:44,000
+Does it make sense?
+
+184
+00:13:45,000 --> 00:13:48,000
+And the last but not the least super useful feature of collections.
+
+185
+00:13:48,000 --> 00:13:50,000
+Glass is empty constants.
+
+186
+00:13:51,000 --> 00:13:55,000
+To make you understand what the benefit we can get, I prepared example here for you.
+
+187
+00:13:56,000 --> 00:14:01,000
+Imagine that you have some in a program that is supposed to return to your list of products that are
+
+188
+00:14:01,000 --> 00:14:07,000
+associated with a specific course, i.e. let's call this method get products by Karzai.
+
+189
+00:14:07,000 --> 00:14:08,000
+Awesome.
+
+190
+00:14:08,000 --> 00:14:15,000
+Now we are trying to retrieve products from database by card idea and imagine we got now in response
+
+191
+00:14:15,000 --> 00:14:18,000
+because there are no products associated with this card.
+
+192
+00:14:18,000 --> 00:14:24,000
+Remember, as a rule, my return now from any method you increase the risk of facing with no point the
+
+193
+00:14:24,000 --> 00:14:29,000
+exception in case somebody would interact with the result of this method.
+
+194
+00:14:29,000 --> 00:14:32,000
+In other parts of the program, what is recommended?
+
+195
+00:14:32,000 --> 00:14:37,000
+It is recommended to return empty lists instead to avoid Northpoint exception.
+
+196
+00:14:37,000 --> 00:14:41,000
+OK, let's look at this option now.
+
+197
+00:14:41,000 --> 00:14:45,000
+Imagine that you have huge online store and this method is invoked very often.
+
+198
+00:14:45,000 --> 00:14:52,000
+This will lead you to creation of thousands of objects of our least the need to load your memory even
+
+199
+00:14:52,000 --> 00:14:53,000
+with empty lists.
+
+200
+00:14:53,000 --> 00:14:54,000
+I don't think so.
+
+201
+00:14:54,000 --> 00:14:56,000
+But what is the best option?
+
+202
+00:14:56,000 --> 00:15:02,000
+In my opinion, the best option in this case is to use predefined constants from collections.
+
+203
+00:15:02,000 --> 00:15:03,000
+Glass Empty List.
+
+204
+00:15:03,000 --> 00:15:09,000
+Masset will return you parametrized collection based on the empty list constant if you need you.
+
+205
+00:15:09,000 --> 00:15:15,000
+And also use empty, sad or empty map, for example, hope this information will help you a lot in the
+
+206
+00:15:15,000 --> 00:15:16,000
+future.
+
+207
+00:15:16,000 --> 00:15:21,000
+OK, now I believe we can recap the things that we have learned today.
+
+208
+00:15:22,000 --> 00:15:28,000
+Today, we learned that Iraqi you learned the main interfaces and the most popular implementations of
+
+209
+00:15:28,000 --> 00:15:32,000
+that interface after that review, the source code of Hashmat.
+
+210
+00:15:32,000 --> 00:15:36,000
+And so how set implementations use map implementations inside.
+
+211
+00:15:36,000 --> 00:15:42,000
+We also had the practice with Hash said, and you saw how hash that keeps only unique elements.
+
+212
+00:15:42,000 --> 00:15:47,000
+At the end of the lesson, we learned a lot of utility methods from Collection's class.
+
+213
+00:15:47,000 --> 00:15:52,000
+You also learn best practices of using unverifiable and synchronized robbers.
+
+214
+00:15:52,000 --> 00:15:56,000
+You also know when and why you have to use empty containers.
+
+215
+00:15:57,000 --> 00:15:58,000
+Thanks a lot for your attention.
+
+216
+00:15:59,000 --> 00:16:02,000
+Have a great day and see you in the next lesson.
+
diff --git a/19 - Java Collections Framework/019 Source-code-of-the-example-used-in-the-lesson-Collections.url b/19 - Java Collections Framework/019 Source-code-of-the-example-used-in-the-lesson-Collections.url
new file mode 100644
index 0000000000000000000000000000000000000000..01a5dd2e44074ba30f39437ae8e2b5f9b1ca998c
--- /dev/null
+++ b/19 - Java Collections Framework/019 Source-code-of-the-example-used-in-the-lesson-Collections.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/utils/CollectionsDemo.java
\ No newline at end of file
diff --git a/19 - Java Collections Framework/019 Source-code-of-the-example-used-in-the-lesson-HashSet.url b/19 - Java Collections Framework/019 Source-code-of-the-example-used-in-the-lesson-HashSet.url
new file mode 100644
index 0000000000000000000000000000000000000000..fe127d213e685efae48be3561afad9c9bf87468a
--- /dev/null
+++ b/19 - Java Collections Framework/019 Source-code-of-the-example-used-in-the-lesson-HashSet.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/collections/set/SetDemo.java
\ No newline at end of file
diff --git a/19 - Java Collections Framework/external-links.txt b/19 - Java Collections Framework/external-links.txt
new file mode 100644
index 0000000000000000000000000000000000000000..2748aff6e00db23f0bb0a0df87f4aeb7eebc2649
--- /dev/null
+++ b/19 - Java Collections Framework/external-links.txt
@@ -0,0 +1,69 @@
+
+005 Source-code-of-the-example-used-in-the-lesso
+https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/collections/list/ListDemo.java
+
+005 Homework
+https://docs.google.com/document/d/1g5GRLOU4XRDCIp50n_-Dmnok-2EdoDTlAQdVm6XyBLo/edit?usp=sharing
+
+005 Template-project-for-your-homework
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/hw/onlinestore/withoutlist
+
+005 Solution-of-the-homework-Backend-system-for-online-store-with-list
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/hw/onlinestore/withlist
+
+005 Solution-of-the-homework-DefaultList-and-Performance-of-ArrayList-vs-LinkedList
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/collections/list/hw
+
+005 Solution-for-DefaultMyList-coding-exercise
+https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/collections/list/hw/DefaultMyList.java
+
+008 Source-code-of-the-example-used-in-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/sorting/ComparisonDemo.java
+
+008 Homework
+https://docs.google.com/document/d/1senXk6JLFWsVQnJT5si_QgodHkXMFgIIPK447rgXSN0/edit?usp=sharing
+
+008 Homework-Solution-Custom-Comparator
+https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/hw/onlinestore/withlist/utils/comparators/CustomProductComparator.java
+
+010 Source-code-of-the-examples-used-in-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/collections/iterator
+
+010 Homework
+https://docs.google.com/document/d/1EAQRwHR1HbWt95T3FtS9EOdQsIc_3nZFYUvc6Qv4frQ/edit?usp=sharing
+
+010 Homework-Solution-Custom-Iterator-and-ListIterator
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/collections/list/hw
+
+012 Source-code-of-the-example-used-in-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/collections/queue/QueueDemo.java
+
+012 Homework
+https://docs.google.com/document/d/1EJinEXmADmEbqDnRdz9y6OITVDwhCN7K7FLMjbtE4zs/edit?usp=sharing
+
+012 Solution-for-Homework-Back-end-system-for-help-desk
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/hw/onlinestore/withlist/helpdesk
+
+015 Source-code-of-MapDemo-class
+https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/maps/MapDemo.java
+
+015 Source-code-of-MapSortingDemo-class
+https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/sorting/MapSortingDemo.java
+
+016 Source-code-of-the-example-used-in-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/maps/LinkedHashMapDemo.java
+
+016 Homework-LRU-Cache-Implementation
+https://docs.google.com/document/d/17FzSLVtFx9JRIsRle78nYTuXaCknj2DR6AMXNPP5Rtg/edit?usp=sharing
+
+016 Homework-solution
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/maps/hw
+
+018 Source-code-of-the-example-used-in-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/maps/TreeMapDemo.java
+
+019 Source-code-of-the-example-used-in-the-lesson-HashSet
+https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/collections/set/SetDemo.java
+
+019 Source-code-of-the-example-used-in-the-lesson-Collections
+https://github.com/AndriiPiatakha/learnit_java_core/blob/master/src/com/itbulls/learnit/javacore/jcf/utils/CollectionsDemo.java
diff --git a/20 - Generics/001 Generics in Java_en.srt b/20 - Generics/001 Generics in Java_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..06e591f1e9be6dbd9c2bb86cd81e486edf46706f
--- /dev/null
+++ b/20 - Generics/001 Generics in Java_en.srt
@@ -0,0 +1,1360 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello, Jim.
+
+2
+00:00:06,000 --> 00:00:10,000
+So they are going to answer questions, what are generics in Java and how they work?
+
+3
+00:00:11,000 --> 00:00:14,000
+We'll start from understanding of why do we need generics.
+
+4
+00:00:14,000 --> 00:00:19,000
+After that, we'll understand how you can parametrized your mascots and classes.
+
+5
+00:00:19,000 --> 00:00:22,000
+You're going to understand what Boundy generics in Java are.
+
+6
+00:00:23,000 --> 00:00:27,000
+We'll discuss generics with multiple mounts also in this class.
+
+7
+00:00:27,000 --> 00:00:30,000
+And we are going to learn what the wild cards are and how to use them.
+
+8
+00:00:31,000 --> 00:00:35,000
+Today, we're going to have a lot of practice that will help you to understand generics.
+
+9
+00:00:35,000 --> 00:00:41,000
+And at the end of the lesson, I will explain what a type is and what type erasure is.
+
+10
+00:00:41,000 --> 00:00:45,000
+Let's start and to make you understand what generics are.
+
+11
+00:00:45,000 --> 00:00:50,000
+I suggested starting from examples to make you understand what problem generics intended to solve.
+
+12
+00:00:51,000 --> 00:00:52,000
+Imagine the next iteration.
+
+13
+00:00:52,000 --> 00:00:57,000
+You have array of strings and you want to have mastered that process is data.
+
+14
+00:00:57,000 --> 00:01:02,000
+For the sake of example, let's imagine that you need to have masses that would print all elements of
+
+15
+00:01:02,000 --> 00:01:04,000
+array to console in some custom way.
+
+16
+00:01:04,000 --> 00:01:11,000
+Here I created massive print array that takes array of strings as Masad argument inside a grade for
+
+17
+00:01:11,000 --> 00:01:14,000
+each loop and before printing any new element.
+
+18
+00:01:14,000 --> 00:01:19,000
+I also print words aliment and only after that some element is printed.
+
+19
+00:01:19,000 --> 00:01:25,000
+Now you realized that you have not only array of strings in your program, you also want to apply the
+
+20
+00:01:25,000 --> 00:01:27,000
+same behavior for an array of integers.
+
+21
+00:01:27,000 --> 00:01:32,000
+But the existing method will not work with an array of integers since it is specified that it works
+
+22
+00:01:32,000 --> 00:01:34,000
+only with the array of strings.
+
+23
+00:01:34,000 --> 00:01:38,000
+Let me uncommon this line and you can see a compilation error here.
+
+24
+00:01:39,000 --> 00:01:44,000
+What to do in this case, create another method that will work with array of integers, I assure.
+
+25
+00:01:45,000 --> 00:01:50,000
+What would you do in case you would need the same method for array of numbers or array of your custom
+
+26
+00:01:50,000 --> 00:01:51,000
+type user, for example?
+
+27
+00:01:52,000 --> 00:01:54,000
+That is definitely not the best option.
+
+28
+00:01:54,000 --> 00:02:00,000
+But what I would recommend to do in this case, it would be perfect to create the method that would
+
+29
+00:02:00,000 --> 00:02:03,000
+work with arrays of different types, what they think.
+
+30
+00:02:03,000 --> 00:02:09,000
+But how to do this in Java, that is exactly what generic mechanism is created for.
+
+31
+00:02:09,000 --> 00:02:14,000
+In other words, we can create parameterized methods and classes that would work with different types.
+
+32
+00:02:15,000 --> 00:02:21,000
+And here you already can see the first advantage of using generics you can avoid of code duplication
+
+33
+00:02:21,000 --> 00:02:23,000
+and increase cautery usage in your program.
+
+34
+00:02:24,000 --> 00:02:27,000
+Let me comment this parametrized method and explain use syntax.
+
+35
+00:02:28,000 --> 00:02:34,000
+This method is similar to the one we already have, but before the type of returns value, we have just
+
+36
+00:02:34,000 --> 00:02:35,000
+word here.
+
+37
+00:02:35,000 --> 00:02:38,000
+I write it in Diamond Operator.
+
+38
+00:02:38,000 --> 00:02:45,000
+These characters from both sides are called together as diamond operator whispered Sify, our parameterized
+
+39
+00:02:45,000 --> 00:02:46,000
+type in the diamond operator.
+
+40
+00:02:47,000 --> 00:02:52,000
+This is also called generic and will explain in simple words what this is about.
+
+41
+00:02:53,000 --> 00:02:55,000
+This is a placeholder for some specific type.
+
+42
+00:02:56,000 --> 00:02:58,000
+Theoretically, I can write Annunziata here.
+
+43
+00:02:59,000 --> 00:03:05,000
+The main thing is that letter that I specified here will be the same as in the Massett parameters and
+
+44
+00:03:05,000 --> 00:03:06,000
+Method Masmoudi.
+
+45
+00:03:07,000 --> 00:03:15,000
+And after I wrote it here, I can treat this E as a specific type and use it with parameters, for example,
+
+46
+00:03:15,000 --> 00:03:17,000
+or anywhere inside the method.
+
+47
+00:03:17,000 --> 00:03:23,000
+But here you can see that I have array of type E and while iterating over each element in this area,
+
+48
+00:03:23,000 --> 00:03:26,000
+I also use E type for my variable here.
+
+49
+00:03:27,000 --> 00:03:34,000
+Now I can call this method for most string and integer array the same as for all other types.
+
+50
+00:03:34,000 --> 00:03:40,000
+Let me comment, Prenter, a message that works only with strings and leave my generic method awesome.
+
+51
+00:03:40,000 --> 00:03:45,000
+And you can see that I don't have any compilation error anymore here.
+
+52
+00:03:45,000 --> 00:03:48,000
+Let's make a definition of generic method now.
+
+53
+00:03:48,000 --> 00:03:52,000
+Generic method is a method that introduce its own type parameters.
+
+54
+00:03:53,000 --> 00:03:57,000
+I believe now you understand what generics are and why do we need them.
+
+55
+00:03:57,000 --> 00:04:04,000
+Also, you know how to parametrized your methods now, but what is a potential issue in this case?
+
+56
+00:04:04,000 --> 00:04:07,000
+In this case, for the type inside the method body?
+
+57
+00:04:07,000 --> 00:04:13,000
+I can use only Massett that are available for object type, but not any other methods that are specific
+
+58
+00:04:13,000 --> 00:04:21,000
+to string or integer or any other type Y because compiler doesn't know what type will be here during
+
+59
+00:04:21,000 --> 00:04:22,000
+the runtime.
+
+60
+00:04:22,000 --> 00:04:29,000
+I can't call here any string methods because compiler can guarantee that only objects of type streambed
+
+61
+00:04:29,000 --> 00:04:30,000
+will be here.
+
+62
+00:04:31,000 --> 00:04:37,000
+As we can see on this example, objects of any type might be here and what to do in case I need some
+
+63
+00:04:37,000 --> 00:04:40,000
+behavior that is related to some specific hierarchy of objects.
+
+64
+00:04:41,000 --> 00:04:45,000
+What if I know that this method wouldn't work with any objects at all?
+
+65
+00:04:45,000 --> 00:04:50,000
+But this method has to work with any type that implements comparable interface.
+
+66
+00:04:50,000 --> 00:04:57,000
+In this case, I can count on the fact that objects inside my body will have compared to Masset and
+
+67
+00:04:57,000 --> 00:05:00,000
+I will be able to use this API in the mess and body.
+
+68
+00:05:01,000 --> 00:05:01,000
+Does it make sense?
+
+69
+00:05:02,000 --> 00:05:08,000
+To help you understand this, let me open another example here, I opened another file where I prepared
+
+70
+00:05:08,000 --> 00:05:10,000
+other examples for you.
+
+71
+00:05:10,000 --> 00:05:16,000
+Let's imagine that I have to create a that would be able to find the greatest value out of three variables.
+
+72
+00:05:16,000 --> 00:05:23,000
+And I want to implement generic method, but not a bunch of separate methods that works with only strings,
+
+73
+00:05:23,000 --> 00:05:25,000
+only integers, only double values.
+
+74
+00:05:26,000 --> 00:05:30,000
+How to do that generic with boundaries will help us with this task.
+
+75
+00:05:30,000 --> 00:05:33,000
+They're also called bounded type parameters.
+
+76
+00:05:34,000 --> 00:05:36,000
+Here you can see massive declaration.
+
+77
+00:05:36,000 --> 00:05:38,000
+The methods name is max value.
+
+78
+00:05:38,000 --> 00:05:45,000
+The next thing that you can notice here is that we use different letter here now instead of E, we have
+
+79
+00:05:45,000 --> 00:05:51,000
+key and he is parameterization of my method here in Diamond Operator.
+
+80
+00:05:51,000 --> 00:05:58,000
+I say that this method should work with some type that extends comparable and comparable in turn is
+
+81
+00:05:58,000 --> 00:06:00,000
+parameterized with this type.
+
+82
+00:06:00,000 --> 00:06:08,000
+In other words, some type T should use it extends comparable interface or implement comparable interface.
+
+83
+00:06:08,000 --> 00:06:14,000
+This is called upper bound with parameterization because we set boundary from the top.
+
+84
+00:06:14,000 --> 00:06:15,000
+Doesn't make sense.
+
+85
+00:06:16,000 --> 00:06:17,000
+Also, one more common here.
+
+86
+00:06:18,000 --> 00:06:23,000
+It is possible to make multiple sounds like it is specified here in command line.
+
+87
+00:06:23,000 --> 00:06:28,000
+I will leave it here, command it so that you could learn this when you will download the source code
+
+88
+00:06:28,000 --> 00:06:30,000
+that I am showing right now.
+
+89
+00:06:30,000 --> 00:06:37,000
+So you can say that we should extend both comparable interface and compare the interface.
+
+90
+00:06:37,000 --> 00:06:39,000
+That's just for the sake of example.
+
+91
+00:06:39,000 --> 00:06:46,000
+I believe you understand that instead of comparator, you can specify any other type here and only in
+
+92
+00:06:46,000 --> 00:06:50,000
+case our custom type T will implement both of these interfaces.
+
+93
+00:06:51,000 --> 00:06:57,000
+Only in this case we could work with this method and methods, arguments of type T, you even can see
+
+94
+00:06:57,000 --> 00:07:03,000
+that I have a compilation error because neither string or integer nor verbal implements both of these
+
+95
+00:07:03,000 --> 00:07:04,000
+interfaces simultaneously.
+
+96
+00:07:04,000 --> 00:07:11,000
+Let me erase this to proceed with our demo potentially that you can also use time that is specified
+
+97
+00:07:11,000 --> 00:07:17,000
+for parameterization as a returned type so you can get the type that was used as parameters here.
+
+98
+00:07:18,000 --> 00:07:24,000
+The main thing and all of this is that this type should be the same everywhere across the MassArt in
+
+99
+00:07:24,000 --> 00:07:26,000
+case the first argument is string.
+
+100
+00:07:26,000 --> 00:07:32,000
+It is not possible that other arguments wouldn't be of different type or return type would be different.
+
+101
+00:07:32,000 --> 00:07:37,000
+And now Compiler is aware that this type will be compatible with comparable interface.
+
+102
+00:07:37,000 --> 00:07:43,000
+That means that all variables that are passed as arguments to this method have compared to MassArt.
+
+103
+00:07:43,000 --> 00:07:49,000
+That's why all logic that is written in this method is rely on the fact that we can use this method
+
+104
+00:07:50,000 --> 00:07:52,000
+and there are no any compilation errors.
+
+105
+00:07:52,000 --> 00:07:53,000
+That's great.
+
+106
+00:07:53,000 --> 00:07:59,000
+And here you can see in my method that I can invoke max value method with different types of arguments.
+
+107
+00:07:59,000 --> 00:08:06,000
+No matter is as this integer double or string type, let me run this program from the console output.
+
+108
+00:08:06,000 --> 00:08:09,000
+We can conclude that our method works as expected.
+
+109
+00:08:10,000 --> 00:08:13,000
+Now you know how the Parameterize method was bound.
+
+110
+00:08:13,000 --> 00:08:15,000
+Hobbs's makes things clearer.
+
+111
+00:08:15,000 --> 00:08:18,000
+Let's go to the next example and this example.
+
+112
+00:08:18,000 --> 00:08:21,000
+I'm going to show you how you can parameterize your class here.
+
+113
+00:08:21,000 --> 00:08:25,000
+You can see Diamont operator right next to my class name.
+
+114
+00:08:25,000 --> 00:08:29,000
+That means I parametrized my class, for example.
+
+115
+00:08:29,000 --> 00:08:37,000
+I can declare property of type key and Masset parameters like in this set method also can be of my type,
+
+116
+00:08:37,000 --> 00:08:42,000
+e.g. I can initialize my field with the values that will be passed as massas argument here.
+
+117
+00:08:43,000 --> 00:08:48,000
+The method will return me a value of type that we used to parametrized my class.
+
+118
+00:08:48,000 --> 00:08:49,000
+And here's example.
+
+119
+00:08:50,000 --> 00:08:52,000
+I declare the variable of type generic.
+
+120
+00:08:52,000 --> 00:08:58,000
+Mazrui was a name integer in box and used Diament operator to parameterize this type by integer.
+
+121
+00:08:59,000 --> 00:09:05,000
+After that I created the object and used Diament operator after Anjelah version seven.
+
+122
+00:09:05,000 --> 00:09:11,000
+There is no need to duplicate parameterization type in Diament operator here, but you can if you wish.
+
+123
+00:09:12,000 --> 00:09:18,000
+For example, here I left integer type and then my second variable was a name string box that I parametrized
+
+124
+00:09:18,000 --> 00:09:19,000
+by string.
+
+125
+00:09:19,000 --> 00:09:22,000
+I left blank my second Diament operator.
+
+126
+00:09:22,000 --> 00:09:26,000
+In most cases type is specified only when you declare a variable.
+
+127
+00:09:27,000 --> 00:09:33,000
+And here you can see that my integer box can work only with integers and there is a compilation error
+
+128
+00:09:33,000 --> 00:09:35,000
+in case I would try to set any string.
+
+129
+00:09:35,000 --> 00:09:38,000
+Object is a similar story with my string box.
+
+130
+00:09:39,000 --> 00:09:44,000
+That is because these two variables are parametrized with different types and in the first case set
+
+131
+00:09:44,000 --> 00:09:46,000
+Masset except on the integers.
+
+132
+00:09:46,000 --> 00:09:50,000
+And in the second case, set method accepts only strings.
+
+133
+00:09:51,000 --> 00:09:55,000
+When I use get MassArt and receive integer and string type accordingly.
+
+134
+00:09:55,000 --> 00:10:01,000
+And here you can see that I print values to console and used special format specifiers for that some.
+
+135
+00:10:02,000 --> 00:10:08,000
+Numbers and string accordingly, let me run this program, you can see that everything works as expected
+
+136
+00:10:08,000 --> 00:10:09,000
+without any errors.
+
+137
+00:10:10,000 --> 00:10:12,000
+Let's create a definition of generic type.
+
+138
+00:10:12,000 --> 00:10:19,000
+Now, when you saw the example and generic type is a generic class or interface that is parameterized
+
+139
+00:10:19,000 --> 00:10:20,000
+over types.
+
+140
+00:10:20,000 --> 00:10:22,000
+And now let's continue our lesson.
+
+141
+00:10:23,000 --> 00:10:28,000
+Even if you would not use parameterization and generics for your own custom classes, you would use
+
+142
+00:10:28,000 --> 00:10:31,000
+generics a lot with classes from Java collections framework.
+
+143
+00:10:32,000 --> 00:10:38,000
+It is super useful because it wasn't possible to create collections for all possible types.
+
+144
+00:10:38,000 --> 00:10:43,000
+That's why all types from Java collections framework are parametrized and use generics.
+
+145
+00:10:44,000 --> 00:10:46,000
+Let me open source code of arriviste.
+
+146
+00:10:46,000 --> 00:10:54,000
+You can see that it is parameterized with each type and if I open at Masset, you can see that it adds
+
+147
+00:10:54,000 --> 00:10:55,000
+elements of each type.
+
+148
+00:10:59,000 --> 00:11:06,000
+And get maced in return elements of each type, does it make sense sometimes even parametrized with
+
+149
+00:11:06,000 --> 00:11:12,000
+two types, for example, on implementations specify separate type for key and value.
+
+150
+00:11:12,000 --> 00:11:15,000
+Let me open hash map or squad here.
+
+151
+00:11:15,000 --> 00:11:23,000
+You can see that I can specify type for key and a separate type for Lélia just to placeholders and input
+
+152
+00:11:23,000 --> 00:11:23,000
+MassArt.
+
+153
+00:11:23,000 --> 00:11:31,000
+You can see that I put key of type K and value of type we and type of return value is the same as type
+
+154
+00:11:31,000 --> 00:11:37,000
+of the value we, because according to this interface we receive the last value that is associated with
+
+155
+00:11:37,000 --> 00:11:38,000
+a given key.
+
+156
+00:11:38,000 --> 00:11:44,000
+But the details of the interfaces of our collections framework are covered in the separate lessons.
+
+157
+00:11:44,000 --> 00:11:50,000
+Now you know how to parameterize your class and you know how types from Java collections framework are
+
+158
+00:11:50,000 --> 00:11:51,000
+parametrized.
+
+159
+00:11:52,000 --> 00:11:55,000
+We have one more important and practical thing to talk about.
+
+160
+00:11:55,000 --> 00:11:59,000
+I want to talk with you about the wild cards with upper and lower bounds.
+
+161
+00:12:00,000 --> 00:12:03,000
+Let me open another demo file that I prepared before this lesson.
+
+162
+00:12:04,000 --> 00:12:09,000
+To make you understand this example, let me show you all classes that will take part in our demo.
+
+163
+00:12:10,000 --> 00:12:16,000
+I declared all classes in one file to keep everything grouped for the demo and to not switch tabs and
+
+164
+00:12:16,000 --> 00:12:17,000
+engines that we have.
+
+165
+00:12:17,000 --> 00:12:22,000
+Some parent class and child class extends parent and grandchild.
+
+166
+00:12:22,000 --> 00:12:24,000
+Class extends child.
+
+167
+00:12:24,000 --> 00:12:25,000
+Is it clear?
+
+168
+00:12:26,000 --> 00:12:26,000
+Cool.
+
+169
+00:12:26,000 --> 00:12:27,000
+Let's move on.
+
+170
+00:12:28,000 --> 00:12:34,000
+Now imagine that I have at least parametrized by type child and I have mastered that can work with any
+
+171
+00:12:34,000 --> 00:12:37,000
+list objects that are parametrized by time parent.
+
+172
+00:12:37,000 --> 00:12:39,000
+It is called process parent elements.
+
+173
+00:12:40,000 --> 00:12:45,000
+How do you think MacColl process span's elements MassArt and POS collection of child elements there?
+
+174
+00:12:46,000 --> 00:12:53,000
+Logically, it seems to be OK since each child class should have all methods that parent class has and
+
+175
+00:12:53,000 --> 00:12:55,000
+compilers should not be worried about this.
+
+176
+00:12:55,000 --> 00:13:00,000
+But if I ask you this question, you already suspected something, don't you?
+
+177
+00:13:00,000 --> 00:13:01,000
+You are right.
+
+178
+00:13:01,000 --> 00:13:03,000
+If you are suspicious, this wouldn't work.
+
+179
+00:13:04,000 --> 00:13:05,000
+You can see compilation error here.
+
+180
+00:13:06,000 --> 00:13:06,000
+Why?
+
+181
+00:13:07,000 --> 00:13:11,000
+Because list of child elements is not a list of parent elements.
+
+182
+00:13:11,000 --> 00:13:14,000
+That said, what what to do in this case.
+
+183
+00:13:14,000 --> 00:13:17,000
+Usually in this case, engineers use wild cards.
+
+184
+00:13:17,000 --> 00:13:23,000
+Let me show you the next method we have process elements, method, the text list of elements that is
+
+185
+00:13:23,000 --> 00:13:26,000
+parametrized by any type that extends Berent.
+
+186
+00:13:27,000 --> 00:13:31,000
+This question mark is called wildcard and can be treated as any type.
+
+187
+00:13:32,000 --> 00:13:34,000
+This is called upper bound at wild card.
+
+188
+00:13:35,000 --> 00:13:40,000
+In this case, I can pass list that contains elements of type child to this method.
+
+189
+00:13:40,000 --> 00:13:43,000
+And here you can see that there are no errors.
+
+190
+00:13:43,000 --> 00:13:44,000
+Does it make sense?
+
+191
+00:13:45,000 --> 00:13:48,000
+Now I want you to put all the attention to the next example.
+
+192
+00:13:49,000 --> 00:13:54,000
+When you use cards, that means you can get elements of type parent from this collection.
+
+193
+00:13:54,000 --> 00:14:00,000
+I believe that is clear that you will not be able to extract element of type child from this list because
+
+194
+00:14:00,000 --> 00:14:05,000
+there is no guarantee what type would be here instead of the question mark during the runtime.
+
+195
+00:14:06,000 --> 00:14:09,000
+It can be child, but it also can be parent type.
+
+196
+00:14:09,000 --> 00:14:13,000
+And that's why custom foreign object to child type would cause exception.
+
+197
+00:14:13,000 --> 00:14:19,000
+And most likely, parent doesn't have all methods and behavior that is described in the child type.
+
+198
+00:14:19,000 --> 00:14:20,000
+Is it clear?
+
+199
+00:14:21,000 --> 00:14:26,000
+OK, we understood that we can get elements of type parent in case we use upper bound at wild card.
+
+200
+00:14:27,000 --> 00:14:29,000
+But can we add elements to this content?
+
+201
+00:14:30,000 --> 00:14:31,000
+Unfortunately we can't.
+
+202
+00:14:32,000 --> 00:14:39,000
+And here the examples you can see that I can't add neither parent nor child nor grandchild objects I
+
+203
+00:14:39,000 --> 00:14:40,000
+cannot only know value.
+
+204
+00:14:41,000 --> 00:14:48,000
+You might be wondering why why I can't add object of parent type to collection of elements, parametrized
+
+205
+00:14:48,000 --> 00:14:49,000
+by parent type.
+
+206
+00:14:49,000 --> 00:14:52,000
+But let's look at this from another side.
+
+207
+00:14:52,000 --> 00:14:57,000
+This is a very smart mechanism created in Java to save engineers from potential errors.
+
+208
+00:14:57,000 --> 00:15:04,000
+The main issue is that because we don't know what type would be here during the runtime, that's why
+
+209
+00:15:04,000 --> 00:15:07,000
+interactions with such collections are limited.
+
+210
+00:15:07,000 --> 00:15:13,000
+Imagine that during the runtime I will pass list of elements of type child and I will add element of
+
+211
+00:15:13,000 --> 00:15:14,000
+time parent.
+
+212
+00:15:15,000 --> 00:15:21,000
+And after I modified this collection in this method, I will get the element and I would think that
+
+213
+00:15:21,000 --> 00:15:27,000
+all elements in this container are of child type and I will call some child specific method.
+
+214
+00:15:27,000 --> 00:15:28,000
+What will happen?
+
+215
+00:15:28,000 --> 00:15:36,000
+I will get error during the runtime because indeed I will get here object of parent time and this object
+
+216
+00:15:36,000 --> 00:15:38,000
+will have child specific method.
+
+217
+00:15:39,000 --> 00:15:46,000
+That is why Compiler wants to eliminate cases like this and just doesn't allow me to add any elements
+
+218
+00:15:46,000 --> 00:15:47,000
+in this method.
+
+219
+00:15:47,000 --> 00:15:52,000
+Does it make sense and leave now you understood how upper bound at wild cards work.
+
+220
+00:15:53,000 --> 00:15:55,000
+Now let's take a look at another case.
+
+221
+00:15:55,000 --> 00:15:58,000
+What to do in case I have to create.
+
+222
+00:15:58,000 --> 00:16:04,000
+That will be able to add new elements to the collection in this case, we have to use lower bound at
+
+223
+00:16:04,000 --> 00:16:08,000
+wild cards here you can see that I created two more lists.
+
+224
+00:16:09,000 --> 00:16:14,000
+One of them is parametrized by parent type and another one is parametrized by child type.
+
+225
+00:16:14,000 --> 00:16:20,000
+And you can see that I call process elements to Masset and parse the first and the second list object
+
+226
+00:16:20,000 --> 00:16:20,000
+there.
+
+227
+00:16:21,000 --> 00:16:25,000
+But I can't pass list of elements that are parametrized by grandchild type.
+
+228
+00:16:26,000 --> 00:16:28,000
+Let's investigate process elements to MassArt.
+
+229
+00:16:29,000 --> 00:16:31,000
+This method has lower bound and wild card.
+
+230
+00:16:32,000 --> 00:16:34,000
+You can see super keyword here.
+
+231
+00:16:34,000 --> 00:16:35,000
+What does that mean?
+
+232
+00:16:36,000 --> 00:16:42,000
+That means that this method can take as an argument any object of type liste parametrized by any type
+
+233
+00:16:42,000 --> 00:16:47,000
+that is parent or in other words, super type with respect to child type.
+
+234
+00:16:48,000 --> 00:16:52,000
+That's why I can't pass Barrentine or super type of child.
+
+235
+00:16:52,000 --> 00:16:57,000
+This could be any super type, including parent and even object is clear.
+
+236
+00:16:58,000 --> 00:17:00,000
+If yes, then let's proceed.
+
+237
+00:17:00,000 --> 00:17:05,000
+In this case I can get on the elements of type object and I believe you already understood why.
+
+238
+00:17:06,000 --> 00:17:11,000
+Because there is no guarantee what super type of child type will be here during the runtime.
+
+239
+00:17:11,000 --> 00:17:18,000
+But what types I can put into this collection, I can put any time that this child with respect to child
+
+240
+00:17:18,000 --> 00:17:23,000
+type here, you can see that I can add object of type child and grandchild.
+
+241
+00:17:24,000 --> 00:17:32,000
+And also I always can add now, for example, I can't add any super type of type child, including parent
+
+242
+00:17:32,000 --> 00:17:38,000
+type and object y if this sounds completely not logical, then consider the next case.
+
+243
+00:17:39,000 --> 00:17:45,000
+Imagine that we have passed here container full of objects of type child and in case compiler let me
+
+244
+00:17:45,000 --> 00:17:46,000
+add the parent object.
+
+245
+00:17:46,000 --> 00:17:52,000
+And after this collection was modified, I retrieve object of child type from here and called child
+
+246
+00:17:52,000 --> 00:17:59,000
+specific method and program fails because that object doesn't have child specific behavior and case
+
+247
+00:17:59,000 --> 00:18:05,000
+I passed here at least parametrized by any other type that is super with respect to child type.
+
+248
+00:18:05,000 --> 00:18:12,000
+There is no harm in this at all to add child or grandchild object in this container because each of
+
+249
+00:18:12,000 --> 00:18:16,000
+the specific types for sure has behavior of its parent type.
+
+250
+00:18:16,000 --> 00:18:17,000
+Does it make sense?
+
+251
+00:18:18,000 --> 00:18:24,000
+We can make a conclusion in case you want to create a method that will work with collections, parametrized
+
+252
+00:18:24,000 --> 00:18:30,000
+by different types, and you want to use this method to modify the collection and to add elements there
+
+253
+00:18:30,000 --> 00:18:32,000
+you have to use lower bound at wild cards.
+
+254
+00:18:32,000 --> 00:18:38,000
+But in case you wanted to use this method only to read elements from the container to process that data,
+
+255
+00:18:38,000 --> 00:18:45,000
+then you have to use upper bound at wild cards because upper bound wild cards allow us to read from
+
+256
+00:18:45,000 --> 00:18:50,000
+the container specific type and use its methods to get all necessary data.
+
+257
+00:18:50,000 --> 00:18:56,000
+You already learned how to use bounded wild cards, but should we use wild cards without bounds?
+
+258
+00:18:57,000 --> 00:18:59,000
+I would say that this is super rare case.
+
+259
+00:19:00,000 --> 00:19:00,000
+That's why.
+
+260
+00:19:01,000 --> 00:19:02,000
+Let me show you this on example.
+
+261
+00:19:03,000 --> 00:19:05,000
+Let me open source code of absurd collection.
+
+262
+00:19:06,000 --> 00:19:09,000
+You can see that absolute collection is parametrized by any type.
+
+263
+00:19:10,000 --> 00:19:11,000
+But let's look at contains all.
+
+264
+00:19:11,000 --> 00:19:14,000
+Macit, can you see wild card here.
+
+265
+00:19:15,000 --> 00:19:21,000
+That means that contains some method can work with any collection that contains any types inside.
+
+266
+00:19:21,000 --> 00:19:24,000
+Then what is the difference between each type and wild card?
+
+267
+00:19:25,000 --> 00:19:31,000
+The point is that each type will be erased and substituted with a specific type everywhere with the
+
+268
+00:19:31,000 --> 00:19:38,000
+type that we will specify, whereas wild cards would always mean any type, but not the exactly one
+
+269
+00:19:38,000 --> 00:19:41,000
+type that we used to parameterize instance of our object.
+
+270
+00:19:41,000 --> 00:19:43,000
+Does it make things clearer?
+
+271
+00:19:43,000 --> 00:19:48,000
+I will leave linked to this example in attachments to this Larssen so that you could investigate it.
+
+272
+00:19:48,000 --> 00:19:55,000
+But pay attention that this specific example you won't be able to run because I described various scenarios
+
+273
+00:19:55,000 --> 00:19:57,000
+that causes compilation error.
+
+274
+00:19:57,000 --> 00:20:03,000
+But still you can play around with compilation properties to understand wildcards together with upper
+
+275
+00:20:03,000 --> 00:20:04,000
+and lower bounds.
+
+276
+00:20:04,000 --> 00:20:09,000
+Let me open the next demo file to show you the next example and this example.
+
+277
+00:20:09,000 --> 00:20:13,000
+I want you to understand the generic exist only for our compiler.
+
+278
+00:20:14,000 --> 00:20:18,000
+There are no generics during the runtime because of the type erasure type.
+
+279
+00:20:18,000 --> 00:20:25,000
+Erasure can be explained as a process of enforcing type constraints only at compile time and discarding
+
+280
+00:20:25,000 --> 00:20:27,000
+the element type information at runtime.
+
+281
+00:20:28,000 --> 00:20:34,000
+That means that during the runtime it can be that objects of another type will appear in collection.
+
+282
+00:20:35,000 --> 00:20:42,000
+Let me show this example and give my comments as we go and create at least Werrimull and list is parametrized
+
+283
+00:20:42,000 --> 00:20:43,000
+by integer type.
+
+284
+00:20:43,000 --> 00:20:49,000
+Everything looks good so far, but now I created a list without specifying any generic type.
+
+285
+00:20:50,000 --> 00:20:57,000
+That means that during the runtime, the EIB that is declared in the source code of list will be erased
+
+286
+00:20:57,000 --> 00:20:57,000
+and.
+
+287
+00:20:57,000 --> 00:21:04,000
+Aware where it was used, it will be substituted with object type, for example, at Mass, it will
+
+288
+00:21:04,000 --> 00:21:05,000
+work with any object.
+
+289
+00:21:06,000 --> 00:21:13,000
+But in case I use bouncin generics, like, for example, in our damos was a generic for our method
+
+290
+00:21:13,000 --> 00:21:14,000
+during the compilation.
+
+291
+00:21:14,000 --> 00:21:21,000
+This type will be erased and substituted with the first bound class, in this case comparable.
+
+292
+00:21:21,000 --> 00:21:22,000
+Does it make sense?
+
+293
+00:21:23,000 --> 00:21:27,000
+You can see that our compiler tells us that there is a one here.
+
+294
+00:21:28,000 --> 00:21:32,000
+It is not an error, but still works of our attention in the opinion of compiler.
+
+295
+00:21:33,000 --> 00:21:36,000
+If I am a mouse over this warning, I see explanation.
+
+296
+00:21:36,000 --> 00:21:39,000
+Message that tells me is at least is a type.
+
+297
+00:21:39,000 --> 00:21:41,000
+What is a raw type.
+
+298
+00:21:41,000 --> 00:21:45,000
+A raw type is the name of a generic class or interface.
+
+299
+00:21:45,000 --> 00:21:46,000
+Without any type arguments.
+
+300
+00:21:47,000 --> 00:21:49,000
+We can still work with such types.
+
+301
+00:21:49,000 --> 00:21:52,000
+But Compiler wants to warn us that something bad may happen.
+
+302
+00:21:53,000 --> 00:21:59,000
+Now I Telx at least reference is pointing out to the same object as integers reference.
+
+303
+00:22:00,000 --> 00:22:02,000
+And I put string object in that list.
+
+304
+00:22:02,000 --> 00:22:07,000
+And again, I see he has a warning about time safety, but not an error.
+
+305
+00:22:08,000 --> 00:22:11,000
+This is very unlikely that you will be able to reproduce this mistake.
+
+306
+00:22:12,000 --> 00:22:18,000
+But I want to prove you that generics exist only to help us during the compilation time, but not during
+
+307
+00:22:18,000 --> 00:22:18,000
+the runtime.
+
+308
+00:22:19,000 --> 00:22:25,000
+And as you can see, I successfully edit my string object to the list, but when in other parts of the
+
+309
+00:22:25,000 --> 00:22:32,000
+program or somewhere else will use the reference of our parametrized type integers and when will call
+
+310
+00:22:32,000 --> 00:22:38,000
+that method, we will get object of type integer because this variable has parameterized type.
+
+311
+00:22:38,000 --> 00:22:40,000
+But what would happen during the runtime?
+
+312
+00:22:41,000 --> 00:22:42,000
+What do we think?
+
+313
+00:22:42,000 --> 00:22:44,000
+Lets me around the program and show you this.
+
+314
+00:22:45,000 --> 00:22:49,000
+And we see runtime exception, glossiest exception.
+
+315
+00:22:49,000 --> 00:22:54,000
+Java tells us that in line 15 it can't costarring object to integer.
+
+316
+00:22:55,000 --> 00:22:56,000
+I believe you got the trick.
+
+317
+00:22:57,000 --> 00:22:58,000
+That's it.
+
+318
+00:22:58,000 --> 00:23:02,000
+Now you know about even more than some senior software engineers, believe me.
+
+319
+00:23:03,000 --> 00:23:05,000
+Let's recap what we have learned today.
+
+320
+00:23:06,000 --> 00:23:08,000
+Today, we learned a lot of different things.
+
+321
+00:23:08,000 --> 00:23:13,000
+Now you know what generics are and what potential problems they help us to solve.
+
+322
+00:23:13,000 --> 00:23:20,000
+Youso how to parameterize your method in Java, we learned what Boundy generics are together.
+
+323
+00:23:20,000 --> 00:23:22,000
+We created parameterized Closs.
+
+324
+00:23:22,000 --> 00:23:24,000
+You saw what wild cards are.
+
+325
+00:23:24,000 --> 00:23:29,000
+And we practice a bit with upper bound at wild cards and lower bound with wild cards.
+
+326
+00:23:29,000 --> 00:23:33,000
+And at the end of the lesson, we talked about hyperalgesia during the runtime.
+
+327
+00:23:34,000 --> 00:23:36,000
+And now let's look at your homework.
+
+328
+00:23:36,000 --> 00:23:42,000
+I believe you already implemented our custom list from the other homework I left link to that homework
+
+329
+00:23:42,000 --> 00:23:44,000
+here just in case.
+
+330
+00:23:44,000 --> 00:23:50,000
+Also, I count on the fact that you implemented Iterator and listed the return for this container.
+
+331
+00:23:50,000 --> 00:23:53,000
+Here is a link to the homework about iterators.
+
+332
+00:23:53,000 --> 00:24:00,000
+Now, I want you to make my list Interface Parametrized, and I want you to use generics for the fourth
+
+333
+00:24:00,000 --> 00:24:06,000
+E class implementation myside that I want you to make here in your classes that implements Iterator
+
+334
+00:24:06,000 --> 00:24:08,000
+and least iterator interfaces.
+
+335
+00:24:08,000 --> 00:24:09,000
+Also parametrized.
+
+336
+00:24:10,000 --> 00:24:15,000
+This will be a great practice for you to work with generics that it home.
+
+337
+00:24:15,000 --> 00:24:17,000
+This task will be like a piece of cake for you.
+
+338
+00:24:18,000 --> 00:24:20,000
+That's all what I have for you for today.
+
+339
+00:24:21,000 --> 00:24:22,000
+Thanks a lot for your attention.
+
+340
+00:24:22,000 --> 00:24:24,000
+See you in the next lesson.
+
diff --git a/20 - Generics/001 Homework-Solution-Parameterized-custom-List-and-iterators.url b/20 - Generics/001 Homework-Solution-Parameterized-custom-List-and-iterators.url
new file mode 100644
index 0000000000000000000000000000000000000000..50792450f9f8d0264a96369cf5037743f9d4ce58
--- /dev/null
+++ b/20 - Generics/001 Homework-Solution-Parameterized-custom-List-and-iterators.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/collections/list/hw/parameterized
\ No newline at end of file
diff --git a/20 - Generics/001 Homework.url b/20 - Generics/001 Homework.url
new file mode 100644
index 0000000000000000000000000000000000000000..9acd69b9472291ef357f35e484fd96a4cd5f62b2
--- /dev/null
+++ b/20 - Generics/001 Homework.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://docs.google.com/document/d/1jLA_wn7-QqJl-elIf-lSvaMzFOojBRrblmC7I2QUBI8/edit?usp=sharing
\ No newline at end of file
diff --git a/20 - Generics/001 Source-code-examples-from-the-lesson.url b/20 - Generics/001 Source-code-examples-from-the-lesson.url
new file mode 100644
index 0000000000000000000000000000000000000000..a01dc449fbc43a80b94a210be1018619afb87193
--- /dev/null
+++ b/20 - Generics/001 Source-code-examples-from-the-lesson.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/generics
\ No newline at end of file
diff --git a/20 - Generics/003 Quiz Java Collections Framework - Check yourself.html b/20 - Generics/003 Quiz Java Collections Framework - Check yourself.html
new file mode 100644
index 0000000000000000000000000000000000000000..561a20745cd1c41920a72f64583c9c7a5f0e6820
--- /dev/null
+++ b/20 - Generics/003 Quiz Java Collections Framework - Check yourself.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Quiz Java Collections Framework - Check yourself
+
+
+
+
+
The quiz doesn’t require you to log in or submit any personal information. Your data privacy is my priority.
The Quiz covers content from the following lessons:
Java Collections Framework: Overview
Collection Interface
List, Set, Queue - High Level overview
List implementations: ArrayList, LinkedList, Vector, Stack, CopyOnWriteArrayList
LinkedList, ArrayList VS LinkedList, Big O Notation, Homework
Comparator and Comparable
Iterable, Iterator & ListIterator
Queue & Deque
Map Hierarchy
Hash tables and hash map
LinkedHashMap
SortedMap, NavigableMap & TreeMap
Set Implementations
Generics in Java
Quiz Instructions:
This quiz is designed to help you check your understanding of the content from the previous lessons. All questions are based only on material covered in the lessons you've already watched, so there’s no need to worry about unfamiliar topics.
Each question has one correct answer. Select the best answer and click "Submit" when you're ready.
After submitting, you'll see your score. For each question, you earn 1 point.
Click "View Results" to see the explanations for each correct answer. Reviewing these explanations can help reinforce your understanding.
If you score below 70%, I recommend revisiting the previous lessons. However, if the explanations make sense and you’re confident in your understanding, feel free to move on.
If any explanations are unclear, please don’t hesitate to post questions in the Q&A section—I’m here to help!
+
+
+
+
diff --git a/20 - Generics/external-links.txt b/20 - Generics/external-links.txt
new file mode 100644
index 0000000000000000000000000000000000000000..0c7ab3149e06eaee1ead4b8a0695361b6a21555a
--- /dev/null
+++ b/20 - Generics/external-links.txt
@@ -0,0 +1,9 @@
+
+001 Source-code-examples-from-the-lesson
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/generics
+
+001 Homework
+https://docs.google.com/document/d/1jLA_wn7-QqJl-elIf-lSvaMzFOojBRrblmC7I2QUBI8/edit?usp=sharing
+
+001 Homework-Solution-Parameterized-custom-List-and-iterators
+https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/jcf/collections/list/hw/parameterized
diff --git a/21 - ===== Java Collections Framework Interview Preparation =====/001 How to be prepared for the interview.html b/21 - ===== Java Collections Framework Interview Preparation =====/001 How to be prepared for the interview.html
new file mode 100644
index 0000000000000000000000000000000000000000..a4e53e3b653d778289473c1feb2aa0f278a8fa3e
--- /dev/null
+++ b/21 - ===== Java Collections Framework Interview Preparation =====/001 How to be prepared for the interview.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ How to be prepared for the interview
+
+
+
+
+
+
+
How to be prepared for the interview
+
I gathered for you the most popular questions during the Java Interview in JAVA COLLECTIONS FRAMEWORK topic. How you can be prepared for the interview?
Just read the question first. Try to answer the question by yourself. After that, compare your answer with the answer provided. Remember, that this is just a reference to the answer. Because sometimes the topic is big, and you can go really deep with your answer. In case you feel like you don’t understand what the answer is about - feel free to get back in the course and review the relevant section, and relevant lesson one more time.
Also, you are always welcome to ask your questions and I will be happy to answer. I’m sure that these questions will help you to be prepared for the JAVA COLLECTIONS FRAMEWORK interview. You need to be ready to answer perfectly on these questions.
In case there are questions that you don't know the answers to, please, feel free to check my full and the most complete course "Java From Zero to First Job".
+
+
+
+
diff --git a/21 - ===== Java Collections Framework Interview Preparation =====/002 Part 1 Java Collections Framework Interview - Questions and Answers.html b/21 - ===== Java Collections Framework Interview Preparation =====/002 Part 1 Java Collections Framework Interview - Questions and Answers.html
new file mode 100644
index 0000000000000000000000000000000000000000..d69858a7f11818d86533aef81df21fe7f1c335c8
--- /dev/null
+++ b/21 - ===== Java Collections Framework Interview Preparation =====/002 Part 1 Java Collections Framework Interview - Questions and Answers.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Part 1 Java Collections Framework Interview - Questions and Answers
+
+
+
+
+
+
+
Part 1 Java Collections Framework Interview - Questions and Answers
+
WHAT IS A COLLECTION?
Collections are containers that support various ways of storing and organizing objects in order to be able to access them efficiently. They are implementations of abstract data structures that support three basic operations:
adding a new element to the collection;
removing an element from the collection;
changing an element in the collection.
NAME THE MAIN INTERFACES OF COLLECTIONS AND THEIR IMPLEMENTATIONS.
Three interfaces extend Collection: List, Set, Queue.
List - stores ordered elements (may be the same); Has such implementations as LinkedList, ArrayList, Vector, etc.
Vector is synchronized, and therefore in one thread, it works slower than other implementations.
ArrayList has advantage in navigating through the collection.
LinkedList has advantage is in inserting and deleting elements in a collection.
Set - collections that do not contain duplicate elements. Main implementations: HashSet, TreeSet, LinkedHashSet
TreeSet - arranges elements by their values;
HashSet - Orders the elements by their hash keys, although at first glance it may seem that the elements are stored in random order.
LinkedHashSet - stores elements in the order they were added
Queue is an interface for implementing a queue in Java. Main implementations: LinkedList, PriorityQueue.
Queues work on the principle of FIFO - first in first out.
Map is an interface for implementing a so-called map, where elements are stored with their keys. Main implementations: HashTable, HashMap, TreeMap, LinkedHashMap
HashTable - synchronized, deprecated.
HashMap - the order of the elements is calculated by the hash key;
TreeMap - elements are stored in sorted order
LinkedHashMap - elements are stored in insertion order
Keys in Mar cannot be the same!
You can synchronize unsynchronized collections and maps using the Collections.synchronizedMap(myMap) / synchronizedList(myList) class.
HOW IS ARRAYLIST DIFFERENT FROM LINKEDLIST? IN WHAT CASES IS IT BETTER TO USE THE FIRST AND IN WHICH CASES THE SECOND?
The difference lies in the way the data is stored. ArrayList stores data as an array, while LinkedList stores as a list (bidirectional).
Reading and retrieving data from the ArrayList is generally faster because we have access to the elements by index.
With a large number of add and remove operations, LinkedList should be a better choice, because these operations do not have to move parts of the array.
HOW IS HASHMAP DIFFERENT FROM HASHTABLE?
The HashMap class is very similar in functionality to the Hashtable. The main difference is that the methods of the Hashtable class are synchronized, while the HashMap is not. In addition, the HashMap class, unlike the Hashtable, allows the use of null as keys and values.
The presence of synchronization in the Hashtable reduces the performance of the code that uses this class. Therefore, the JCF (Java Collections Framework, introduced in Java 2) classes, including HashMap, are not synchronized. If you still need synchronization, you can use the methods of the Collections class: Collections.synchronizedMap(map), Collections.synchronizedList(list), or Collections.synchronizedSet(set) to wrap your objects into the synchronized wrapper.
These methods return a synchronized decorator for the passed collection.
Starting with Java 6, JCF has been extended with special collections that support multi-threaded access, such as CopyOnWriteArrayList and ConcurrentHashMap.
HOW IS ARRAYLIST DIFFERENT FROM VECTOR?
The methods of the Vector class are synchronized while the ArrayList is not.
WHY MAP IS NOT A COLLECTION WHILE LIST AND SET ARE A COLLECTION?
A collection (List and Set) is a collection of some elements (usually instances of the same class). Map is a collection of key-value pairs.
Accordingly, some methods of the Collection interface cannot be used in Map. For example, the remove(Object o) method in the Collection interface is designed to remove an element, while the same remove(Object key) method in the Map interface removes an element by a given key.
So, the way how data is structured in Map and Collection is different. That’s why we can’t say that Map is a collection.
GIVE A DEFINITION TO THE TERM "ITERATOR".
An iterator is an object that allows you to iterate over the elements of a collection. The Iterator declares interface that is used to iterate over different types of data structures. For example, foreach is implemented using an iterator. One of the key methods of the Collection interface is the Iterator<E> iterator() method. It returns an iterator - that is, an object that implements the Iterator interface. Each concrete implementation knows how to iterate over the specific data structure.
HOW TO LOOK AT ALL THE KEYS OF A MAP, CONSIDERING THAT MAP IS NOT ITERABLE?
Use the keySet() method, which returns a set (Set<K>) of keys.
HOW TO LOOK AT ALL THE MAP VALUES, CONSIDERING THAT MAP IS NOT ITERABLE?
Use the values() method, which returns a collection (Collection<V>) of values.
HOW TO LOOK AT ALL KEY-VALUE PAIRS IN A MAP, CONSIDERING THAT MAP IS NOT ITERABLE?
Use the entrySet() method, which returns a set (Set<Map.Entry<K, V>) of key-value pairs.
+
+
+
+
diff --git a/21 - ===== Java Collections Framework Interview Preparation =====/003 Part 2 Java Collections Framework Interview - Questions and Answers.html b/21 - ===== Java Collections Framework Interview Preparation =====/003 Part 2 Java Collections Framework Interview - Questions and Answers.html
new file mode 100644
index 0000000000000000000000000000000000000000..d08fe72bac0f47cef5883e7aa520b32917049ed8
--- /dev/null
+++ b/21 - ===== Java Collections Framework Interview Preparation =====/003 Part 2 Java Collections Framework Interview - Questions and Answers.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Part 2 Java Collections Framework Interview - Questions and Answers
+
+
+
+
+
+
+
Part 2 Java Collections Framework Interview - Questions and Answers
+
COMPARE ENUMERATION AND ITERATOR.
Both interfaces are designed to traverse collections. The Iterator interface was introduced somewhat later in the Java Collections Framework and is preferred.
The main differences between Iterator and Enumeration are:
the presence of the remove() method to remove an element from the collection during traversal;
different method names to improve code readability.
HOW ARE ITERABLE AND ITERATOR RELATED TO EACH OTHER?
The Iterable interface has only one method, iterator() , which returns an iterator of the collection to traverse it.
HOW MANY MEMORY ITEMS ARE ALLOCATED WHEN ARRAYLIST.ADD() is called?
If there is enough space in the array to accommodate the new element, no additional memory space is allocated. Otherwise, a new array is created.
A new array is created, the size of which is calculated as multiplying the old size by 1.5 (this is true starting from JDK 1.7, in earlier versions the calculations are different).
COMPARE ITERATOR AND LISTITERATOR.
ListIterator extends the Iterator interface to allow the client to traverse the collection in both directions, modify the collection, and get the iterator's current position.
It is important to remember that the ListIterator does not point to a specific element, but its current position is between the elements returned by the previous() and next() methods. Thus, the modification of the collection is carried out for the last element returned by the previous() and next() methods.
WHAT WILL HAPPEN IF I CALL ITERATOR.NEXT() WITHOUT "ASKING" ITERATOR.HASNEXT()?
If the iterator points to the last element of the collection, then a NoSuchElementException will be thrown, otherwise the next element will be returned.
IF I HAVE A COLLECTION AND A GENERATED ITERATOR, WILL THE COLLECTION CHANGE IF I CALL ITERATOR.REMOVE()?
The iterator.remove() method can only be called after the iterator.next() method has been called at least once, otherwise, an IllegalStateException() will be thrown.
If iterator.next() has been called before, then iterator.remove() will remove the element pointed to by the iterator.
IF I HAVE A COLLECTION AND A GENERATED ITERATOR, WILL THE ITERATOR CHANGE IF I CALL COLLECTION.REMOVE(..)?
The iterator will not change, but the next time its methods are called, a ConcurrentModificationException will be thrown telling you that somebody adjust structure of the collection.
There are fail-fast and fail-safe iterators. Fail-safe iterator will not throw ConcurrentModificationException.
IS LINKEDLIST A SINGLE-LINKED, DOUBLE-LINKED, OR FOUR-LINKED LIST?
Doubly Linked List: Each element of a LinkedList stores a link to the previous and next elements.
WHAT IS THE WORST TIME OF THE CONTAIN() METHOD FOR AN ELEMENT THAT IS IN A LINKEDLIST (O(1), O(LOG(N)), O(N), O(N*LOG(N)), O(N*N) )?
O(N). The search time for an element is linearly proportional to the number of elements in the list.
WHAT IS THE WORST TIME OF THE CONTAIN() METHOD FOR AN ELEMENT THAT IS IN ARRAYLIST (O(1), O(LOG(N)), O(N), O(N*LOG(N)), O(N*N) )?
O(N). The search time for an element is linearly proportional to the number of elements in the list.
WHAT IS THE WORST ADD() TIME FOR LINKEDLIST (O(1), O(LOG(N)), O(N), O(N*LOG(N)), O(N*N))?
O(N). It is worth noting here that adding an element to the end of the list using the add(value), addLast(value) method and adding to the beginning of the list using addFirst(value) takes O(1) time.
O(N) - will be when adding an element to a sorted list, as well as when adding an element using the add(index, value) method.
WHAT IS THE WORST ADD() TIME FOR ARRAYLIST (O(1), O(LOG(N)), O(N), O(N*LOG(N)), O(N*N))?
O(N). Inserting an element at the end of the list takes O(1) time, but if the array capacity is insufficient, then a new array with an increased size is created and all elements from the old array are copied to the new one.
HOW MANY MEMORY ITEMS ARE ALLOCATED WHEN LINKEDLIST.ADD() is called?
One new instance of the nested Node class is created.
ESTIMATE THE MEMORY TO STORAGE ONE BYTE PRIMITIVE IN LINKEDLIST?
Each LinkedList element stores a link to the previous element, the next element, and a link to the data. For x32 systems, each link is 32 bits (4 bytes). The Node itself is approximately 8 bytes. The size of each object in Java is a multiple of 8, so we get 24 bytes. A primitive of type byte occupies 1 byte of memory, but primitives are packed in the list, respectively, we get another 8 bytes. Thus, in the x32 JVM, about 32 bytes are allocated to store a single byte value in a LinkedList.
For a 64-bit JVM, each link is 64 bits (8 bytes). The calculations are similar.
ESTIMATE THE AMOUNT OF MEMORY TO STORAGE ONE PRIMITIVE OF TYPE BYTE IN ARRAYLIST?
ArrayList is array based. Each element of the array stores a primitive data type - byte, the size of which is 1 byte.
I ADD AN ELEMENT IN THE MIDDLE OF LIST: LIST.ADD(LIST.SIZE()/2, NEWELEM). FOR WHOM IS THIS OPERATION SLOWER - FOR ARRAYLIST OR FOR LINKEDLIST?
For ArrayList:
checking an array for capacity. If there is not enough capacity, then increase the size of the array and copy all the elements into a new array ( O(N) );
copying all elements to the right of the insertion position one position to the right ( O(N/2));
element insertion ( O(1) ).
For Linked List:
find insertion position ( O(N/2) );
element insertion ( O(1) ).
In the worst case, inserting in the middle of the list is more efficient for LinkedList. In the rest - most likely for ArrayList, since elements are copied using the System.arraycopy() system method.
HOW TO LOOK AT LINKEDLIST ELEMENTS IN REVERSE ORDER WITHOUT USING SLOW GET(INDEX)?
Use a reverse iterator. To do this, LinkedList has a descendingIterator() method.
+
+
+
+
diff --git a/21 - ===== Java Collections Framework Interview Preparation =====/004 Part 3 Java Collections Framework Interview - Questions and Answers.html b/21 - ===== Java Collections Framework Interview Preparation =====/004 Part 3 Java Collections Framework Interview - Questions and Answers.html
new file mode 100644
index 0000000000000000000000000000000000000000..1e972f0bd2e2b6115f9fd62effe4c9ee17e09986
--- /dev/null
+++ b/21 - ===== Java Collections Framework Interview Preparation =====/004 Part 3 Java Collections Framework Interview - Questions and Answers.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Part 3 Java Collections Framework Interview - Questions and Answers
+
+
+
+
+
+
+
Part 3 Java Collections Framework Interview - Questions and Answers
+
CAN DIFFERENT OBJECTS IN MEMORY (REF0 != REF1) HAVE REF0.HASHCODE() == REF1.HASHCODE()?
Yes they can. The hashCode() method does not guarantee the uniqueness of the returned value.
CAN DIFFERENT OBJECTS IN MEMORY (REF0 != REF1) HAVE REF0.EQUALS(REF1) == TRUE?
Yes they can. To do this, the equals() method must be overridden in the class of these objects.
If the Object.equals() method is used, then for two references x and y, the method will return true if and only if both references point to the same object (i.e. x == y returns true).
IF THE CLASS POINT{INT X, Y;} IS "CORRECT" TO IMPLEMENT THE EQUALS METHOD (RETURN REF0.X == REF1.X && REF0.Y == REF1.Y), BUT MAKE THE HASH CODE IN THE FORM OF INT HASHCODE() { RETURN X;}, THEN WILL SUCH POINTS CORRECTLY BE PLACED AND REMOVED FROM HASHSET?
HashSet uses HashMap to store elements (the object itself is used as a key). When an element is added to the HashMap, the hashcode and position in the array where the new element will be inserted is calculated. All instances of the Point class have the same hashcode, causing the hash table to degenerate into a list. When a collision occurs, a check is made for the presence of such an element in the current list.
If the element is found, its value is overwritten. In our case, for different objects, the equals() method will return false. Accordingly, a new element will be added to the HashSet.
Retrieving the element will also succeed.
But the performance of such code will be poor and the benefits of hash tables will not be used.
CAN DIFFERENT REFERENCES TO THE SAME OBJECT IN MEMORY (REF0 == REF1) HAVE REF0.EQUALS(REF1) == FALSE?
No, he can not. The equals() method must guarantee the property of reflexivity: for any non-null x references, the x.equals(x) method must return true.
THERE IS A CLASS POINT{INT X, Y;}. WHY IS A HASHCODE OF THE FORM 31 * X + Y PREFERRED THAN X + Y?
The multiplier makes the hash value dependent on the order in which the fields are processed, and this gives a much better hash function.
EQUALS() GENERATES AN EQUIVALENCE RELATION. WHAT PROPERTIES DOES THIS RELATION HAVE: COMMUTATIVITY, SYMMETRY, REFLEXIVITY, DISTRIBUTION, ASSOCIATION, TRANSITIVITY?
The equals() method should provide:
symmetry (for any non-null x and y references, the x.equals(y) method must return true if and only if y.equals(x) returns true);
reflexivity (for any non-null references x, the x.equals(x) method must return true.);
transitivity (for any non-null references x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) must also return true).
There are also two more properties: persistence and null inequality.
EQUALS MUST CHECK THAT THE (EQUALS(OBJECT THAT)) IS THE SAME TYPE OF THE OBJECT ITSELF. WHAT IS THE DIFFERENCE BETWEEN THIS.GETCLASS() == THAT.GETCLASS() AND THAT INSTANCEOF MYCLASS?
The instanceof operator compares an object and the specified type. It can be used to test whether a given object is an instance of some class, or an instance of its child class, or an instance of a class that implements a specified interface.
getClass() = ... checks two types for identity.
To correctly implement the contract of the equals() method, you must use exact comparison with getClass().
WILL HASHMAP WORK IF ALL KEYS RETURN INT HASHCODE() {RETURN 42;}?
Yes, it will. But then the hash table degenerates into a linked list and loses its advantages.
WHY DID HASHMAP BE ADDED IF HASHTABLE ALREADY HAS BEEN ADDED?
The Hashtable class was introduced in JDK 1.0 and is not part of the Java Collection Framework. The methods of the Hashtable class are synchronized, which provides thread safety, but this leads to a decrease in performance, which is why the HashMap class was introduced, the methods of which are not synchronized.
In addition, the HashMap class has some other differences: for example, it allows you to store one null key and many null values.
IN THEORY, THERE ARE TWO BASIC HASH TABLE IMPLEMENTATIONS: BASED ON OPEN ADDRESSING AND BASED ON THE CHAINING METHOD. HOW IS HASHMAP IMPLEMENTED? WHY DID TEHY IMPLEMENTED IT IN SUCH WAY (IN YOUR OPINION)? WHAT ARE THE PROS AND CONS OF EACH APPROACH?
The HashMap class is implemented using the chaining method, i.e. Each array cell has its own linked list, and if a collision occurs, a new element is added to this list.
For the chain method, the fill factor can be greater than 1; with an increase in the number of elements, the performance decreases linearly. Such tables are convenient to use if the number of stored elements is not known in advance, or there can be quite a lot of them, which leads to large values of the fill factor.
Among the methods of open implementation, there are:
linear probing;
quadratic probing;
double hashing.
The main disadvantages of structures with the open addressing method:
The number of elements in the table cannot exceed the size of the array. As the number of elements in the table increases and the load factor increases, the performance of the structure drops sharply, so rehashing is necessary.
It is difficult to organize the removal of an element.
Also, the first two methods of open addressing lead to the problem of primary and secondary grouping.
The main advantage of an open addressable hash table is that there is no overhead for creating and storing list objects. It is also easier to organize object serialization/deserialization.
HOW MANY NEW OBJECTS ARE CREATED WHEN YOU ADD A NEW ELEMENT TO A HASHMAP?
One new object of the static nested Entry<K,V> class.
HOW DOES A HASHMAP WORK WHEN YOU ATTEMPT TO SAVE TWO ELEMENTS IN IT BY KEYS WITH THE SAME HASHCODE BUT FOR WHICH EQUALS == FALSE?
The hashCode value is used to calculate the index of the array cell to which the element will be added. Before adding, a check is made for the presence of already existing elements in this cell. If there are no elements, then it is added. If a collision occurs, the list is iteratively traversed looking for an element with the same key and hash code.
If such an element is found, its value is overwritten and the old one is returned. Since the condition says that the added keys are different, the second element will be added to the beginning of the list.
HASHMAP CAN BE TURNED INTO A LIST EVEN FOR KEYS WITH DIFFERENT HASHCODE. HOW IS IT POSSIBLE?
This is possible if the method that determines the array cell number by hashCode will return the same value.
WHAT IS THE WORST TIME OF A GET(KEY) METHOD FOR A KEY THAT IS NOT IN THE TABLE (O(1), O(LOG(N)), O(N), O(N*LOG(N)), O(N*N ))?
O(N). The worst case is searching for a key in a table that is turned into a list, the iteration of the keys of which takes time linearly proportional to the number of stored elements.
EXPLAIN THE MEANING OF PARAMETERS IN THE HASHMAP(INT INITIALCAPACITY, FLOAT LOADFACTOR) CONSTRUCTOR.
int initialCapacity - the initial size of the HashMap (the number of buckets in the hash table at the time of its creation), the default value is 16.
float loadFactor - HashMap fill factor. It is equal to the ratio of the number of stored elements in the table to its size. loadFactor - is a measure of filling the table with elements, when the number of values stored by the table is exceeded, automatic rehashing occurs. The default value of 0.75 is a good compromise between access time and amount of stored data.
+
+
+
+
diff --git a/21 - ===== Java Collections Framework Interview Preparation =====/005 Part 4 Java Collections Framework Interview - Questions and Answers.html b/21 - ===== Java Collections Framework Interview Preparation =====/005 Part 4 Java Collections Framework Interview - Questions and Answers.html
new file mode 100644
index 0000000000000000000000000000000000000000..39b21b8eea97c1aad8263dd4f6eba845bdbf1b17
--- /dev/null
+++ b/21 - ===== Java Collections Framework Interview Preparation =====/005 Part 4 Java Collections Framework Interview - Questions and Answers.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Part 4 Java Collections Framework Interview - Questions and Answers
+
+
+
+
+
+
+
Part 4 Java Collections Framework Interview - Questions and Answers
+
WHAT IS THE DIFFERENCE BETWEEN HASHMAP AND IDENTITYHASHMAP? WHAT IS IDENTITYHASHMAP FOR? HOW CAN IT BE USEFUL TO IMPLEMENT SERIALIZATION OR CLONE?
IdentityHashMap is a data structure that implements the Map interface but uses reference comparison instead of the equals() method when comparing keys (values). In other words, in IdentityHashMap, two keys k1 and k2 will be considered equal if the condition k1 == k2 is satisfied.
IdentityHashMap does not use the hashCode() method, which uses the System.identityHashCode(Object) method instead.
Another difference (as a consequence) is the better performance of IdentityHashMap compared to HashMap if the latter stores objects with costly equals() and hashCode() methods.
One of the main requirements for using HashMap is immutability of the key, however, this requirement does not apply to IdentityHashMap, which does not use the equals() and hashCode() methods.
According to the documentation, such a data structure can be used to implement serialization/cloning. To perform such algorithms, the program needs to maintain a table with all references to objects that have already been processed. Such a table should not treat unique objects as equal, even if the equals() method returns true.
WHAT IS THE DIFFERENCE BETWEEN HASHMAP AND WEAKHASHMAP? WHAT IS WEAKHASHMAP FOR?
Before considering WeakHashMap , let me briefly remind you what a WeakReference is.
There are 4 types of references in Java: strong (strong reference), soft (SoftReference), weak (WeakReference) and phantom (PhantomReference). The specifics of each link type are related to the way of how the Garbage Collector works. If the object can only be reached by the WeakReference chain (that is, it is not referenced by strong and soft references), then the object will be marked for deletion.
WeakHashMap is a data structure that implements the Map interface and is based on using a WeakReference to store keys. Thus, the key/value pair will be removed from the WeakHashMap if the key object is no longer strongly referenced.
The following situation can be reviewed as an example of using such a data structure: let’s imagine that there are objects that need to be expanded with additional information, while changing the class of these objects is undesirable or impossible. In this case, we add each object to WeakHashMap as a key, and as a value - the desired information. Thus, as long as the object has a strong reference (or soft one), you can check the hash table and extract information. Once the object is removed, the WeakReference for that key will be placed in the ReferenceQueue and then the corresponding entry for that weak reference will be removed from the WeakHashMap.
COMPARE JAVA.UTIL.QUEUE AND JAVA.UTIL.DEQUE INTERFACES.
According to the documentation Deque ("Dec", Double Ended Queue) is a linear collection that supports the insertion / extraction of elements from both ends. In addition, implementations of the Deque interface can be built according to the FIFO or LIFO principle.
Queue is usually (but not necessarily) built according to the FIFO (First-In-First-Out) principle - accordingly, an element is extracted from the beginning of the queue, an element is inserted - to the end of the queue. This principle is violated, for example, by the priority queue (PriorityQueue), which uses the passed comparator when inserting a new element, or the arrangement of elements is carried out according to natural ordering.
Deque extends Queue.
The implementations of both Deque and Queue generally do not override the equals() and hashCode() methods based on the comparison of the stored elements. Instead, inherited methods of the Object class based on reference comparison are used.
WHY DOES LINKEDLIST IMPLEMENT BOTH LIST AND DEQUE?
LinkedList allows you to add elements to the beginning and end of the list in constant time, which is well suited for implementing the Deque interface (unlike, for example, ArrayList).
WHAT IS THE DIFFERENCE BETWEEN THE JAVA.UTIL.ARRAYS AND JAVA.LANG.REFLECT.ARRAY CLASSES?
java.util.Arrays is a class containing static methods for working with arrays, such as searching through an array and sorting it.
java.lang.reflect.Array - a class for working with arrays when using reflection. Reflection is a mechanism that allows you to examine data about the program during its execution.
WHAT IS THE DIFFERENCE BETWEEN THE JAVA.UTIL.COLLECTION AND JAVA.UTIL.COLLECTIONS CLASSES?
The java.util.Collections class contains only static methods for working with collections. They include methods that implement polymorphic algorithms (those algorithms that can be used with different types of data structures), "wrappers" that return a new collection with the specified data structure encapsulated, and some other methods.
java.util.Collection is the root interface of the Java Collections Framework. This interface is mainly used where a high level of abstraction is required, such as in the java.util.Collections class.
WHAT IS “FAIL-FAST BEHAVIOR”?
Fail-fast behavior means that when an error or condition occurs that could lead to an error, the system immediately stops further work and notifies about it.
In the Java Collections API, iterators can either use fail-fast or fail-safe behavior, or be weakly consistent. An iterator with fail-fast behavior will throw a ConcurrentModificationException if the collection has been modified since it was created, i.e. an element is added or removed (without using the iterator's remove() method). The implementation of this behavior is carried out by counting the number of modifications of the collection (modification count):
when changing the collection (deleting/adding an element), the counter is incremented;
when creating an iterator, the current value of the counter is passed to it;
each time the iterator is accessed, the stored value of the counter is compared with the current value, and if they do not match, an exception is thrown.
Using the fail-fast approach avoids non-deterministic program behavior over time. It's also worth noting that fail-fast behavior cannot be absolutely guaranteed.
IS THERE A SPECIAL CLASS JAVA.UTIL.ENUMSET FOR ENUMS? WHY? WHY DID THE AUTHORS ARE NOT SATISFIED WITH HASHSET OR TREESET?
EnumSet is a variation of the implementation of the Set interface for use with enums (Enum). EnumSet uses an array of bits to store values (bit vector), which allows for high compactness and efficiency. The data structure stores objects of only one Enum type, which is specified when an EnumSet instance is created. All basic operations are performed in constant time (O(1)) and are generally somewhat faster (though not guaranteed) than their counterparts in the HashSet implementation. Bulk operations (like containsAll() and retainAll()) are very fast if their argument is an instance of type Enum.
In addition, the EnumSet class provides many static initialization methods for easy and convenient instantiation.
Iteration over the EnumSet is carried out according to the order in which the enumeration elements are declared.
+
+
+
+
diff --git a/21 - ===== Java Collections Framework Interview Preparation =====/006 Part 5 Java Collections Framework Interview - Questions and Answers.html b/21 - ===== Java Collections Framework Interview Preparation =====/006 Part 5 Java Collections Framework Interview - Questions and Answers.html
new file mode 100644
index 0000000000000000000000000000000000000000..5c324019b60594ec5e15ae56ffff9f97457583c5
--- /dev/null
+++ b/21 - ===== Java Collections Framework Interview Preparation =====/006 Part 5 Java Collections Framework Interview - Questions and Answers.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Part 5 Java Collections Framework Interview - Questions and Answers
+
+
+
+
+
+
+
Part 5 Java Collections Framework Interview - Questions and Answers
+
WHICH COLLECTION IMPLEMENTS THE FIFO APPROACH?
FIFO - First-In-First-Out (first in, first out). Such a data structure as a queue (java.util.Queue) is usually built according to this principle.
JAVA.UTIL.STACK - CONSIDERED "DEPRECATED". WHAT IS IT RECOMMENDED TO REPLACE IT? WHY?
It is recommended to use the Deque ("Dec", Double Ended Queue) interface and its implementations.
A stack is a data structure based on the LIFO (Last-In-First-Out, or FILO) principle. Each new value is added to the "top" of the stack, and the last added element (from the "top" of the stack) is retrieved. When an element is retrieved, it is removed from the data structure.
The Stack class appeared in JDK 1.0 and extends the Vector class, inheriting its functionality, which somewhat violates the concept of a stack (for example, the Vector class provides the ability to access any element by index). Also, the use of Deque allows you to follow the principle of programming at the level of interfaces, rather than specific implementations, which facilitates further support of the developed class and increases its flexibility, allowing you to change the deque implementation to the desired one if necessary.
LINKEDHASHMAP - WHAT IS ANOTHER "BEAST"? WHAT'S IN IT FROM LINKEDLIST AND WHAT'S FROM HASHMAP?
The implementation of LinkedHashMap differs from HashMap by supporting a doubly linked list that determines the order of iteration over the elements of the data structure. By default, the elements of the list are ordered according to their insertion order in the LinkedHashMap (insertion-order). However, the iteration order can be changed by setting the accessOrder constructor parameter to true. In this case, access is carried out in the order of the last access to the element (access-order). This means that when the get() or put() methods are called, the element being accessed is moved to the end of the list.
When adding an element that is already present in the LinkedHashMap (i.e. with the same key), the iteration order over the elements does not change.
CAN WE MAKE A SIMPLE CACHE WITH “INVALIDATION POLICY” ON LINKEDHASHMAP. DO YOU KNOW HOW?
You need to use the LRU algorithm (Least Recently Used algorithm) and LinkedHashMap with access-order. In this case, when an element is accessed, it will move to the end of the list, and the least used elements will be gradually grouped at the beginning of the list.
To do this, the standard implementation of LinkedHashMap (source) has a method
removeEldestEntries() which returns true if the current object is a LinkedHashMap
should remove the least used element from the collection. The method is called when using the put() and putAll() methods.
To implement a simple example of a cache with clearing old values when a specified threshold is exceeded we need to declare a new class and extend it from the LinkedHashMap. After that, we need to override removeEldestEntry() method in order to return true when size reaches max allowed entries. Max allowed entries can be configured during the cache instantiation.
It is worth noting that LinkedHashMap does not allow to fully implement the LRU algorithm, since when inserting an element already in the collection, the iteration order does not change.
LINKEDHASHSET - WHAT IS ANOTHER "BEAST"? WHAT'S IN IT FROM LINKEDLIST AND WHAT'S FROM HASHSET?
The implementation of LinkedHashSet differs from HashSet by supporting a doubly linked list that determines the order of iteration over the elements of the data structure. The elements of the list are ordered according to their insertion order in the LinkedHashSet (insertion-order).
When adding an element that is already present in the LinkedHashSet (i.e. with the same key), the iteration order over the elements does not change.
WHAT DOES PRIORITYQUEUE DO?
PriorityQueue is a data structure that arranges elements in natural order, or using a Comparator passed to the constructor.
We can use it to store objects according to their priority: for example, sorting doctor's patients - emergency patients are moved to the front of the queue, less urgent patients - closer to the end of the queue.
WHAT IS JAVA.UTIL.COMPARATOR DIFFERENT FROM JAVA.LANG.COMPARABLE?
Interface Comparable sets a comparison property to the object that implements it. That is, it makes the object comparable (according to the developer's rules).
Interface Comparator allows you to create objects that will control the comparison process (for example, when sorting).
+
+
+
+
diff --git a/22 - Functional Programming in Java (including lambda functions & method references)/001 Documentation-of-java.util.function-package.url b/22 - Functional Programming in Java (including lambda functions & method references)/001 Documentation-of-java.util.function-package.url
new file mode 100644
index 0000000000000000000000000000000000000000..3a32143e076a084436e06ddbd010ec617102331a
--- /dev/null
+++ b/22 - Functional Programming in Java (including lambda functions & method references)/001 Documentation-of-java.util.function-package.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/function/package-summary.html
\ No newline at end of file
diff --git a/22 - Functional Programming in Java (including lambda functions & method references)/001 Functional Programming in Java Overview_en.srt b/22 - Functional Programming in Java (including lambda functions & method references)/001 Functional Programming in Java Overview_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..d2293b4d0e9873df262fde31a1d98ed1164423e0
--- /dev/null
+++ b/22 - Functional Programming in Java (including lambda functions & method references)/001 Functional Programming in Java Overview_en.srt
@@ -0,0 +1,780 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello.
+
+2
+00:00:06,000 --> 00:00:11,000
+The students that they were going to start, important and very interesting topic, I'm talking about
+
+3
+00:00:11,000 --> 00:00:16,000
+functional programming and this lesson, we are going to understand what functional programming is.
+
+4
+00:00:16,000 --> 00:00:21,000
+Well, understand how it is different from object oriented approach after this lesson.
+
+5
+00:00:21,000 --> 00:00:24,000
+And you know what the difference between method and function is?
+
+6
+00:00:24,000 --> 00:00:30,000
+And only after we will understand the basics of functional programming, we will talk about functional
+
+7
+00:00:30,000 --> 00:00:31,000
+programming in Java.
+
+8
+00:00:31,000 --> 00:00:37,000
+We are going to review Jaberi till function package and understand its structure will not have enough
+
+9
+00:00:37,000 --> 00:00:40,000
+time to learn all types from that package today.
+
+10
+00:00:40,000 --> 00:00:44,000
+But you will understand the structure of the package and what it exists for.
+
+11
+00:00:44,000 --> 00:00:49,000
+The things that we are going to learn in this class and will help us to boost our learning of functional
+
+12
+00:00:49,000 --> 00:00:50,000
+programming in Java.
+
+13
+00:00:51,000 --> 00:00:55,000
+Let's start and let's understand first what is a functional programming.
+
+14
+00:00:56,000 --> 00:01:02,000
+Functional programming is a programming paradigm where programs are constructed by applying and composing
+
+15
+00:01:02,000 --> 00:01:04,000
+functions in functional programming.
+
+16
+00:01:04,000 --> 00:01:10,000
+Functions are treated like the main core element of each program, and they can be assigned to variables
+
+17
+00:01:10,000 --> 00:01:14,000
+and can be returned from the Massett, the same as other data type.
+
+18
+00:01:14,000 --> 00:01:16,000
+To understand functional programming better.
+
+19
+00:01:16,000 --> 00:01:20,000
+Let's discuss concepts that are specific to functional programming.
+
+20
+00:01:20,000 --> 00:01:23,000
+The first concept is a concept of first class function.
+
+21
+00:01:24,000 --> 00:01:30,000
+Usually this term is applied to programming language that can treat functions as first class citizens.
+
+22
+00:01:30,000 --> 00:01:36,000
+That means language supports and functions as an argument to other functions, return and functions
+
+23
+00:01:36,000 --> 00:01:40,000
+from other functions as value and assign functions to variables.
+
+24
+00:01:41,000 --> 00:01:45,000
+The next concept that is related to functional programming is pure functions.
+
+25
+00:01:46,000 --> 00:01:48,000
+These are functions that have following properties.
+
+26
+00:01:49,000 --> 00:01:53,000
+The first one, its evaluation has no side effects.
+
+27
+00:01:53,000 --> 00:01:59,000
+That means the function doesn't modify some state variable values outside the function.
+
+28
+00:02:00,000 --> 00:02:05,000
+And the second property is that original value of pure function is the same for the same arguments.
+
+29
+00:02:05,000 --> 00:02:09,000
+That means, given the same input, will always return the same output.
+
+30
+00:02:10,000 --> 00:02:11,000
+This can be used for code.
+
+31
+00:02:11,000 --> 00:02:15,000
+Optimization, for example, is a result of pure function is not used.
+
+32
+00:02:16,000 --> 00:02:18,000
+It can be removed without affecting other expressions.
+
+33
+00:02:19,000 --> 00:02:25,000
+That also means that pure functions are completely independent from outside state and can be used in
+
+34
+00:02:25,000 --> 00:02:27,000
+parallel or asynchronously.
+
+35
+00:02:28,000 --> 00:02:34,000
+It is easy to move them around in your code, making your programs more flexible and adaptable to future
+
+36
+00:02:34,000 --> 00:02:34,000
+changes.
+
+37
+00:02:35,000 --> 00:02:40,000
+The third concept of functional programming is a recursion and functional programming.
+
+38
+00:02:40,000 --> 00:02:42,000
+There is no for and while loops.
+
+39
+00:02:42,000 --> 00:02:48,000
+But what is used instead calling the same function from another function is called recursion and can
+
+40
+00:02:48,000 --> 00:02:50,000
+be used for iteration.
+
+41
+00:02:50,000 --> 00:02:55,000
+The fourth concept is that functional programs do not have assignment statements.
+
+42
+00:02:56,000 --> 00:03:01,000
+That means the value of a variable is immutable and doesn't change state once it was defined.
+
+43
+00:03:02,000 --> 00:03:04,000
+This is called referential transparency.
+
+44
+00:03:05,000 --> 00:03:08,000
+The next concept in our list is lazy evaluation.
+
+45
+00:03:08,000 --> 00:03:09,000
+What does that mean?
+
+46
+00:03:10,000 --> 00:03:16,000
+Each programming language has strategies to evaluate code blocks and when we call a function, programming
+
+47
+00:03:16,000 --> 00:03:19,000
+language should define the strategy to produce arguments.
+
+48
+00:03:19,000 --> 00:03:22,000
+There are two possible main evaluation methods.
+
+49
+00:03:22,000 --> 00:03:29,000
+They are strict, sometimes called EGA evaluation and non strict so-called lazy evaluation.
+
+50
+00:03:29,000 --> 00:03:32,000
+What is the difference in strict evaluation?
+
+51
+00:03:32,000 --> 00:03:38,000
+Arguments are processed immediately when we invoke a function and give a list of arguments.
+
+52
+00:03:38,000 --> 00:03:45,000
+Each argument is processed and calculated before colon's a function, whereas in lazy evaluation expression,
+
+53
+00:03:45,000 --> 00:03:47,000
+evaluation is deferred.
+
+54
+00:03:47,000 --> 00:03:53,000
+Evaluation is delayed as long as possible until it is necessary to evaluate the expression to produce
+
+55
+00:03:53,000 --> 00:03:53,000
+a result.
+
+56
+00:03:54,000 --> 00:03:58,000
+That's only five key concepts in different literature.
+
+57
+00:03:58,000 --> 00:04:03,000
+You can find the different list of concepts or just different names for the same concepts that I have
+
+58
+00:04:03,000 --> 00:04:04,000
+just described.
+
+59
+00:04:04,000 --> 00:04:09,000
+I would say that the list of the current concepts is enough to understand the functional programming.
+
+60
+00:04:09,000 --> 00:04:15,000
+What advantages and disadvantages functional programming has been through professionals.
+
+61
+00:04:15,000 --> 00:04:21,000
+We have to understand advantages and disadvantages of functional programming approach the disadvantages
+
+62
+00:04:21,000 --> 00:04:26,000
+advantages it is worth to mention that because of using pure functions that don't change any state and
+
+63
+00:04:26,000 --> 00:04:33,000
+are entirely dependent on the input, they are simple to understand the simplicity of functional programming
+
+64
+00:04:33,000 --> 00:04:35,000
+is one of the advantages that is mentioned.
+
+65
+00:04:35,000 --> 00:04:36,000
+Most often.
+
+66
+00:04:37,000 --> 00:04:40,000
+The testing is easier than the bargain is.
+
+67
+00:04:40,000 --> 00:04:42,000
+Easier is it is the first advantage.
+
+68
+00:04:42,000 --> 00:04:49,000
+The second advantage is that because of the pure functions, implementation of concurrency is much easier.
+
+69
+00:04:49,000 --> 00:04:54,000
+We shouldn't worry about state being changed from the different threats of execution in parallel.
+
+70
+00:04:55,000 --> 00:05:00,000
+To be honest, these are the biggest advantages you can Google advantages of functional programming
+
+71
+00:05:00,000 --> 00:05:02,000
+if you wish, but all of them can.
+
+72
+00:05:02,000 --> 00:05:08,000
+Be grouped in these two advantages that are listed, somebody would also mention that programs are more
+
+73
+00:05:08,000 --> 00:05:11,000
+concise and more bulletproof.
+
+74
+00:05:11,000 --> 00:05:16,000
+But I would rather said that this is associated with a simplicity that we have just discussed and the
+
+75
+00:05:16,000 --> 00:05:18,000
+logical benefits of PUA functions.
+
+76
+00:05:19,000 --> 00:05:24,000
+Somebody would also notice that absence of classes in functional programming makes the program code
+
+77
+00:05:24,000 --> 00:05:25,000
+easy to read.
+
+78
+00:05:26,000 --> 00:05:31,000
+But in my humble opinion, these advantages depend on the type of software you develop.
+
+79
+00:05:31,000 --> 00:05:36,000
+While functional programming works great for simple programs and for beginner programmers, I would
+
+80
+00:05:36,000 --> 00:05:41,000
+like to see how people who write articles that functional programming is the best.
+
+81
+00:05:41,000 --> 00:05:46,000
+I would love to see how they would implement some complex enterprise solutions that requires the mind
+
+82
+00:05:46,000 --> 00:05:49,000
+driven design and object oriented approach.
+
+83
+00:05:50,000 --> 00:05:52,000
+And remember, team, we are professionals.
+
+84
+00:05:52,000 --> 00:05:58,000
+That's why we don't say that functional programming or object oriented approach is better than something
+
+85
+00:05:58,000 --> 00:05:58,000
+else.
+
+86
+00:05:58,000 --> 00:06:04,000
+We just say that each approach works the best for specific cases and we need to know when to apply a
+
+87
+00:06:04,000 --> 00:06:06,000
+different approach if needed.
+
+88
+00:06:06,000 --> 00:06:11,000
+Talking about these advantages of functional programming, I'd like to mention a few items here.
+
+89
+00:06:12,000 --> 00:06:17,000
+The first thing that you probably might think of is that in case all values are immutable and functions
+
+90
+00:06:17,000 --> 00:06:22,000
+doesn't change state that would cause significant performance issues during the processing of a big
+
+91
+00:06:22,000 --> 00:06:27,000
+amount of data because a lot of values will be created that are not used.
+
+92
+00:06:27,000 --> 00:06:31,000
+That would also require a specific mechanism for memory management.
+
+93
+00:06:31,000 --> 00:06:37,000
+The second disadvantage is partially we talked through imagine that huge online store with customer
+
+94
+00:06:37,000 --> 00:06:43,000
+management, personalized promotions, specific rules for discount management, affiliate program,
+
+95
+00:06:43,000 --> 00:06:45,000
+warehouse management, etc..
+
+96
+00:06:45,000 --> 00:06:49,000
+Imagine that this kind of program is written with only functions.
+
+97
+00:06:49,000 --> 00:06:51,000
+Would that really make code readable?
+
+98
+00:06:52,000 --> 00:06:55,000
+Would that make the code easier to maintain and extend?
+
+99
+00:06:55,000 --> 00:07:01,000
+Or onboarding of new engineer to the project will require a month or two for learning all functions
+
+100
+00:07:01,000 --> 00:07:02,000
+that exist in the project.
+
+101
+00:07:03,000 --> 00:07:08,000
+That's why among the disadvantages of functional programming sometimes mentioned that in particular
+
+102
+00:07:08,000 --> 00:07:13,000
+cases, programs that are even with the help of only functions are hard to read.
+
+103
+00:07:14,000 --> 00:07:19,000
+The third important disadvantage that is worth to mention is that while writing of pure functions might
+
+104
+00:07:19,000 --> 00:07:26,000
+look easy, it is hard task to combine pure functions and make them work together to achieve some specific
+
+105
+00:07:26,000 --> 00:07:29,000
+goal and integrate them with the rest of application.
+
+106
+00:07:30,000 --> 00:07:33,000
+Now, you know, advantages and disadvantages of functional programming.
+
+107
+00:07:34,000 --> 00:07:37,000
+Functional programming is a form of declarative programming.
+
+108
+00:07:37,000 --> 00:07:43,000
+After you understood what a functional programming is, it will be easy for you to understand the definition
+
+109
+00:07:43,000 --> 00:07:44,000
+of declarative programming.
+
+110
+00:07:45,000 --> 00:07:51,000
+Declarative programming is a programming style of building the structure and elements of computer programs
+
+111
+00:07:51,000 --> 00:07:57,000
+that express the logic of a computation without describing the order in which individual statements,
+
+112
+00:07:57,000 --> 00:08:01,000
+instructions or function calls of program are executed or evaluated.
+
+113
+00:08:02,000 --> 00:08:08,000
+Does it make sense now on the opposite of declarative programming, we have imperative programming in
+
+114
+00:08:08,000 --> 00:08:09,000
+computer science.
+
+115
+00:08:09,000 --> 00:08:15,000
+Imperative programming is a programming paradigm that uses statements that change a programs state.
+
+116
+00:08:15,000 --> 00:08:21,000
+To make you understand imperative programming, I would like to use object oriented development approach
+
+117
+00:08:21,000 --> 00:08:21,000
+as an example.
+
+118
+00:08:22,000 --> 00:08:27,000
+We have objects that have state and masses to modify the state.
+
+119
+00:08:27,000 --> 00:08:33,000
+Usually Java is considered to be an imperative programming language, and in Java we usually use term
+
+120
+00:08:33,000 --> 00:08:39,000
+method instead of function to describe some specific block of code that can be executed.
+
+121
+00:08:39,000 --> 00:08:43,000
+What is the difference between the function and method or this is the same?
+
+122
+00:08:44,000 --> 00:08:50,000
+A function is a piece of code that is called by name and method is a piece of code that is called by
+
+123
+00:08:50,000 --> 00:08:53,000
+name that is associated with an object.
+
+124
+00:08:53,000 --> 00:08:58,000
+And I believe you can see that these two definitions are close, but not the same.
+
+125
+00:08:59,000 --> 00:09:01,000
+There are two main points to consider here.
+
+126
+00:09:01,000 --> 00:09:05,000
+The first one is that MassArt is called on the object.
+
+127
+00:09:05,000 --> 00:09:10,000
+That's why Massager is considered to be closer to object oriented programming approach.
+
+128
+00:09:11,000 --> 00:09:15,000
+Function can exist without any object and can be called independently.
+
+129
+00:09:16,000 --> 00:09:22,000
+And the second point, the method is able to operate on data that describes the state of the object.
+
+130
+00:09:23,000 --> 00:09:26,000
+Function works with arguments that are pastorate.
+
+131
+00:09:26,000 --> 00:09:27,000
+Does it make sense?
+
+132
+00:09:28,000 --> 00:09:28,000
+Help now?
+
+133
+00:09:28,000 --> 00:09:31,000
+The difference between function and MassArt is clearer.
+
+134
+00:09:31,000 --> 00:09:34,000
+Let's talk now about functional programming and Java.
+
+135
+00:09:35,000 --> 00:09:40,000
+Functional programming was introduced in Java eight and I'd like to add more specifics here.
+
+136
+00:09:40,000 --> 00:09:43,000
+In my opinion, it will sound correctly.
+
+137
+00:09:43,000 --> 00:09:47,000
+It will say that functional like syntax was introduced in Java version eight.
+
+138
+00:09:48,000 --> 00:09:50,000
+Java still remains imperative language.
+
+139
+00:09:51,000 --> 00:09:57,000
+Java still uses object oriented approach, and even functional programming in Java is implemented in
+
+140
+00:09:57,000 --> 00:09:58,000
+object oriented manner.
+
+141
+00:09:59,000 --> 00:10:00,000
+That is really impressive.
+
+142
+00:10:01,000 --> 00:10:02,000
+Java combines is.
+
+143
+00:10:02,000 --> 00:10:09,000
+So declarant functions and it's pure object oriented style that deprives the Java feeling during the
+
+144
+00:10:09,000 --> 00:10:17,000
+code in Java introduced syntax improvements, namely now we can use lambda expressions and methods references
+
+145
+00:10:17,000 --> 00:10:18,000
+during the development.
+
+146
+00:10:19,000 --> 00:10:21,000
+We're going to learn what is this?
+
+147
+00:10:21,000 --> 00:10:22,000
+And a separate lesson.
+
+148
+00:10:22,000 --> 00:10:27,000
+And we'll practice in writing our own lambda expressions and create references.
+
+149
+00:10:27,000 --> 00:10:33,000
+Java also introduced new package with the language function that's called an overview of this package
+
+150
+00:10:33,000 --> 00:10:35,000
+to understand what was introduced there.
+
+151
+00:10:36,000 --> 00:10:40,000
+And here you can see official documentation of your function package.
+
+152
+00:10:40,000 --> 00:10:42,000
+Why do we need it in this package?
+
+153
+00:10:42,000 --> 00:10:44,000
+Functional interfaces are grouped.
+
+154
+00:10:45,000 --> 00:10:47,000
+What are functional interfaces?
+
+155
+00:10:47,000 --> 00:10:54,000
+In short, every interface that declares only one abstract method is a functional interface in our next
+
+156
+00:10:54,000 --> 00:10:54,000
+lesson.
+
+157
+00:10:54,000 --> 00:10:58,000
+So we are going to learn in detail what functional interfaces are.
+
+158
+00:10:58,000 --> 00:11:01,000
+But for this lesson, it is enough to imagine interfaces.
+
+159
+00:11:01,000 --> 00:11:04,000
+It always has only one abstract method.
+
+160
+00:11:04,000 --> 00:11:08,000
+And when I will say functional interface, you will understand what I am talking about.
+
+161
+00:11:09,000 --> 00:11:14,000
+The functional interfaces provide target types for lambda expressions and methods references.
+
+162
+00:11:14,000 --> 00:11:16,000
+Let me explain this in simple words.
+
+163
+00:11:17,000 --> 00:11:23,000
+This package group, all types that can be used during the declaring of lambda expressions and method
+
+164
+00:11:23,000 --> 00:11:30,000
+references, all types in this package follow specific naming convention and this is specified here,
+
+165
+00:11:31,000 --> 00:11:35,000
+will not learn this right now because in my opinion it is better to learn during the practice.
+
+166
+00:11:36,000 --> 00:11:39,000
+You can see that this package was introduced in Java version eight.
+
+167
+00:11:40,000 --> 00:11:43,000
+And here you can see a list of types that we are going to learn.
+
+168
+00:11:44,000 --> 00:11:47,000
+Clear explanations written right here next to type name.
+
+169
+00:11:48,000 --> 00:11:52,000
+I can leave the link to this documentation in attachments to the lesson and you would read it after
+
+170
+00:11:52,000 --> 00:11:53,000
+the lesson.
+
+171
+00:11:53,000 --> 00:11:59,000
+Don't try to understand everything because we are going to have lessons that will teach you how to work
+
+172
+00:11:59,000 --> 00:12:00,000
+with types from this package.
+
+173
+00:12:01,000 --> 00:12:04,000
+But you can try to understand why we need some types here.
+
+174
+00:12:04,000 --> 00:12:07,000
+For example, here you can even see a function type.
+
+175
+00:12:08,000 --> 00:12:13,000
+This type is developed to represent the function that accepts one argument and produces a result.
+
+176
+00:12:14,000 --> 00:12:19,000
+While learning stream API will use some of these types to declare a lambda expressions.
+
+177
+00:12:19,000 --> 00:12:25,000
+And now when you can see the whole list of types that allows us to create an object of these types,
+
+178
+00:12:25,000 --> 00:12:27,000
+you can understand why.
+
+179
+00:12:27,000 --> 00:12:32,000
+A few minutes ago I said that functional programming Java implemented with a feeling of object oriented
+
+180
+00:12:32,000 --> 00:12:33,000
+paradigm.
+
+181
+00:12:34,000 --> 00:12:39,000
+You can see that function is also a separate type and I can create an object of function type.
+
+182
+00:12:40,000 --> 00:12:45,000
+I believe this information is more than enough to understand what functional programming is and what
+
+183
+00:12:45,000 --> 00:12:46,000
+we are going to learn.
+
+184
+00:12:46,000 --> 00:12:51,000
+Let's recap what we have learned today, that iminent what functional programming is.
+
+185
+00:12:51,000 --> 00:12:54,000
+We discussed main concepts of functional programming.
+
+186
+00:12:54,000 --> 00:12:58,000
+After that, we discussed advantages and disadvantages of functional programming.
+
+187
+00:12:59,000 --> 00:13:03,000
+Also today, we learned what is imperative and declarative programming.
+
+188
+00:13:03,000 --> 00:13:07,000
+We learned what the difference between the function and the method is.
+
+189
+00:13:08,000 --> 00:13:13,000
+And at the end of the lesson, I told you what functional programming in Java is and hold an overview
+
+190
+00:13:13,000 --> 00:13:15,000
+of Jabbawockeez function package.
+
+191
+00:13:16,000 --> 00:13:21,000
+I believe now we have enough theoretical knowledge to practice our learning of functional programming
+
+192
+00:13:21,000 --> 00:13:21,000
+in Java.
+
+193
+00:13:22,000 --> 00:13:25,000
+That's all what I wanted to discuss with you during this lesson.
+
+194
+00:13:25,000 --> 00:13:26,000
+Thanks a lot for your attention.
+
+195
+00:13:27,000 --> 00:13:28,000
+See you in the next lesson.
+
diff --git a/22 - Functional Programming in Java (including lambda functions & method references)/002 Functional Interface, Lambda Functions & Method References_en.srt b/22 - Functional Programming in Java (including lambda functions & method references)/002 Functional Interface, Lambda Functions & Method References_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..343d374dadaeccb2d00b43f19cf649420c0ea619
--- /dev/null
+++ b/22 - Functional Programming in Java (including lambda functions & method references)/002 Functional Interface, Lambda Functions & Method References_en.srt
@@ -0,0 +1,840 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello.
+
+2
+00:00:06,000 --> 00:00:11,000
+Yes, students in this class and we are going to learn what lambda expressions and message references
+
+3
+00:00:11,000 --> 00:00:12,000
+are today.
+
+4
+00:00:12,000 --> 00:00:15,000
+We are going to have really a lot of practice after this lesson.
+
+5
+00:00:15,000 --> 00:00:18,000
+You will be able to write lambda functions like a pro.
+
+6
+00:00:18,000 --> 00:00:24,000
+I will explain to you what functional interfaces are and we will learn the difference between regular
+
+7
+00:00:24,000 --> 00:00:29,000
+and functional interfaces by the end of the class and you will know how to create your own functional
+
+8
+00:00:29,000 --> 00:00:30,000
+interfaces.
+
+9
+00:00:30,000 --> 00:00:34,000
+We are going to learn what the function is and what Massett reference is.
+
+10
+00:00:34,000 --> 00:00:38,000
+I prepared special examples that will help you to grasp the knowledge faster.
+
+11
+00:00:39,000 --> 00:00:44,000
+I'm going to show you how you can write lambda functions and how you can use math references.
+
+12
+00:00:44,000 --> 00:00:45,000
+Let's start.
+
+13
+00:00:46,000 --> 00:00:49,000
+And today, the best way to learn the topic is start from examples.
+
+14
+00:00:50,000 --> 00:00:54,000
+That's why I suggest switching to the eclipse and start our lesson.
+
+15
+00:00:54,000 --> 00:00:59,000
+To understand how to use Lambda functions and Macit references, we have to understand first what functional
+
+16
+00:00:59,000 --> 00:01:00,000
+interface is.
+
+17
+00:01:01,000 --> 00:01:06,000
+As we briefly discussed in previous lesson, functional interface is an interface that has a single
+
+18
+00:01:06,000 --> 00:01:08,000
+object method declared in it.
+
+19
+00:01:09,000 --> 00:01:13,000
+Take a look at this example, this interface is called Distance Calculator.
+
+20
+00:01:13,000 --> 00:01:19,000
+It is declared to have Iraqi of types that can calculate distance of delivery of customer's order in
+
+21
+00:01:19,000 --> 00:01:20,000
+miles.
+
+22
+00:01:21,000 --> 00:01:27,000
+I can calculate the shortest path, the most optimal road route for interstate delivery, distance from
+
+23
+00:01:27,000 --> 00:01:31,000
+the closest store or from the specific store and lots more.
+
+24
+00:01:31,000 --> 00:01:38,000
+All this might be implemented in calculate distance method in other types that will implement the Easton's
+
+25
+00:01:38,000 --> 00:01:39,000
+calculator.
+
+26
+00:01:40,000 --> 00:01:43,000
+This method also takes two objects of city type.
+
+27
+00:01:43,000 --> 00:01:45,000
+The store inside coordinates.
+
+28
+00:01:45,000 --> 00:01:47,000
+We have city time declared here.
+
+29
+00:01:47,000 --> 00:01:50,000
+This is a type created just for our example.
+
+30
+00:01:50,000 --> 00:01:56,000
+The state of the city can be described with the help of the coordinates, longitude and latitude, and
+
+31
+00:01:56,000 --> 00:01:58,000
+we have getters and setters here.
+
+32
+00:01:58,000 --> 00:02:01,000
+Now you have the context of real life business case.
+
+33
+00:02:02,000 --> 00:02:07,000
+I believe that understanding of real life example will help you to grasp new knowledge faster.
+
+34
+00:02:08,000 --> 00:02:08,000
+That is great.
+
+35
+00:02:09,000 --> 00:02:13,000
+You can see new annotations here, functional interface.
+
+36
+00:02:13,000 --> 00:02:14,000
+What is it for?
+
+37
+00:02:14,000 --> 00:02:20,000
+First of all, this is a great sign to notify clients of your code that originally regionalisms interface
+
+38
+00:02:20,000 --> 00:02:24,000
+is created to be a target type for lambda functions and Macit references.
+
+39
+00:02:25,000 --> 00:02:30,000
+And the second reason to use the sanitation is that in case somebody would try to add additional abasic
+
+40
+00:02:30,000 --> 00:02:33,000
+Macit, there will be a compilation error.
+
+41
+00:02:33,000 --> 00:02:38,000
+Let me comment this line of code that contains declaration of additional Massett.
+
+42
+00:02:38,000 --> 00:02:41,000
+And here you can see we have a compilation error now.
+
+43
+00:02:42,000 --> 00:02:48,000
+That's why functional interface annotation helps us to prevent cases when someone wants to add additional
+
+44
+00:02:48,000 --> 00:02:53,000
+behavior to the type that we already used in other parts of the program as a tag for lambda function.
+
+45
+00:02:54,000 --> 00:02:57,000
+Hope it is clear what function interface is.
+
+46
+00:02:57,000 --> 00:03:00,000
+Let me comment this MassArt again to proceed.
+
+47
+00:03:00,000 --> 00:03:06,000
+Pay attention to the fact that functional interface can contain as much default methods as possible
+
+48
+00:03:06,000 --> 00:03:08,000
+and as much static methods as possible.
+
+49
+00:03:08,000 --> 00:03:12,000
+This does not violate the rule for functional interface.
+
+50
+00:03:12,000 --> 00:03:16,000
+That said, regarding functional interface, that was easy and great.
+
+51
+00:03:16,000 --> 00:03:18,000
+Let me congratulate you.
+
+52
+00:03:18,000 --> 00:03:22,000
+Now you know how to create your own custom functional interface.
+
+53
+00:03:22,000 --> 00:03:27,000
+And now when you know what functional interface is, let's learn what lambda expressions are.
+
+54
+00:03:28,000 --> 00:03:31,000
+Let me open the next examples that I have prepared before this lesson.
+
+55
+00:03:32,000 --> 00:03:37,000
+I have a few more classes grouped here in one file, just for the sake of example, to not switch tabs
+
+56
+00:03:37,000 --> 00:03:39,000
+between different files.
+
+57
+00:03:39,000 --> 00:03:45,000
+Imagine that we have class with a name or the management, and this class requires an instance of distance
+
+58
+00:03:45,000 --> 00:03:52,000
+calculator type to perform all operations related to the management we can pass in terms of distance
+
+59
+00:03:52,000 --> 00:03:57,000
+calculator type, either with the help of constructor or with the help of the setup here.
+
+60
+00:03:57,000 --> 00:04:03,000
+That means you need to create an object of type distance calculator in your program, but you know that
+
+61
+00:04:03,000 --> 00:04:06,000
+you can't create objects on the basis of interface, right?
+
+62
+00:04:06,000 --> 00:04:12,000
+That's why you declare concrete class, let's say the full distance calculator and implement distance
+
+63
+00:04:12,000 --> 00:04:14,000
+calculator interface here.
+
+64
+00:04:14,000 --> 00:04:20,000
+Now when we create object of type order management, we great object of type distance calculator.
+
+65
+00:04:21,000 --> 00:04:27,000
+But what to do in case we need to change this since calculator to take into account specifics of inter-state
+
+66
+00:04:27,000 --> 00:04:28,000
+delivery.
+
+67
+00:04:28,000 --> 00:04:35,000
+In this case, we have to create another concrete class and we need this just override, calculate distance
+
+68
+00:04:35,000 --> 00:04:36,000
+method.
+
+69
+00:04:36,000 --> 00:04:38,000
+Only once is it worth it.
+
+70
+00:04:38,000 --> 00:04:44,000
+We've seen that this doesn't work of our efforts and we decide to declare anonymous class and create
+
+71
+00:04:44,000 --> 00:04:46,000
+an instance of anonymous class.
+
+72
+00:04:47,000 --> 00:04:51,000
+This time we take into account logic for interstate distance calculation.
+
+73
+00:04:52,000 --> 00:04:55,000
+OK, but can you see how much lines of code it takes?
+
+74
+00:04:56,000 --> 00:05:02,000
+It is super weird that we have to declare a concrete class just to give implementation of one single
+
+75
+00:05:02,000 --> 00:05:02,000
+method.
+
+76
+00:05:03,000 --> 00:05:07,000
+We can create thousands of concrete classes to implement dozens of functions.
+
+77
+00:05:08,000 --> 00:05:14,000
+But do we need to overwhelm our application with additional classes if we just need one function in
+
+78
+00:05:14,000 --> 00:05:15,000
+one single place?
+
+79
+00:05:16,000 --> 00:05:19,000
+No, that's where lambda function is going to help us.
+
+80
+00:05:20,000 --> 00:05:22,000
+But what is lambda function?
+
+81
+00:05:22,000 --> 00:05:24,000
+It is also called anonymous function.
+
+82
+00:05:24,000 --> 00:05:26,000
+It doesn't have any name.
+
+83
+00:05:27,000 --> 00:05:30,000
+Usually anonymous functions are passed to higher order functions.
+
+84
+00:05:31,000 --> 00:05:38,000
+Also, in case the function is only used once a limited number of times, it will be easier to Islam
+
+85
+00:05:38,000 --> 00:05:44,000
+the expression rather than the clear and concrete class in need to create an object of time distance
+
+86
+00:05:44,000 --> 00:05:44,000
+calculator.
+
+87
+00:05:44,000 --> 00:05:51,000
+We have to just implement one method, take a look here and declare a new variable of distance calculator
+
+88
+00:05:51,000 --> 00:05:54,000
+type to describe new logic for calculate distance method.
+
+89
+00:05:54,000 --> 00:05:56,000
+And here you can see the land expression.
+
+90
+00:05:57,000 --> 00:06:00,000
+Here it is lambda function, anonymous function.
+
+91
+00:06:01,000 --> 00:06:04,000
+We can call this in different ways by using different names.
+
+92
+00:06:05,000 --> 00:06:07,000
+Let me explain in the syntax here.
+
+93
+00:06:07,000 --> 00:06:07,000
+You can see.
+
+94
+00:06:07,000 --> 00:06:13,000
+Parentheses that we usually use for MassArt invocation, Autobus arguments, you can see that I Passey
+
+95
+00:06:13,000 --> 00:06:19,000
+Q1 and Q2 arguments where I this I didn't create any objects.
+
+96
+00:06:19,000 --> 00:06:24,000
+This is just local MASAD variables similar to the ones we use in massive declaration.
+
+97
+00:06:25,000 --> 00:06:31,000
+Using these variables I can get access to objects at my function should work with inside the body.
+
+98
+00:06:32,000 --> 00:06:33,000
+I will show you that in a second.
+
+99
+00:06:34,000 --> 00:06:40,000
+Why I don't write types of these local variables because compiler knows that I want to give implementation
+
+100
+00:06:40,000 --> 00:06:44,000
+of the method from distance calculator type and the first argument.
+
+101
+00:06:44,000 --> 00:06:48,000
+And this method has typesetter the same as the second argument.
+
+102
+00:06:49,000 --> 00:06:53,000
+That's why Compiler knows that these local variables should be of typesetter.
+
+103
+00:06:53,000 --> 00:06:58,000
+But in case I will add types here, there is no harm in this, just like this.
+
+104
+00:06:59,000 --> 00:07:05,000
+In case if Jason's calculator wouldn't declare any Masset parameters and calculate distance measured
+
+105
+00:07:05,000 --> 00:07:11,000
+in that case, we would skip Masad arguments here and would leave just blank parentheses like this.
+
+106
+00:07:15,000 --> 00:07:18,000
+Here is LAMDA and here goes returned value.
+
+107
+00:07:19,000 --> 00:07:20,000
+Here is some damage calculation.
+
+108
+00:07:20,000 --> 00:07:25,000
+For example, I perform subtraction of longitude of 31 and 32.
+
+109
+00:07:25,000 --> 00:07:30,000
+That doesn't give us a true distance between cities, but makes you understand that you can perform
+
+110
+00:07:30,000 --> 00:07:31,000
+any calculations here.
+
+111
+00:07:32,000 --> 00:07:38,000
+And the result of this calculation is returns from the MassArt worse given return keyword here, because
+
+112
+00:07:38,000 --> 00:07:44,000
+Compellent knows that at one point of implementation of the absolute masset of distance calculate the
+
+113
+00:07:44,000 --> 00:07:47,000
+time and compiler knows that this method should return value.
+
+114
+00:07:48,000 --> 00:07:50,000
+Technically creation of object of anonymous glass.
+
+115
+00:07:50,000 --> 00:07:56,000
+And this is the same because calculate distance implementation is the same as here.
+
+116
+00:07:57,000 --> 00:08:03,000
+The next point you have to know about our Syntex in case our anonymous function consists of more than
+
+117
+00:08:03,000 --> 00:08:06,000
+one line, then we need to use Brace's.
+
+118
+00:08:06,000 --> 00:08:08,000
+And here you can see an example.
+
+119
+00:08:08,000 --> 00:08:12,000
+Also, in this case, we have to right return keywords.
+
+120
+00:08:13,000 --> 00:08:18,000
+And if you see that in this case, visually, this LAMDA function is closer to the method we have here
+
+121
+00:08:18,000 --> 00:08:25,000
+in anonymous class where missing only a return type value method, name type of local variables and
+
+122
+00:08:25,000 --> 00:08:26,000
+access modifier.
+
+123
+00:08:26,000 --> 00:08:33,000
+So in case I write here, public double calculate distance and in case I would add types to local variables,
+
+124
+00:08:33,000 --> 00:08:35,000
+does it make more sense like this?
+
+125
+00:08:36,000 --> 00:08:42,000
+But for lambda expression, we don't need to specify access modifier, it is already accessed here,
+
+126
+00:08:43,000 --> 00:08:45,000
+let me remove it also.
+
+127
+00:08:45,000 --> 00:08:52,000
+We don't have to specify return that because our Java compiler can understand that we are going to implement
+
+128
+00:08:52,000 --> 00:08:57,000
+Macit from a distance, calculate the functional interface and the method inside this interface has
+
+129
+00:08:57,000 --> 00:08:58,000
+double return type.
+
+130
+00:08:59,000 --> 00:09:05,000
+Can you understand now why it is important that functional interface has only one abstract method?
+
+131
+00:09:05,000 --> 00:09:11,000
+Because in case functional interface has more than one method, then it is not clear what message I
+
+132
+00:09:11,000 --> 00:09:14,000
+try to implement with the help of anonymous function.
+
+133
+00:09:14,000 --> 00:09:15,000
+Is that clear?
+
+134
+00:09:16,000 --> 00:09:23,000
+So I can remove, recontact and also I can remove massive name because it is clear what method I want
+
+135
+00:09:23,000 --> 00:09:28,000
+to implement and I don't need any other identifier to access this function.
+
+136
+00:09:28,000 --> 00:09:34,000
+And I believe you already understood why I can remove all types of my local variables, because compiler
+
+137
+00:09:34,000 --> 00:09:41,000
+knows that these variables will be of type according to the interface here you can see that I can call
+
+138
+00:09:41,000 --> 00:09:46,000
+calculate distance method on my reference here and I believe you already understood that these lines
+
+139
+00:09:46,000 --> 00:09:48,000
+of code will be executed.
+
+140
+00:09:48,000 --> 00:09:49,000
+Let me prove this.
+
+141
+00:09:49,000 --> 00:09:54,000
+I run the program and here you can see console output from the lambda function.
+
+142
+00:09:55,000 --> 00:10:01,000
+And when I need implementation of distance calculator interface and I need it only one time only it
+
+143
+00:10:01,000 --> 00:10:07,000
+is easier for me to create lambda function rather than declare a concrete class and create an instance
+
+144
+00:10:07,000 --> 00:10:08,000
+of a concrete class.
+
+145
+00:10:09,000 --> 00:10:16,000
+For example, here in the set method, I can pass any function I need and that will be enough for order
+
+146
+00:10:16,000 --> 00:10:22,000
+management because all the management is interested not in the fact of get an object of type discount
+
+147
+00:10:22,000 --> 00:10:23,000
+calculator.
+
+148
+00:10:24,000 --> 00:10:31,000
+Order management is interested in getting behavior to calculate distance and that gives a specific definition
+
+149
+00:10:31,000 --> 00:10:34,000
+of behavior with the help of lambda function.
+
+150
+00:10:34,000 --> 00:10:41,000
+Usually it is not instantly clear for my students where we will get arguments for the lambda function.
+
+151
+00:10:41,000 --> 00:10:44,000
+I want you to understand that lambda function.
+
+152
+00:10:44,000 --> 00:10:47,000
+It is not a method invocation with arguments.
+
+153
+00:10:47,000 --> 00:10:54,000
+It is just the definition of the method with parameters similar to this thing we do when we implement
+
+154
+00:10:54,000 --> 00:10:56,000
+any interface in concrete class.
+
+155
+00:10:56,000 --> 00:11:03,000
+So the city objects will be passed here to this function, wherever it will be needed.
+
+156
+00:11:03,000 --> 00:11:06,000
+According to the logic described in the order management.
+
+157
+00:11:07,000 --> 00:11:14,000
+Sometimes we only know that some type like order management just needs logic to calculate distance between
+
+158
+00:11:14,000 --> 00:11:14,000
+two cities.
+
+159
+00:11:15,000 --> 00:11:20,000
+And sometimes we really don't care where order management will get those cities.
+
+160
+00:11:20,000 --> 00:11:26,000
+Probably they will be passed to other methods of order management or will be present in all the details.
+
+161
+00:11:26,000 --> 00:11:32,000
+But we let all the management object decide when to call our function and we let all the management
+
+162
+00:11:32,000 --> 00:11:35,000
+bother about what just to pass there.
+
+163
+00:11:35,000 --> 00:11:36,000
+Does it make sense?
+
+164
+00:11:37,000 --> 00:11:39,000
+Hope you understood what lambda function is.
+
+165
+00:11:39,000 --> 00:11:42,000
+Now, let me explain to you what a reference is.
+
+166
+00:11:42,000 --> 00:11:44,000
+Imagine that you already have mass.
+
+167
+00:11:44,000 --> 00:11:47,000
+That's exactly the same what you want.
+
+168
+00:11:47,000 --> 00:11:52,000
+Probably it is from some external library or probably it is just from another class.
+
+169
+00:11:53,000 --> 00:11:58,000
+Then why do we need to declare a concrete class to override MassArt or create lambda function?
+
+170
+00:11:59,000 --> 00:12:04,000
+Why don't we just tell the order management object to use the mass that already exists?
+
+171
+00:12:05,000 --> 00:12:10,000
+In all cases, when all the management needs to calculate distance, we can do so.
+
+172
+00:12:10,000 --> 00:12:13,000
+And for this we have to use MassArt references.
+
+173
+00:12:13,000 --> 00:12:15,000
+Let me show you the next example.
+
+174
+00:12:15,000 --> 00:12:18,000
+Here is the example of some third party class.
+
+175
+00:12:18,000 --> 00:12:24,000
+Imagine that it is called Google Dist. calculator and it has Masset for distance calculation.
+
+176
+00:12:25,000 --> 00:12:27,000
+It is called get distance between cities.
+
+177
+00:12:27,000 --> 00:12:31,000
+You can see that we have static and non static MassArt.
+
+178
+00:12:31,000 --> 00:12:34,000
+That is, for the sake of example, to cover a few cases.
+
+179
+00:12:34,000 --> 00:12:40,000
+Please pay attention to the fact that type of return value and type of method parameters is the same
+
+180
+00:12:40,000 --> 00:12:43,000
+as we have in distance calculator interface.
+
+181
+00:12:43,000 --> 00:12:44,000
+This is important.
+
+182
+00:12:45,000 --> 00:12:51,000
+And now when I need to set new distance calculator into my or the management object, I just pass the
+
+183
+00:12:51,000 --> 00:12:52,000
+reference to this method.
+
+184
+00:12:53,000 --> 00:12:54,000
+Let me explain this.
+
+185
+00:12:54,000 --> 00:13:01,000
+This index here here is the name of our class that contains the message that we need, followed by double
+
+186
+00:13:01,000 --> 00:13:02,000
+column.
+
+187
+00:13:02,000 --> 00:13:09,000
+This is a syntax of reference I'm referencing to the distance between a static method in Google distance
+
+188
+00:13:09,000 --> 00:13:10,000
+calculator class.
+
+189
+00:13:11,000 --> 00:13:12,000
+Does it make sense?
+
+190
+00:13:12,000 --> 00:13:15,000
+And again, this is not in location.
+
+191
+00:13:15,000 --> 00:13:22,000
+That's why I don't pass any arguments here, or the management just needs something that can take two
+
+192
+00:13:22,000 --> 00:13:24,000
+cities and will return double value.
+
+193
+00:13:25,000 --> 00:13:31,000
+That's all what order management object expects from distance calculator type and this method from Google
+
+194
+00:13:31,000 --> 00:13:35,000
+Distance Calculator do the exact things that order management wants.
+
+195
+00:13:36,000 --> 00:13:43,000
+That's why there is no compilation error here, pay attention that I use class name to make a reference
+
+196
+00:13:43,000 --> 00:13:47,000
+to static method in case I want to make a reference to non-cyclical method.
+
+197
+00:13:47,000 --> 00:13:49,000
+I have to create object.
+
+198
+00:13:49,000 --> 00:13:52,000
+And here you can see that I created object.
+
+199
+00:13:52,000 --> 00:13:57,000
+Now I can use variable of my object to make a reference to the non static method.
+
+200
+00:13:57,000 --> 00:13:58,000
+Does it make sense?
+
+201
+00:13:59,000 --> 00:14:02,000
+Hope now it is clear how Massata references work.
+
+202
+00:14:03,000 --> 00:14:04,000
+They learned a lot today.
+
+203
+00:14:04,000 --> 00:14:11,000
+Let's recap what we have learned today, the day we learned what functional interface is and we even
+
+204
+00:14:11,000 --> 00:14:13,000
+created a custom functional interface.
+
+205
+00:14:13,000 --> 00:14:18,000
+Now you know what the function is and how to write your own lambda expression.
+
+206
+00:14:19,000 --> 00:14:22,000
+After that, we learned what math reference is.
+
+207
+00:14:22,000 --> 00:14:25,000
+On the real example, we learned how to apply your knowledge.
+
+208
+00:14:26,000 --> 00:14:27,000
+That's it for this lesson.
+
+209
+00:14:28,000 --> 00:14:29,000
+Thank you for your attention.
+
+210
+00:14:29,000 --> 00:14:31,000
+See you in the next lesson.
+
diff --git a/22 - Functional Programming in Java (including lambda functions & method references)/002 Source-code-All-examples-from-the-lecture.url b/22 - Functional Programming in Java (including lambda functions & method references)/002 Source-code-All-examples-from-the-lecture.url
new file mode 100644
index 0000000000000000000000000000000000000000..9273f10d1245a3a96c27bc9a8b66e7622e807e8d
--- /dev/null
+++ b/22 - Functional Programming in Java (including lambda functions & method references)/002 Source-code-All-examples-from-the-lecture.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/functions/lambdaandmethodreference
\ No newline at end of file
diff --git a/22 - Functional Programming in Java (including lambda functions & method references)/003 Function & BiFunction Theory & Practice_en.srt b/22 - Functional Programming in Java (including lambda functions & method references)/003 Function & BiFunction Theory & Practice_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..d518b0e1574dba66201593dec8ed3e142f3335f7
--- /dev/null
+++ b/22 - Functional Programming in Java (including lambda functions & method references)/003 Function & BiFunction Theory & Practice_en.srt
@@ -0,0 +1,996 @@
+1
+00:00:06,000 --> 00:00:11,000
+Hello, adjustments in this lesson, we're going to learn interfaces from a dual function package,
+
+2
+00:00:11,000 --> 00:00:18,000
+Ziya function and by function in this lesson, we are going to have a lot of practice to help you understand.
+
+3
+00:00:18,000 --> 00:00:25,000
+These types better will use map implementation for all examples that will give your understanding how
+
+4
+00:00:25,000 --> 00:00:28,000
+you can apply your knowledge in real life cases.
+
+5
+00:00:28,000 --> 00:00:34,000
+And while learning different types will create a lot of lambda functions and MassArt references, we're
+
+6
+00:00:34,000 --> 00:00:37,000
+going to learn default methods from functional interface.
+
+7
+00:00:37,000 --> 00:00:43,000
+You will learn what is the difference between and then and compose masses will discuss it identity message
+
+8
+00:00:43,000 --> 00:00:49,000
+from the function interface and I will explain how it works and what benefit we can get when we use
+
+9
+00:00:49,000 --> 00:00:52,000
+it at the end of the lesson and will show you how you can create.
+
+10
+00:00:52,000 --> 00:00:55,000
+Compare that with the help of function that start.
+
+11
+00:00:56,000 --> 00:01:00,000
+And to learn this topic, it is better to learn it from the source code and then real examples.
+
+12
+00:01:01,000 --> 00:01:07,000
+We'll start our lesson from the function time function interface is a function interface and declare
+
+13
+00:01:07,000 --> 00:01:12,000
+one abasic method that takes some value as an argument and can return something.
+
+14
+00:01:12,000 --> 00:01:13,000
+There are tensions.
+
+15
+00:01:13,000 --> 00:01:16,000
+That function interface is parametrized by two types.
+
+16
+00:01:17,000 --> 00:01:22,000
+In case you don't remember what generics are, please look at generic lesson to refresh your knowledge.
+
+17
+00:01:22,000 --> 00:01:28,000
+Two types and indeed here in parameterization to put a stress on the fact that type of the argument
+
+18
+00:01:28,000 --> 00:01:31,000
+may be different and type of return to value.
+
+19
+00:01:31,000 --> 00:01:37,000
+The function is usually applied where you need to produce some result of different type on the basis
+
+20
+00:01:37,000 --> 00:01:38,000
+of the argument.
+
+21
+00:01:38,000 --> 00:01:40,000
+Let me show you a function example.
+
+22
+00:01:40,000 --> 00:01:44,000
+I created separate file for all examples that we are going to review today.
+
+23
+00:01:45,000 --> 00:01:48,000
+I will leave links to this file in less than attachments.
+
+24
+00:01:48,000 --> 00:01:53,000
+And as I said, an agenda of the lesson will use classes from Java Collections Framework to show you
+
+25
+00:01:53,000 --> 00:01:56,000
+how you can apply the knowledge of functional interfaces.
+
+26
+00:01:57,000 --> 00:01:59,000
+I created an object of hash map type.
+
+27
+00:01:59,000 --> 00:02:05,000
+Our hash map is parametrized by integer type four keys and string type four values.
+
+28
+00:02:05,000 --> 00:02:08,000
+I fill out the map with the values for the sake of our demo.
+
+29
+00:02:09,000 --> 00:02:15,000
+In this line of code, I want to print the value that is associated with the key for I believe you can
+
+30
+00:02:15,000 --> 00:02:22,000
+understand that no will be printed to console because I didn't put any value for key for now on my map.
+
+31
+00:02:22,000 --> 00:02:25,000
+I want to go computer absent MassArt.
+
+32
+00:02:25,000 --> 00:02:27,000
+Let's look at the source code of this matter.
+
+33
+00:02:27,000 --> 00:02:33,000
+To understand what it is for this method should compute the value for the key in case the key is not
+
+34
+00:02:33,000 --> 00:02:37,000
+already associated with the value is mapped to now.
+
+35
+00:02:37,000 --> 00:02:42,000
+And this method will compute the value using the function that we pass to this method.
+
+36
+00:02:42,000 --> 00:02:49,000
+You can see and Masset arguments that this method takes key as a first argument and also it requires
+
+37
+00:02:49,000 --> 00:02:50,000
+a function type argument.
+
+38
+00:02:51,000 --> 00:02:55,000
+And here you can see apply Massata Scholte on our function.
+
+39
+00:02:56,000 --> 00:03:02,000
+The function that will be given to this method is parametrized by any type that is compatible with the
+
+40
+00:03:02,000 --> 00:03:07,000
+type of our key and any type that is compatible with the type of the value in this map.
+
+41
+00:03:08,000 --> 00:03:14,000
+And knowing how a function works, we already can understand that key will be passed to our function
+
+42
+00:03:14,000 --> 00:03:18,000
+and will use it should be associated with that key will be mapped to it.
+
+43
+00:03:19,000 --> 00:03:21,000
+Now, let's get back to our example.
+
+44
+00:03:22,000 --> 00:03:26,000
+I created all examples here before the lesson to save the time during the video recording.
+
+45
+00:03:26,000 --> 00:03:28,000
+Let me explain to you what is written here.
+
+46
+00:03:29,000 --> 00:03:32,000
+I call Computer Fab's and Massett and pass the key.
+
+47
+00:03:32,000 --> 00:03:36,000
+And the second argument is a function from the syntax standpoint.
+
+48
+00:03:36,000 --> 00:03:43,000
+You can see that in case we have only one argument we can skip parentheses here is a local variable
+
+49
+00:03:43,000 --> 00:03:50,000
+key and I have to return string tie because the return value should be compatible with the value type
+
+50
+00:03:50,000 --> 00:03:52,000
+of our map of the sake of the Dharma.
+
+51
+00:03:52,000 --> 00:03:55,000
+Let me return string representation of four.
+
+52
+00:03:56,000 --> 00:03:57,000
+Does it make sense?
+
+53
+00:03:57,000 --> 00:04:04,000
+So now the execution, this lambda function will be called inside compute if absent MASP.
+
+54
+00:04:04,000 --> 00:04:07,000
+Let me show your source code one more time.
+
+55
+00:04:07,000 --> 00:04:12,000
+Here apply method of our function will be called and key will be passed.
+
+56
+00:04:13,000 --> 00:04:19,000
+It will return string value that is not now and after that it will be inserted into the map.
+
+57
+00:04:19,000 --> 00:04:20,000
+Is it clear?
+
+58
+00:04:21,000 --> 00:04:26,000
+Let me run the program and print to console the value that is associated with the key for.
+
+59
+00:04:26,000 --> 00:04:30,000
+And here you can see that before we call compute the absolute mass.
+
+60
+00:04:30,000 --> 00:04:33,000
+There was no value associated with this key.
+
+61
+00:04:33,000 --> 00:04:39,000
+And after we call the method, we can see the values that is associated with our key hope.
+
+62
+00:04:39,000 --> 00:04:44,000
+This example brings you understanding how we can create lambda functions for function interface.
+
+63
+00:04:45,000 --> 00:04:46,000
+You so housemate's computer.
+
+64
+00:04:46,000 --> 00:04:48,000
+Perhaps MassArt is written.
+
+65
+00:04:48,000 --> 00:04:54,000
+It uses function interface as an abstraction and we can pass an implementation of the interface that
+
+66
+00:04:54,000 --> 00:04:55,000
+we want.
+
+67
+00:04:55,000 --> 00:05:02,000
+Now I want you to understand that Lambda functions and MassArt references are interchangeable by saying
+
+68
+00:05:02,000 --> 00:05:02,000
+this.
+
+69
+00:05:02,000 --> 00:05:06,000
+And that instead of LAMDA function here, we can use MassArt reference.
+
+70
+00:05:07,000 --> 00:05:13,000
+Let me show you how here in this demo class, I declare a static method that takes some integer as an
+
+71
+00:05:13,000 --> 00:05:15,000
+argument and return string.
+
+72
+00:05:15,000 --> 00:05:20,000
+It looks like this method meets the requirements of function, interface and work with Tibs that are
+
+73
+00:05:20,000 --> 00:05:23,000
+compatible with the current map key and value types.
+
+74
+00:05:24,000 --> 00:05:30,000
+If compute absent Masset need some functions that can take integer and return string, Azana will tell
+
+75
+00:05:30,000 --> 00:05:32,000
+it to use convert into string method.
+
+76
+00:05:33,000 --> 00:05:37,000
+And this line you can see that I used Masset reference to the static MASP.
+
+77
+00:05:38,000 --> 00:05:39,000
+Does it make sense?
+
+78
+00:05:39,000 --> 00:05:42,000
+Hope you understood how MassArt references work.
+
+79
+00:05:42,000 --> 00:05:43,000
+Let's move on.
+
+80
+00:05:44,000 --> 00:05:47,000
+The next thing I want to talk with you about is by function.
+
+81
+00:05:48,000 --> 00:05:50,000
+Let me open the source code of my function interface.
+
+82
+00:05:51,000 --> 00:05:54,000
+You can see that this is also functional interface.
+
+83
+00:05:54,000 --> 00:05:56,000
+That is parametrized by three types.
+
+84
+00:05:56,000 --> 00:06:00,000
+It has one abstract method that takes two arguments and returns result.
+
+85
+00:06:01,000 --> 00:06:08,000
+Now you can understand the naming convention individual function package depends on Ariki with a different
+
+86
+00:06:08,000 --> 00:06:10,000
+prefix to interface name.
+
+87
+00:06:10,000 --> 00:06:16,000
+Just to refresh your knowledge, I want to remind you what everybody is pretty is a term that is used
+
+88
+00:06:16,000 --> 00:06:21,000
+in computer science to specify a number of arguments taken by function.
+
+89
+00:06:21,000 --> 00:06:24,000
+Regular function takes one argument.
+
+90
+00:06:24,000 --> 00:06:26,000
+My function takes two arguments.
+
+91
+00:06:27,000 --> 00:06:31,000
+This prefix is widely used in Java dual function package.
+
+92
+00:06:31,000 --> 00:06:33,000
+Now you will understand what it means.
+
+93
+00:06:33,000 --> 00:06:36,000
+You can see the two arguments here and return type.
+
+94
+00:06:36,000 --> 00:06:39,000
+All of them might be of a different type.
+
+95
+00:06:39,000 --> 00:06:42,000
+Let me show you the bi functional practice.
+
+96
+00:06:42,000 --> 00:06:45,000
+Let's return to our demo file now.
+
+97
+00:06:45,000 --> 00:06:49,000
+I want to compute new value on the basis of existing key and existing value.
+
+98
+00:06:50,000 --> 00:06:52,000
+I call compute of present Masab Unmap object.
+
+99
+00:06:53,000 --> 00:07:00,000
+I suggest investigating the source code and documentation for this matter, as we can see here in documentation
+
+100
+00:07:00,000 --> 00:07:03,000
+in case value for the specified key is present.
+
+101
+00:07:03,000 --> 00:07:06,000
+And now this method will compute a new map.
+
+102
+00:07:06,000 --> 00:07:12,000
+And given the key and its current mapped value from the massive declaration, we can understand that
+
+103
+00:07:12,000 --> 00:07:18,000
+we have to pass some key to this method and by functions at this parametrized by time that is compatible
+
+104
+00:07:18,000 --> 00:07:24,000
+with the key and types that are compatible with the value based on the BI function interface.
+
+105
+00:07:24,000 --> 00:07:30,000
+We can understand that the first and the second time in Diament operator are types of the arguments
+
+106
+00:07:30,000 --> 00:07:34,000
+and the third type from Diamond Operator is a type of return value.
+
+107
+00:07:35,000 --> 00:07:40,000
+You can also understand the same after investigation of the source code of compute of present MassArt.
+
+108
+00:07:42,000 --> 00:07:49,000
+Now, let's write our own lambda expression in our demo class, take into account my function requires
+
+109
+00:07:49,000 --> 00:07:50,000
+two Masset arguments.
+
+110
+00:07:50,000 --> 00:07:56,000
+I declare two local variables here and we have to return string that will be used as a map and value
+
+111
+00:07:56,000 --> 00:07:59,000
+two key three just for the sake of the.
+
+112
+00:08:00,000 --> 00:08:05,000
+Let's create custom string values that consist of the key itself and previous value associated with
+
+113
+00:08:05,000 --> 00:08:07,000
+the key separated by column.
+
+114
+00:08:07,000 --> 00:08:12,000
+And you can see in concert that the value associated with the key three is updated.
+
+115
+00:08:12,000 --> 00:08:17,000
+I believe you already understood how to use massive reference in this situation.
+
+116
+00:08:17,000 --> 00:08:22,000
+But just in case, I also wrote an example here to reach complete understanding.
+
+117
+00:08:22,000 --> 00:08:28,000
+Here is a method that is compatible with the expected return type and type of method parameters.
+
+118
+00:08:29,000 --> 00:08:33,000
+And here you can see that I use this method as method reference instead by function here.
+
+119
+00:08:34,000 --> 00:08:40,000
+Now, when you understood what function and function are, I want to draw attention to the methods that
+
+120
+00:08:40,000 --> 00:08:40,000
+we didn't discuss.
+
+121
+00:08:41,000 --> 00:08:45,000
+Those are default methods from function and by function interfaces.
+
+122
+00:08:45,000 --> 00:08:47,000
+The way how they work are similar.
+
+123
+00:08:47,000 --> 00:08:51,000
+That's why we will review on the example with function interface.
+
+124
+00:08:51,000 --> 00:08:54,000
+Let me open again the source code of function interface.
+
+125
+00:08:54,000 --> 00:08:59,000
+Here you can see that we have default methods Campo's and and then methods.
+
+126
+00:08:59,000 --> 00:09:05,000
+These methods allow you to compose new function from existing ones to understand this.
+
+127
+00:09:05,000 --> 00:09:07,000
+Let me get back to the demo file to show you an example.
+
+128
+00:09:08,000 --> 00:09:09,000
+Consider the next case.
+
+129
+00:09:10,000 --> 00:09:13,000
+We have product type products, price and idee.
+
+130
+00:09:14,000 --> 00:09:15,000
+That is a unique product identifier.
+
+131
+00:09:16,000 --> 00:09:18,000
+We also have getters and setters declared here.
+
+132
+00:09:19,000 --> 00:09:21,000
+Besides that, I overwrite the string MassArt.
+
+133
+00:09:22,000 --> 00:09:27,000
+This will help us during the debugging when we will print product to console for the sake of the demo
+
+134
+00:09:27,000 --> 00:09:32,000
+and declared all types in one file do not switch between tops in eclipse.
+
+135
+00:09:32,000 --> 00:09:36,000
+That's why you can find this glass at the bottom of our demo file.
+
+136
+00:09:37,000 --> 00:09:43,000
+Now imagine that we have a map object that should map product against discount amount so that I could
+
+137
+00:09:43,000 --> 00:09:45,000
+get discount by product.
+
+138
+00:09:45,000 --> 00:09:51,000
+That's why my map is parametrized with product type four keys and double type four values.
+
+139
+00:09:51,000 --> 00:09:54,000
+This example is just to help you to understand the case.
+
+140
+00:09:55,000 --> 00:09:58,000
+Imagine that I have a list of products in real life.
+
+141
+00:09:58,000 --> 00:10:02,000
+I can fetch this data from the database or pass from some file.
+
+142
+00:10:03,000 --> 00:10:05,000
+Each product has its IP and price.
+
+143
+00:10:06,000 --> 00:10:09,000
+Now I have to fill out my map.
+
+144
+00:10:09,000 --> 00:10:10,000
+How I would do that.
+
+145
+00:10:11,000 --> 00:10:17,000
+I create for each loop to iterate over all products and on each iteration I compose two functions.
+
+146
+00:10:18,000 --> 00:10:21,000
+The first function just extract the price.
+
+147
+00:10:21,000 --> 00:10:23,000
+The second function calculates discount.
+
+148
+00:10:23,000 --> 00:10:27,000
+Based on this price, I use constant value for that.
+
+149
+00:10:27,000 --> 00:10:33,000
+This means five percent discount and I want to get the amount of money for my discount.
+
+150
+00:10:33,000 --> 00:10:36,000
+That's why you see multiplication here.
+
+151
+00:10:36,000 --> 00:10:39,000
+After that, I combine these two functions.
+
+152
+00:10:39,000 --> 00:10:45,000
+I combine them in the way the first function will be get the price function and the second function
+
+153
+00:10:45,000 --> 00:10:47,000
+will be a discount function.
+
+154
+00:10:48,000 --> 00:10:50,000
+Probably using that is a lot of good.
+
+155
+00:10:50,000 --> 00:10:57,000
+And you could calculate discount in one function here, but focus on the fact that you can combine two
+
+156
+00:10:57,000 --> 00:10:58,000
+functions.
+
+157
+00:10:58,000 --> 00:11:05,000
+This example is about that you can create new function on the basis of already existing functions.
+
+158
+00:11:05,000 --> 00:11:07,000
+You can make them as you wish.
+
+159
+00:11:08,000 --> 00:11:15,000
+Next time you don't get price combined with discount function, but you need to get price and for example,
+
+160
+00:11:15,000 --> 00:11:17,000
+get that function.
+
+161
+00:11:17,000 --> 00:11:20,000
+Can you understand now the benefit of function composition?
+
+162
+00:11:21,000 --> 00:11:28,000
+This gives you flexibility in combination of functions and after that I call comparative absence method
+
+163
+00:11:28,000 --> 00:11:32,000
+past the key to this method that would be product and functions.
+
+164
+00:11:32,000 --> 00:11:33,000
+It calculates the discount.
+
+165
+00:11:34,000 --> 00:11:40,000
+Let me print the map that we received to consult and here you can see that each product is mapped to
+
+166
+00:11:40,000 --> 00:11:40,000
+the discount.
+
+167
+00:11:41,000 --> 00:11:45,000
+Is it clear now when you know how and then method works?
+
+168
+00:11:45,000 --> 00:11:47,000
+Let me show you how composed Method works.
+
+169
+00:11:48,000 --> 00:11:53,000
+The only difference between these two methods is the order in which functions are combined.
+
+170
+00:11:53,000 --> 00:11:58,000
+In case I use function, then call and that method and pass another function.
+
+171
+00:11:59,000 --> 00:12:05,000
+This function will be executed after the first one and we'll take the result of the first function as
+
+172
+00:12:05,000 --> 00:12:06,000
+an input argument.
+
+173
+00:12:07,000 --> 00:12:08,000
+Does it make sense?
+
+174
+00:12:08,000 --> 00:12:14,000
+In case I use compose method, then I should specify function that should go first.
+
+175
+00:12:14,000 --> 00:12:22,000
+So technically these two functions are the same, but the orders that are used in syntax is different.
+
+176
+00:12:22,000 --> 00:12:29,000
+In my second function, I use that discount function, the call compose method and parsing its price
+
+177
+00:12:29,000 --> 00:12:30,000
+function to it.
+
+178
+00:12:30,000 --> 00:12:38,000
+That means get price function will be executed first and after that the discount function will be executed
+
+179
+00:12:38,000 --> 00:12:40,000
+with a result of get price function.
+
+180
+00:12:40,000 --> 00:12:42,000
+I hope I didn't get.
+
+181
+00:12:42,000 --> 00:12:48,000
+The future now, you know, the difference between Enza and Campo's default mascot's in function interface.
+
+182
+00:12:49,000 --> 00:12:51,000
+Let me open my function interface now.
+
+183
+00:12:52,000 --> 00:12:54,000
+Here you can see only one default method.
+
+184
+00:12:54,000 --> 00:13:00,000
+And then knowing how to create lambda function for my function interface and knowing how.
+
+185
+00:13:00,000 --> 00:13:02,000
+And then Masset works in function interface.
+
+186
+00:13:03,000 --> 00:13:07,000
+I believe you would be able to apply this method during the development when it will be needed.
+
+187
+00:13:08,000 --> 00:13:12,000
+There is also one more default method in function interface that we didn't talk through.
+
+188
+00:13:13,000 --> 00:13:17,000
+I'm talking about identity must pay attention to the source code of this message.
+
+189
+00:13:18,000 --> 00:13:20,000
+This function always returns its inputs.
+
+190
+00:13:20,000 --> 00:13:24,000
+Argument here is simple lambda expression for that.
+
+191
+00:13:24,000 --> 00:13:28,000
+But should we use this method instead of similar lambda function?
+
+192
+00:13:29,000 --> 00:13:34,000
+Yes, we should, because right in lambda expression will create an instance of function type after
+
+193
+00:13:34,000 --> 00:13:41,000
+each occurrence of lambda function, whereas column identity method you would get the always the same
+
+194
+00:13:41,000 --> 00:13:42,000
+instance of the function.
+
+195
+00:13:43,000 --> 00:13:49,000
+So using function identity instead of this lambda function might save you some memory, but that shouldn't
+
+196
+00:13:49,000 --> 00:13:51,000
+drive your decision.
+
+197
+00:13:51,000 --> 00:13:56,000
+If you really think that lambda function is more readable than function identity, I would love to show
+
+198
+00:13:56,000 --> 00:14:01,000
+you the example of this method and tell you where and when you can apply this method.
+
+199
+00:14:01,000 --> 00:14:05,000
+But we need knowledge of Stream API to understand the example.
+
+200
+00:14:05,000 --> 00:14:12,000
+Basically, we use this method only when we are forced to pass function, but we don't need to modify
+
+201
+00:14:12,000 --> 00:14:12,000
+inputs.
+
+202
+00:14:12,000 --> 00:14:16,000
+Argument you will face with such cases while working with stream API.
+
+203
+00:14:17,000 --> 00:14:18,000
+Don't worry.
+
+204
+00:14:18,000 --> 00:14:21,000
+In the lessons about Stream API, we'll talk about this method.
+
+205
+00:14:22,000 --> 00:14:27,000
+And the last but not least examples that I wanted to share with you today is how to create comparator
+
+206
+00:14:27,000 --> 00:14:28,000
+with helper function.
+
+207
+00:14:29,000 --> 00:14:31,000
+Let me open compared the interface.
+
+208
+00:14:31,000 --> 00:14:36,000
+And if you remember, the computer interface has a lot of default methods.
+
+209
+00:14:36,000 --> 00:14:39,000
+Some of them use function interface.
+
+210
+00:14:39,000 --> 00:14:45,000
+I'm going to show you one example that will give you understand how you can use the rest of the methods
+
+211
+00:14:45,000 --> 00:14:46,000
+that they function as an argument.
+
+212
+00:14:47,000 --> 00:14:51,000
+Here we have really cool method that most likely you will use.
+
+213
+00:14:51,000 --> 00:14:57,000
+It is called comparing it grades compare to on the basis of the function that extracts the comparable
+
+214
+00:14:57,000 --> 00:15:02,000
+key that should be used to sort by to help you understand uses.
+
+215
+00:15:02,000 --> 00:15:04,000
+Let me show you an example how this works.
+
+216
+00:15:05,000 --> 00:15:11,000
+Today we created a list of products and if you remember that, imagine that I want to short list by
+
+217
+00:15:11,000 --> 00:15:11,000
+its price.
+
+218
+00:15:12,000 --> 00:15:15,000
+That's why I call sort Masset on my list.
+
+219
+00:15:15,000 --> 00:15:17,000
+I have to pass Comparator here.
+
+220
+00:15:18,000 --> 00:15:21,000
+I don't need to create a concrete class of comparator type.
+
+221
+00:15:22,000 --> 00:15:26,000
+I also don't need to implement comparable interface in my product type.
+
+222
+00:15:27,000 --> 00:15:32,000
+I can just pass the function that can extract the field that should be used during the sorting.
+
+223
+00:15:32,000 --> 00:15:34,000
+And I already have this function.
+
+224
+00:15:35,000 --> 00:15:38,000
+Let me pass the message reference together in my product class.
+
+225
+00:15:39,000 --> 00:15:44,000
+This guy knows how to retrieve price from each product taken into account.
+
+226
+00:15:44,000 --> 00:15:48,000
+I have a list of products here and I don't have it in the file for product.
+
+227
+00:15:49,000 --> 00:15:56,000
+I can use a class name to make a reference to Macit Compiler is smart enough to understand that this
+
+228
+00:15:56,000 --> 00:15:57,000
+method should be called on.
+
+229
+00:15:57,000 --> 00:16:02,000
+Each object from this list to extract K double is comparable type.
+
+230
+00:16:03,000 --> 00:16:06,000
+That's why certain will be performed without any issues.
+
+231
+00:16:07,000 --> 00:16:10,000
+And here is an analogy written with the help of Lambda function.
+
+232
+00:16:10,000 --> 00:16:13,000
+These two lines are similar in console.
+
+233
+00:16:13,000 --> 00:16:18,000
+We can see that when I print at least all elements assaulted by price.
+
+234
+00:16:18,000 --> 00:16:22,000
+So now you know how to create a comparator by using function.
+
+235
+00:16:22,000 --> 00:16:26,000
+That's all examples that I wanted to discuss with you in this lesson.
+
+236
+00:16:26,000 --> 00:16:28,000
+Let's recap what we have learned today.
+
+237
+00:16:29,000 --> 00:16:32,000
+Today we learned what function and function interfaces are.
+
+238
+00:16:33,000 --> 00:16:38,000
+We learned what methods they have, and we know how to create lambda functions and Masset references
+
+239
+00:16:38,000 --> 00:16:40,000
+for these interfaces.
+
+240
+00:16:40,000 --> 00:16:43,000
+We learn how and then and compose methods work.
+
+241
+00:16:44,000 --> 00:16:47,000
+Now, you know the difference between these two methods.
+
+242
+00:16:47,000 --> 00:16:54,000
+I believe after this lesson, you also know how identity method works in function interface and also
+
+243
+00:16:54,000 --> 00:16:55,000
+today had a lot of practice.
+
+244
+00:16:55,000 --> 00:17:01,000
+And in real life example, we learned how we can use function and by function during the work with MAP
+
+245
+00:17:01,000 --> 00:17:02,000
+implementations.
+
+246
+00:17:03,000 --> 00:17:07,000
+At the end of the lesson, you saw how to create Comparator with the help of a function.
+
+247
+00:17:08,000 --> 00:17:10,000
+That's all what I have for you for today.
+
+248
+00:17:10,000 --> 00:17:12,000
+Thanks a lot for your attention.
+
+249
+00:17:12,000 --> 00:17:15,000
+Have a great day and see you in the next lesson.
+
diff --git a/22 - Functional Programming in Java (including lambda functions & method references)/003 Source-code-All-examples-from-the-lecture.url b/22 - Functional Programming in Java (including lambda functions & method references)/003 Source-code-All-examples-from-the-lecture.url
new file mode 100644
index 0000000000000000000000000000000000000000..c13dde21d8eb793bfe9fbabe952d7851d8d06a81
--- /dev/null
+++ b/22 - Functional Programming in Java (including lambda functions & method references)/003 Source-code-All-examples-from-the-lecture.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/functions/functionandbifunction
\ No newline at end of file
diff --git a/22 - Functional Programming in Java (including lambda functions & method references)/004 Consumer, BiConsumer, Predicate & BiPredicate_en.srt b/22 - Functional Programming in Java (including lambda functions & method references)/004 Consumer, BiConsumer, Predicate & BiPredicate_en.srt
new file mode 100644
index 0000000000000000000000000000000000000000..4c652f3649d4b563f63ff09ee2e9da7e68df106a
--- /dev/null
+++ b/22 - Functional Programming in Java (including lambda functions & method references)/004 Consumer, BiConsumer, Predicate & BiPredicate_en.srt
@@ -0,0 +1,932 @@
+1
+00:00:06,000 --> 00:00:06,000
+Hello.
+
+2
+00:00:06,000 --> 00:00:12,000
+Students, in this lesson, we're going to learn what consumer by consumer product and by product interfaces
+
+3
+00:00:12,000 --> 00:00:13,000
+are as usual.
+
+4
+00:00:13,000 --> 00:00:17,000
+We'll start from an investigation of a source code of all interfaces.
+
+5
+00:00:17,000 --> 00:00:20,000
+We'll review all matters that are defined there.
+
+6
+00:00:20,000 --> 00:00:26,000
+One real example will show you how you can use these types and how to implement LAMDA functions and
+
+7
+00:00:26,000 --> 00:00:31,000
+methods, references to implement consumer by consumer product and by product types.
+
+8
+00:00:32,000 --> 00:00:34,000
+After that, we'll talk about two other types.
+
+9
+00:00:35,000 --> 00:00:39,000
+We are also going to default and static methods from these interfaces.
+
+10
+00:00:39,000 --> 00:00:41,000
+We have a lot of things to learn today.
+
+11
+00:00:42,000 --> 00:00:42,000
+Let's start.
+
+12
+00:00:43,000 --> 00:00:48,000
+The best way to learn this topic is to investigate the source code and the real examples.
+
+13
+00:00:48,000 --> 00:00:53,000
+I suggest starting our lesson today from the overview of consumer interface source code.
+
+14
+00:00:53,000 --> 00:00:59,000
+As you can see, similar to other types declared in Geritol function package consumer is a functional
+
+15
+00:00:59,000 --> 00:01:06,000
+interface that has one abstract method with a name, except it takes some argument and returns nothing.
+
+16
+00:01:06,000 --> 00:01:12,000
+So this type exists to perform an operation on the given argument, unlike other functions.
+
+17
+00:01:12,000 --> 00:01:15,000
+This type of function usually produces side effect.
+
+18
+00:01:15,000 --> 00:01:17,000
+I'm talking about that.
+
+19
+00:01:17,000 --> 00:01:22,000
+The reason to use this type is to modify the state of the argument and create a function for that.
+
+20
+00:01:23,000 --> 00:01:25,000
+This interface also has one default method.
+
+21
+00:01:25,000 --> 00:01:31,000
+This is and then Masset, in the previous lesson we learned how we can use and then MassArt to compose
+
+22
+00:01:31,000 --> 00:01:34,000
+new function on the basis of two other functions.
+
+23
+00:01:35,000 --> 00:01:37,000
+It works the same way with consumer.
+
+24
+00:01:37,000 --> 00:01:40,000
+That's why it will not pay a lot of attention to this method.
+
+25
+00:01:40,000 --> 00:01:46,000
+Take into account we reviewed it in previous lesson, but instead I will show you examples of consumer
+
+26
+00:01:46,000 --> 00:01:47,000
+unpracticed.
+
+27
+00:01:47,000 --> 00:01:52,000
+I prepared real life example for you that will help you to grasp new knowledge faster.
+
+28
+00:01:52,000 --> 00:01:55,000
+I will leave the link to this file in the lesson attachments.
+
+29
+00:01:56,000 --> 00:01:58,000
+Imagine that you have a list of products.
+
+30
+00:01:58,000 --> 00:02:01,000
+This is product type that we used for some of the home tasks.
+
+31
+00:02:01,000 --> 00:02:07,000
+While we are in collections, let me remind you how it looks like this typesetters contract that allows
+
+32
+00:02:07,000 --> 00:02:13,000
+us to retrieve Idy product, name, category, name of each product and set price if needed.
+
+33
+00:02:14,000 --> 00:02:20,000
+In our example, we will use default product type that implements product interface NASSAN special in
+
+34
+00:02:20,000 --> 00:02:21,000
+the source code of default.
+
+35
+00:02:21,000 --> 00:02:24,000
+Product type just data was getters and setters.
+
+36
+00:02:25,000 --> 00:02:26,000
+And our example.
+
+37
+00:02:26,000 --> 00:02:27,000
+I created a few test products.
+
+38
+00:02:28,000 --> 00:02:32,000
+I passed the constructor iji product name, category, name and price.
+
+39
+00:02:32,000 --> 00:02:34,000
+Hobbs's is clear for you.
+
+40
+00:02:35,000 --> 00:02:40,000
+Now imagine that I want to give possibility for administrator to increase price of products.
+
+41
+00:02:40,000 --> 00:02:43,000
+For example, administrator could select the specific products.
+
+42
+00:02:44,000 --> 00:02:50,000
+Those products will be grouped in the least object on the backend and price will be increased for each
+
+43
+00:02:50,000 --> 00:02:53,000
+product from this list by amount of money set by admin.
+
+44
+00:02:54,000 --> 00:03:00,000
+Here, a graded method increase price for product list that takes as arguments and list of products
+
+45
+00:03:00,000 --> 00:03:04,000
+and specific amount of dollars to increase price and a massive body attack.
+
+46
+00:03:05,000 --> 00:03:08,000
+Iterator of my product list and call for each method.
+
+47
+00:03:08,000 --> 00:03:12,000
+Let me open the source code of this method to explore it together with you.
+
+48
+00:03:13,000 --> 00:03:17,000
+As you can see, this is the default method declared in iterator type.
+
+49
+00:03:18,000 --> 00:03:21,000
+It takes consumer as an argument in simple words.
+
+50
+00:03:21,000 --> 00:03:23,000
+It takes some actions.
+
+51
+00:03:23,000 --> 00:03:27,000
+It has to be performed with each element remained in this iterator.
+
+52
+00:03:28,000 --> 00:03:34,000
+You can see that we have while loop here and accept method of consumer is invoked for each element from
+
+53
+00:03:34,000 --> 00:03:35,000
+this iterator.
+
+54
+00:03:35,000 --> 00:03:41,000
+Now let's get back to our demo file and we will implement lambda function for our consumer.
+
+55
+00:03:41,000 --> 00:03:46,000
+Here you can see the anonymous function that takes one argument and that returns nassan.
+
+56
+00:03:47,000 --> 00:03:54,000
+I call set price Masset on each product and set the result of radiation of current price and local variables
+
+57
+00:03:54,000 --> 00:03:56,000
+that passed to the Massett.
+
+58
+00:03:56,000 --> 00:03:57,000
+And then my program.
+
+59
+00:03:57,000 --> 00:04:03,000
+I can call this method and pass the list of products an amount of money to increase price.
+
+60
+00:04:03,000 --> 00:04:07,000
+After that, let me print each product from the new line.
+
+61
+00:04:07,000 --> 00:04:09,000
+I ran the program here.
+
+62
+00:04:09,000 --> 00:04:14,000
+You can see in console output that price is increased by ten dollars for each product.
+
+63
+00:04:15,000 --> 00:04:21,000
+Can you understand now how we modified state for all products in connection with the help of consumer
+
+64
+00:04:21,000 --> 00:04:23,000
+that we passed two for each remaining MassArt?
+
+65
+00:04:24,000 --> 00:04:30,000
+Hope it makes sense, by the way, I believe from the previous Lasley already understood that this lambda
+
+66
+00:04:30,000 --> 00:04:33,000
+function is interchangeable with MassArt reference.
+
+67
+00:04:33,000 --> 00:04:36,000
+Please let me know in case there are any questions.
+
+68
+00:04:37,000 --> 00:04:41,000
+When you understood how consumer works, let me show you how my consumer works.
+
+69
+00:04:41,000 --> 00:04:45,000
+I open source code of BI consumer interface.
+
+70
+00:04:45,000 --> 00:04:51,000
+We learned with you specifics of naming convention individual function package during the previous lesson.
+
+71
+00:04:51,000 --> 00:04:58,000
+Now you can understand that this by prefix is associated with the Arati of accept function.
+
+72
+00:04:58,000 --> 00:05:02,000
+You can see that accept takes two arguments and returns nassan.
+
+73
+00:05:03,000 --> 00:05:09,000
+This interface also declares one default Masset, and then that is similar to other interfaces from
+
+74
+00:05:09,000 --> 00:05:14,000
+this package to compose new functions on the basis of already existing functions.
+
+75
+00:05:15,000 --> 00:05:19,000
+Now, I want to get back to our demo file to show you an example for our next demo.
+
+76
+00:05:19,000 --> 00:05:22,000
+I created an object of type hash map.
+
+77
+00:05:22,000 --> 00:05:27,000
+It is parametrized by integer and product type imagines a similar case.
+
+78
+00:05:27,000 --> 00:05:34,000
+I have product ideas that are mapped against the products and I want to have opportunity to update each
+
+79
+00:05:34,000 --> 00:05:36,000
+entry in map for that purpose.
+
+80
+00:05:36,000 --> 00:05:43,000
+I have created increased price for product map method, the text map of ideas and products and price
+
+81
+00:05:43,000 --> 00:05:44,000
+to increase.
+
+82
+00:05:44,000 --> 00:05:49,000
+Here you can see that I call for each method on my map object and pass by consumers there.
+
+83
+00:05:50,000 --> 00:05:53,000
+Here's lambda function that takes two arguments and returns.
+
+84
+00:05:53,000 --> 00:05:58,000
+Nassan, in case I don't need to modify key, I just ignore it.
+
+85
+00:05:58,000 --> 00:06:02,000
+And you can see the body of this function is similar to the previous one.
+
+86
+00:06:03,000 --> 00:06:07,000
+The only difference here is that I have access to the key in case I need it.
+
+87
+00:06:08,000 --> 00:06:13,000
+Now, in my program I can call the method and parse, map, object and price to increase.
+
+88
+00:06:14,000 --> 00:06:19,000
+After that we print each product from new line in console and then cancel output.
+
+89
+00:06:19,000 --> 00:06:25,000
+You can see that price is increased knowing the difference between consumer and by consumer.
+
+90
+00:06:25,000 --> 00:06:28,000
+You can use either of these types during the development.
+
+91
+00:06:29,000 --> 00:06:34,000
+Also, you saw how to investigate the matter signature to understand what type is expected.
+
+92
+00:06:35,000 --> 00:06:41,000
+Usually it is obvious what will be passed to the function as arguments, but in case it is not clear,
+
+93
+00:06:41,000 --> 00:06:45,000
+you can investigate the source code of matter that requires function.
+
+94
+00:06:46,000 --> 00:06:52,000
+One of the goals of this course is not to teach you all possible things, but to teach you how you can
+
+95
+00:06:52,000 --> 00:06:54,000
+learn these things by yourself.
+
+96
+00:06:54,000 --> 00:06:59,000
+Let me show you how you can understand what values will be passed to the anonymous function during the
+
+97
+00:06:59,000 --> 00:07:00,000
+runtime.
+
+98
+00:07:00,000 --> 00:07:05,000
+For example, I open the source code for each method in map type.
+
+99
+00:07:05,000 --> 00:07:11,000
+The first thing I want to know is where access method is invoked on the buy consumer argument.
+
+100
+00:07:12,000 --> 00:07:17,000
+Here is MassArt invocation and I see that K and V variables are passed.
+
+101
+00:07:17,000 --> 00:07:23,000
+But what object stands behind K and V variable based on the variables name?
+
+102
+00:07:23,000 --> 00:07:26,000
+It is clear what key and value are referencing to.
+
+103
+00:07:26,000 --> 00:07:32,000
+But just in case we can check it, few lines above we can see that K variable is initialized with key
+
+104
+00:07:32,000 --> 00:07:37,000
+value on each iteration and variable is initialized with the mapped value.
+
+105
+00:07:38,000 --> 00:07:41,000
+You can see that operation is performed for each entry.
+
+106
+00:07:41,000 --> 00:07:45,000
+That's how you can easily understand what values will be passed to the function.
+
+107
+00:07:46,000 --> 00:07:52,000
+OK, now when we learned consumer and by consumer types, I want to learn with your predicate and by
+
+108
+00:07:52,000 --> 00:07:53,000
+predicate types.
+
+109
+00:07:53,000 --> 00:07:58,000
+I believe that knowledge of Lambda functions and Massata references will help us to learn predicate
+
+110
+00:07:58,000 --> 00:07:59,000
+type faster.
+
+111
+00:08:00,000 --> 00:08:03,000
+Let me open the source code of Predicate Interface.
+
+112
+00:08:03,000 --> 00:08:06,000
+Prickett has one abstract method with the name test.
+
+113
+00:08:07,000 --> 00:08:09,000
+This method takes an argument and returns.
+
+114
+00:08:09,000 --> 00:08:13,000
+Boolean value is a true or false in stream API.
+
+115
+00:08:13,000 --> 00:08:16,000
+Predicates are used very often to filter values and remove elements.
+
+116
+00:08:16,000 --> 00:08:20,000
+For example, to help you understand how it works.
+
+117
+00:08:20,000 --> 00:08:22,000
+Let me show you a simple example.
+
+118
+00:08:22,000 --> 00:08:25,000
+For pre-cut example, I created a separate file.
+
+119
+00:08:25,000 --> 00:08:28,000
+I will also leave link to this file in attachments.
+
+120
+00:08:28,000 --> 00:08:28,000
+Does lesson.
+
+121
+00:08:29,000 --> 00:08:31,000
+Imagine that you have a list of products here.
+
+122
+00:08:31,000 --> 00:08:37,000
+You can see product list that are similar to one we have in consumer demo file and we have to remove
+
+123
+00:08:37,000 --> 00:08:44,000
+all products from this list that have price more than you specified to this requirement I created to
+
+124
+00:08:44,000 --> 00:08:47,000
+remove products if prices more than Massett.
+
+125
+00:08:47,000 --> 00:08:54,000
+That takes a list of products and price as arguments on my list object I call remove if MassArt let
+
+126
+00:08:54,000 --> 00:08:55,000
+me open source code of this method.
+
+127
+00:08:56,000 --> 00:09:02,000
+As you can see, this method is from collection interface and it takes Birckhead as an argument.
+
+128
+00:09:03,000 --> 00:09:09,000
+Test method will be invoked for each element in this list and in case that Masset will return true,
+
+129
+00:09:10,000 --> 00:09:12,000
+then this element will be removed.
+
+130
+00:09:12,000 --> 00:09:18,000
+Based on this, we can make a conclusion that we need to write a function that will return true for
+
+131
+00:09:18,000 --> 00:09:20,000
+elements that must be removed.
+
+132
+00:09:21,000 --> 00:09:24,000
+Is it clear now let's get back to our demo file.
+
+133
+00:09:25,000 --> 00:09:27,000
+I wrote function here as it returns.
+
+134
+00:09:27,000 --> 00:09:32,000
+True, in case product price is more than price value that was passed to this method.
+
+135
+00:09:32,000 --> 00:09:38,000
+And in my program I call the new method and pass list of products and one hundred.
+
+136
+00:09:38,000 --> 00:09:43,000
+That means that all products that have price more than one hundred will be removed.
+
+137
+00:09:43,000 --> 00:09:47,000
+We can see that I have only one product with price more than one hundred.
+
+138
+00:09:48,000 --> 00:09:54,000
+That's why when I print all product to console from the new line here, I still expect to see the rest
+
+139
+00:09:54,000 --> 00:09:55,000
+two products.
+
+140
+00:09:55,000 --> 00:09:58,000
+Let me run the program by some console output.
+
+141
+00:09:58,000 --> 00:10:02,000
+We can make a conclusion that product with price more than one hundred.
+
+142
+00:10:02,000 --> 00:10:04,000
+Was removed from my list.
+
+143
+00:10:04,000 --> 00:10:05,000
+Awesome.
+
+144
+00:10:06,000 --> 00:10:13,000
+Now let's investigate the default and static methods from project interface it has and method that allows
+
+145
+00:10:13,000 --> 00:10:16,000
+us to compose two functions and add additional predicate.
+
+146
+00:10:17,000 --> 00:10:23,000
+This gives us a similar flexibility that we learned in lesson about functions when we combine different
+
+147
+00:10:23,000 --> 00:10:24,000
+functions.
+
+148
+00:10:24,000 --> 00:10:27,000
+Let me show you the next example in the source code.
+
+149
+00:10:28,000 --> 00:10:33,000
+Imagine that I need to remove all products that have price more than some specific value and category
+
+150
+00:10:33,000 --> 00:10:38,000
+name is Category one and create a Masset where I create two functions.
+
+151
+00:10:38,000 --> 00:10:41,000
+The first one is already familiar to you.
+
+152
+00:10:41,000 --> 00:10:47,000
+That function is to test the price and the second function checks category.
+
+153
+00:10:47,000 --> 00:10:54,000
+And when I call remove if MassArt, I create the new function that is returned as a result of and Masset
+
+154
+00:10:54,000 --> 00:10:55,000
+invocation.
+
+155
+00:10:56,000 --> 00:11:04,000
+I combine these two predicates now aliment will be removed only in case requirements of two predicates
+
+156
+00:11:04,000 --> 00:11:05,000
+will be met.
+
+157
+00:11:05,000 --> 00:11:10,000
+In my program I pass list of products, price and category one name.
+
+158
+00:11:11,000 --> 00:11:17,000
+Based on the current state of my product list, I can see that only one product will be removed after
+
+159
+00:11:17,000 --> 00:11:24,000
+the Macit invocation product with i.e. one has price more than 90 and category name is equal to category
+
+160
+00:11:24,000 --> 00:11:25,000
+one.
+
+161
+00:11:25,000 --> 00:11:30,000
+And in console output you can see that the product was a new one was removed.
+
+162
+00:11:30,000 --> 00:11:36,000
+And I want you to understand that you're going to compose multiple predicates together, not only to
+
+163
+00:11:36,000 --> 00:11:38,000
+but even more if you need.
+
+164
+00:11:38,000 --> 00:11:44,000
+That will allow you to create customized predicates, one that will be needed in case we want to compose
+
+165
+00:11:44,000 --> 00:11:47,000
+predicates to receive predicate that will return.
+
+166
+00:11:47,000 --> 00:11:54,000
+True, in case we meet the requirements of at least one predicate of combined ones that we need to use
+
+167
+00:11:54,000 --> 00:11:57,000
+default or method from predicate interface.
+
+168
+00:11:58,000 --> 00:12:02,000
+I believe that is logical and clear and does not require any additional demo.
+
+169
+00:12:03,000 --> 00:12:09,000
+The next default method and predicate interface is negate it returns logical negation of the current
+
+170
+00:12:09,000 --> 00:12:10,000
+predicate.
+
+171
+00:12:10,000 --> 00:12:11,000
+Is it clear?
+
+172
+00:12:12,000 --> 00:12:13,000
+Let me show you this on example.
+
+173
+00:12:14,000 --> 00:12:20,000
+In case in our previous example I would call Negate Masset, the result would be opposite.
+
+174
+00:12:20,000 --> 00:12:27,000
+That means in case this function returns true, as a result, the force will be returned after negation.
+
+175
+00:12:28,000 --> 00:12:32,000
+Let me call negate method here and run program one more time.
+
+176
+00:12:32,000 --> 00:12:37,000
+And in console output you can see that product with ADC was removed.
+
+177
+00:12:37,000 --> 00:12:44,000
+So the product that is less than 90 and the product that has category names that is not equal to Category
+
+178
+00:12:44,000 --> 00:12:45,000
+one was removed.
+
+179
+00:12:45,000 --> 00:12:48,000
+Can you understand now what it is?
+
+180
+00:12:48,000 --> 00:12:50,000
+If yes, then let's proceed.
+
+181
+00:12:51,000 --> 00:12:53,000
+We have two more static methods.
+
+182
+00:12:53,000 --> 00:12:54,000
+Here is equal.
+
+183
+00:12:54,000 --> 00:13:00,000
+MassArt returns use a predicate that will check if two arguments are equal to make sure that predicate
+
+184
+00:13:00,000 --> 00:13:07,000
+will work as expected, we need to check that equal Masset in the type that we want to use for comparison
+
+185
+00:13:07,000 --> 00:13:08,000
+is overeaten.
+
+186
+00:13:08,000 --> 00:13:15,000
+This is needed because for comparison will be used objects equal MassArt and the second method is not.
+
+187
+00:13:16,000 --> 00:13:18,000
+That takes expected as an argument.
+
+188
+00:13:18,000 --> 00:13:21,000
+This method negates the result of the supplied predicate.
+
+189
+00:13:22,000 --> 00:13:26,000
+You can see that this is achieved by using the call of Landgate method inside.
+
+190
+00:13:27,000 --> 00:13:32,000
+So technically you can use is an agreed method in case you have variable of type predicate.
+
+191
+00:13:32,000 --> 00:13:38,000
+Like I showed you an example, one in case you don't have variable of type predicate you can call predicate,
+
+192
+00:13:38,000 --> 00:13:40,000
+not method and pos lambda function.
+
+193
+00:13:40,000 --> 00:13:47,000
+Here to help you understand these two masses, let me show you an example in our perfect demo file.
+
+194
+00:13:47,000 --> 00:13:50,000
+We have one more example at the bottom here.
+
+195
+00:13:50,000 --> 00:13:57,000
+Imagine that we have a list of users I use user for hash tables type that implements user interface.
+
+196
+00:13:57,000 --> 00:14:02,000
+I use exactly Zeze implementation because it as equals Masset overridden.
+
+197
+00:14:02,000 --> 00:14:04,000
+We added a few users to the list.
+
+198
+00:14:04,000 --> 00:14:09,000
+You can see user i.e. first name, last name, password and email.
+
+199
+00:14:10,000 --> 00:14:11,000
+That's just for the sake of example.
+
+200
+00:14:12,000 --> 00:14:17,000
+And according to business requirements, I have to be able to filter the list of users to leave their
+
+201
+00:14:17,000 --> 00:14:19,000
+only user that I need here.
+
+202
+00:14:19,000 --> 00:14:22,000
+I created a user object that will be used during filtering.
+
+203
+00:14:23,000 --> 00:14:28,000
+I call remove if MassArt on my list of users and I call Predicate is equal method here.
+
+204
+00:14:29,000 --> 00:14:35,000
+But in case I would call just this method, I will get protocols that will remove only user that equals
+
+205
+00:14:35,000 --> 00:14:35,000
+to this one.
+
+206
+00:14:36,000 --> 00:14:38,000
+I need exactly the opposite.
+
+207
+00:14:38,000 --> 00:14:41,000
+I need to keep only this user.
+
+208
+00:14:41,000 --> 00:14:44,000
+That's why I have to use negation here.
+
+209
+00:14:44,000 --> 00:14:51,000
+And technically I could call negate method here, but also I can pass this packet to static method not
+
+210
+00:14:51,000 --> 00:14:52,000
+is it clear.
+
+211
+00:14:53,000 --> 00:14:59,000
+And when I print the list of users to cancel, I see that I have only users that I wanted to keep in
+
+212
+00:14:59,000 --> 00:15:02,000
+the list also now you know.
+
+213
+00:15:02,000 --> 00:15:08,000
+All matters from PAGAD interface and the very last things that I wanted to discuss with you is my predicate
+
+214
+00:15:08,000 --> 00:15:09,000
+interface.
+
+215
+00:15:09,000 --> 00:15:12,000
+I believe you already understood how pre-cut works.
+
+216
+00:15:12,000 --> 00:15:16,000
+The only difference is that test Masset takes.
+
+217
+00:15:16,000 --> 00:15:20,000
+Two arguments here will use this method when we all stream API.
+
+218
+00:15:21,000 --> 00:15:27,000
+But the principle of writing and using by predicate is similar to examples that we saw with predicate
+
+219
+00:15:28,000 --> 00:15:28,000
+beside.
+
+220
+00:15:28,000 --> 00:15:37,000
+One abstract matter of this interface also has three more default methods Ziya and negate and or methods.
+
+221
+00:15:37,000 --> 00:15:41,000
+We have just reviewed similar message from pre-record interface.
+
+222
+00:15:41,000 --> 00:15:45,000
+That's why I think that there is no need to review examples with these methods.
+
+223
+00:15:46,000 --> 00:15:48,000
+But let me know in case you have any questions.
+
+224
+00:15:49,000 --> 00:15:51,000
+That's all what I wanted to share with you today.
+
+225
+00:15:52,000 --> 00:15:54,000
+Now let's recap what we have learned today.
+
+226
+00:15:55,000 --> 00:16:01,000
+Today we learned with your consumer and by consumer interfaces and real examples, you saw how you can
+
+227
+00:16:01,000 --> 00:16:03,000
+create LAMDA functions for these types.
+
+228
+00:16:04,000 --> 00:16:07,000
+After that, we learned precut interface nuance.
+
+229
+00:16:07,000 --> 00:16:12,000
+All mascot's from pre-record interface and had practice exercises with this type.
+
+230
+00:16:12,000 --> 00:16:16,000
+And at the end of the lesson we talked about biproduct interface.
+
+231
+00:16:17,000 --> 00:16:18,000
+That's all for this lesson.
+
+232
+00:16:19,000 --> 00:16:20,000
+Thanks a lot for your attention.
+
+233
+00:16:20,000 --> 00:16:22,000
+See you in the next lesson.
+
diff --git a/22 - Functional Programming in Java (including lambda functions & method references)/004 Homework.url b/22 - Functional Programming in Java (including lambda functions & method references)/004 Homework.url
new file mode 100644
index 0000000000000000000000000000000000000000..4a19a64791e3bba6d05971d4ca432c02d7a75d31
--- /dev/null
+++ b/22 - Functional Programming in Java (including lambda functions & method references)/004 Homework.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://docs.google.com/document/d/1hMA300MS2UJhRDfh5VUviGrGiQzfsV5rReH5KTwDdvc/edit?usp=sharing
\ No newline at end of file
diff --git a/22 - Functional Programming in Java (including lambda functions & method references)/004 Solution-for-Homework.url b/22 - Functional Programming in Java (including lambda functions & method references)/004 Solution-for-Homework.url
new file mode 100644
index 0000000000000000000000000000000000000000..f6e49e21901c33c83713570226c7d177c66c7168
--- /dev/null
+++ b/22 - Functional Programming in Java (including lambda functions & method references)/004 Solution-for-Homework.url
@@ -0,0 +1,2 @@
+[InternetShortcut]
+URL=https://github.com/AndriiPiatakha/learnit_java_core/tree/master/src/com/itbulls/learnit/javacore/functions/hw
\ No newline at end of file