File size: 21,733 Bytes
2e5dac7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
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.