Hi there they're not let's look at maps which support the softening capability just like in the case 2
of collection hierarchy where you have a socket set unnavigable set. 3
We also have sorted map unnavigable map within the map hierarchy. 4
In this lesson we will also look at tree map which implements the navigable map and we already know 5
that Chrisette in Donelly uses Prema since we are to discuss the map interface on the hash map class 6
and we have also seen the trees of glass things that we discussed in this lesson should be very familiar 7
in case you skipped map hash map or sort that set on preset. 8
Then I would strongly suggest you take a look at them before you get started with this lesson. 9
Let's begin with Sogard map Sogard map allows sorting of mappings based on peace on this sorting can 10
be either druken nature or auditing of the East or due to competitor which is provided during the creation 11
of map. 12
When the natural ordering of East it means that keys would implement the comparable interface. 13
So the compatible and competitor interfaces which were discussed in the precept lesson also apply here 14
as tree search is based on tree map unhinges disordered map definition. 15
It implements the map interface and we can see that the methods are very similar to the ones we saw 16
in sockets. 17
In short it said it was all about elements. 18
But here we are dealing with these in place of subset headset or DeLaet methods. 19
Here we have some Map Head map on a map. 20
The parameters are keys on all three of them written a stigma which is backed by the original map. 21
Also note that these methods are specific to succored map and we did not see such kinds of methods in 22
Hashomer. 23
That's because there is no specific ordering in Hushmail as it is based on a hash function. 24
So defining a method like subtype does not make sense with Hashima but it's not a map. 25
There is an ordering and hence we can get specifics about maps. 26
Next we have fusty and Laski methods Vittert and the Huskey and the Laskey from the socket mapping in 27
socket set the corresponding methods were simply first and last. 28
Like in the case of socket set we also have a competitor method which returns a competitor if there 29
is one. 30
Otherwise and none is return implying that a natural ordering is just the last three minutes or collection 31
methods and they were discussed when we looked at the map interface keyset method will return the set 32
of all these ordered according to the sorting criteria. 33
Similarly the values that were read in the collection of values in the socket map on the order of I 34
use is dependent on the corresponding keys. 35
Recall that this method returns a collection rather than a set as values can how duplicate is undefined 36
and method returns the set of all the mappings in the socket. 37
And of course there are also socket Viki's that each mapping is an instance of the entry interface which 38
is a nested interface defined within the map interface. 39
Finally recalled that all three of these collection methods are also backed by the original model. 40
So we know that any changes made in that or return view will be reflected in the original map and vice 41
versa. 42
How all of the written rules are collections rather than maps. 43
So things can only be if we move using them. 44
So things can only be deleted using them for instance in case of the collection which is returned by 45
the block use method if you remove a particular value then the corresponding mapping will be remote 46
from the original map. 47
But as we can see there is no way to either mapping through any of them as data collection of elements 48
rather than collection of mappings. 49
Even the secretary and preset method does not permit our operations. 50
And if you try to add something then it will throw an unsupported operation exception next just navigable 51
map which extends the slaughtered map. 52
And we have seen it's analog navigable set which included navigation networks that were broke on a given 53
search target. 54
Unnavigable said we have seen methods like lower floor ceiling and higher. 55
And here we have met that slightly lower key floor ceiling D and hierarchy all of which take a search 56
target ungrouped and the closest matching t and we already know the semantics of these matters. 57
Similarly we also have slight variations of these methods like the lower entry floor and ceiling entry 58
on higher entry methods and all of them make a key a search target under and the closest matching entry 59
. 60
Next we have descending keyset method Vittert instead of the worst view of the keys in the sorted map 61
. 62
And it is written as unnavigable said. 63
Recall that in navigable set glass there was a similar method called descending set next month there 64
is descending map Richard and said a reverse view of this map. 65
Next we help bald faced angry unpleasantry visually more underdone the first unlost and Drees respectively 66
. 67
Inapplicable said we had both the first and last. 68
Finally there are also few range it's like in the case of navigable set which include a boolean parameter 69
all inclusive. 70
Here you have the head map method and if he pass true as argument value for the inclusion parameter 71
then this method would return a head map whose D's are less than or equal to that to keep it ometer 72
what other variations. 73
You can take a look at the API so that supports sorted map unnavigable map. 74
Let's head over to Ed.. 75
I do a very quick them off Prema. 76
It's going to be a very quick. 77
Them all as we. 78
Most of the math related methods in our hash map them up and we also look at the sorting related methods 79
in our trees or them. 80
OK just not a tree map implements the navigable map unexposed operation such as contains the get put 81
under remote that logarithmic time complexity. 82
If you recall it was mentioned during our discussion on Chrisette. 83
OK so it would be Lagat MacBain complexity for such kind of methods are. 84
I'd Andri moment that's good. 85
So here we have a new method called remap them all within the map to more class and we are just going 86
to do a very quick DM all it. 87
The initial code has been just copied from the hash map them omitted from here and here and we just 88
have three users here. 89
We are creating an instance of tree map and we are inserting 3 users John-Roger on it along with their 90
ages and we are simply printing them here. 91
And also we are reading through the map and we are printing the corresponding Giessen values separately 92
. 93
So let's just go ahead and run this. 94
Here we are. 95
So we added John Raj and Anita. 96
But then when we print it that automatically is sorted according to the Keys in ascending order. 97
OK so monetised first Dianas John and the third is Rotch OK and the same thing is happening here. 98
We are reading through the entry cert we are invoking the entry sig which is returning a set of all 99
the mappings. 100
And we're reading through them and we are printing the main island h in each of the markings. 101
OK now let's go ahead and do this. 102
So here you are saying. 103
If the key of the current mapping is John then we said the H 2 to be 6. 104
Ok so this is just to show that the set value method can also be used in the earlier demo we did not 105
use this particular method. 106
Set value we only a monster to get key and get value. 107
So let's go ahead and do this. 108
So with this the regional map will also be changed. 109
OK because the original map is backing this particular set. 110
OK so let's go ahead and run this. 111
And here is the origin on map and H for John has been updated ACORDA 6. 112
Now one last thing is there are these methods like the floor tree lot and tree ceiling and tree and 113
higher and tree all of which are done in map and we get out of it you are done an entry and the thing 114
is we cannot directly involved a set value matter on them. 115
And that's because those matters return an entry but the output that is generated the value that is 116
produced for this is a snapshot a doc instance of. 117
So that entry is not backed by the old gentleman. 118
So if we cannot add any value it will throw an error and run it. 119
And here it is. 120
Going on it again. 121
Here it is. 122
So it says unsupported operation exception. 123
Line 110. 124
Climb on all four here. 125
That's because the set volume entered cannot is not supported by the return. 126
And 3 here. 127
So when four and three is invoked it returns an entry on that particular instance off entry does not 128
support seq value mattered and when when will it. 129
It is throwing this unsupported operation exception case or the set value method does not work here 130
although the circular argument that looks here when we are iterating through the entries. 131
It's just that these kind of matters like the floor and the ceiling and tree and those kinds of Mathare 132
Trivett should return a specific entry there. 133
We cannot invoke it as they produce a snapshot at that particular instance of. 134
So that's about it. 135
And this new method is also available in the resources section. 136
Thank you. 137
Unhappy coding