Welcome back, Scott Stanley here. In these lessons, we're gonna take a look at the collections framework, some static helper functions that we can use to work with these collections, and then we're gonna take a look at natural and custom sorting algorithms that we can specify. In this lesson, I'm gonna show you the collections framework. We see it's made up of several interesting types. The first thing I want to draw your attention to is, we see the orange boxes here are the interface types, and the blue boxes are the class types. So just as a refresher, the interfaces specify the what, and the classes, the implementations of those interfaces, they determine how, how something works. So we can see at the very top of the collection framework hierarchy, there is a collection interface, which is the most generic of them all. And then you see some more specific type interfaces, lists, cues, sets. There are stacks, maps, trees, just about everything you could hope for is a part of this collection's framework hierarchy. Let's take a look here at the collections test. Right, here we go. The first test scenario we see is we're creating a new array list. We're storing it as the generic type, referring to it generically as the list interface type. And in this case, we're using the generics. And so this is going to be a list of number type. And we're gonna add the first 50, well up to 50 prime numbers. So two, three, five, seven, 11 up through 47. And then we just prove that it has a size of 15, which is the number of elements that we added to it. So this required quite a lot of typing, as you can see. They've given us a couple of helper shortcut ways of doing this that makes life a little easier for us. The first of which is rather than create a new array list the way I did here and pack it with those prime numbers, we're going to take the shortcut approach, and just use the arrays as a list and specify the 15 numbers. And more recently, they've added some new behaviors to these interface types, their default methods on the interfaces. So we have list of, and likewise, we can specify first 50 primes. Now a list is an ordered list, which allows us to add an element at a particular index. So if you see here we have one, two, four, five, and six, and those elements are numbered zero, one, two, three, four, if we wanted to insert the number three in between two and four, we would say we would like to add at index two the number three. And what it does is it scoots everything over to the right that was in that location and beyond that spot. After we add the number three in the second position, zero, one, two, then the list will be one, two, three, four, five, six. We take a look at a quick little way of squeezing duplicates out of a list. So a list allows duplicates. In fact, you can see we have the number two duplicated several times, as well as six and seven. And the size of this list is 10. If we want to squeeze the duplicates out, we can create a new hash set. Sets do not allow duplicates. So what that ends up doing is reducing the list to one, two, six, seven, eight. Here's an example of a map. We have a map of number to string, and the number here, maybe an employee number. So employee number one is Scott. Number two is Jennifer. Number three is Tyler. And then we can verify that looking up the map, this collection, for key number three, rather, is Tyler. Before the new behavior put if absent, if we wanted to put a new key value pair in a map, but we wanted to make sure that we didn't bump something that may already have been in that location, we had to do this. If I look up the key number three in this map, and there is no such thing, then I will put the number three pairing with the string Peter. And this was kind of klugey. The new way to do that now is we can just say put if absent. Put if absent. And the last thing we'll look at here is the the notion of a weak hash map. A weak hash map is very useful for holding caches for example. The way a weak hash map collection type works is this. As soon as there are no more references to elements within the map, then the key value pairings in the weak hash map will disappear. They'll automatically purge themselves on a garbage collection interval. So if we create Chris and Eddie here, and put them in this collection, this map, which happens to be a weak hash map implementation, we put those two objects in the map, and then we can assert the size of the map as two. As soon as Chris is set to null, Chris was one of the key value pairings that we put in this weak hash map, as soon as Chris is set to null then there are no longer any references to that key value pair, and so as soon as a garbage collection occurs, I forced it here just so I could prove the issue, as soon as we run a garbage collection, and then we go and ask the hash map what its size is, its size is no longer two, its size is now one, because dropping the reference to a key value pair automatically reduces the size of that weak hash map. In the next lesson, we're going to take a look at some static functions, helper methods, that we can leverage to take more advantage of this collections hierarchy. Thanks for watching and stay tuned.