 Hey everybody, this is Brian and welcome to the 27th Java tutorial. Today we're going to be talking about the set interface, specifically the tree set. So what is a tree set? Well if you look it up, a tree set is a tree class that follows the set interface. We've gone over the tree map. Well this is different. A set interface is a collection that contains no duplicate elements. That's really all there is to it. Well it says is E1 and E2 or element 1, element 2 equal. If they're equal it won't add it. It just will not do it. I've got some code written out here just to save some time. This is a very simple topic and I didn't want to waste it clicking away on the keyboard. We've got our tree set imported and we're making a tree set with a generic type of a string and we're saying nums is the name and we're making new tree set string default constructor. We're just adding 1, 2 and lowercase 1. I want to show you what happens here. We're just going to print it out. Notice how it says 1, 2 and 1. Well didn't we just say that a set cannot have duplicate items? Well you look, one's uppercase, one's lowercase. So Java treats those as different items because they're not equal. Now let's actually go in here and make this uppercase and you'll see how automatically it says 1, 2. And it doesn't add that third one in because it's equal to this one. So that's the tree set and how to work with it. The rest of this is actually pretty similar to what we've been talking about. And I really implore you to go out and just explore this object and work with it. You can see how you can add, add all, clear, clone, first, last, etc., etc., etc. You can even remove, so let's say you want to remove 2. And then print it out. Whoops, hope if we put that in the right spot there. You can see that we have removed that item. Very simple, very easy to use. This is Brian. Thank you for watching. I hope you found this video educational and entertaining.