Sets: Java Collections Framework Tutorial Part 5

preview_player
Показать описание
-------------------------------------------------------------------------------------------------------------------------------------------
How to use sets in Java -- HashSet, TreeSet and LinkedHashSet. In this tutorial I also explain how to find the intersection of two sets and the difference of two sets, as well as the usual stuff - iteration, adding and removing items and so on.
--------------------------------------------------------------------------------------------------------------------------------------------
Рекомендации по теме
Комментарии
Автор

that's pretty much everything I needed to know about sets all in 15 concise minutes. Thanks for uploading!

amizan
Автор

Thank you very much! Awesome tutorial. The opera music and the very soothing voice makes me picture you like a sloth. A very classy sloth with a monocle and a gentleman hat.

tedchirvasiu
Автор

Great job. Thanks to this tutorial, I now know much more about Java Sets and aardvark - a medium-sized, burrowing, nocturnal mammal native to Africa; only living species of the order Tubulidentata.

giomo
Автор

Really nice, crisp and to the point..thank you very much.

bharatbawari
Автор

You are the best teacher ever! Even in college my professors could not explain as well as you. Thank you lots John :D

myhops
Автор

Most excellent tutorials. I am speechless.

mateuszalmannai
Автор

I know you can iterate over the set with Iterator. When I should use Iterator over foreach loop and vise verse 

Svinqvai
Автор

The order i got - it worked nicely 
HashSet: 9 [Cactus, Lilly, Lemon, Apple, Pineapple, Rose, Jute, Banana, Jasmine]
LinkedHashSet: 9 [Apple, Banana, Lemon, Cactus, Jute, Rose, Jasmine, Lilly, Pineapple]
TreeSet: 9 [Apple, Banana, Cactus, Jasmine, Jute, Lemon, Lilly, Pineapple, Rose]

xthmath
Автор

thank you, on 15 minutes you did what my professor couldn't do, that was explain this subject, IN AN HOUR
thank you very much, feel much more confident for the test now

gabrip
Автор

Thank you! I just realised what a stupid way I used writing my program which compared two text files and then said what the differences between them are. I could use the Set collections instead of ArrayList to avoid a big code with a lot of loops which check what matchs and what doesn't!

GMByteJavaTM
Автор

The third of the operations, besides intersection, which is symmetrical, set difference, which you showed here, is of course Union. I can immediately think of a couple of ways that we could do it, but you could mention which is the "best" or recommended way of obtaining the union of two sets or "adding" one to the other.

jvsnyc
Автор

dude thanks! helped me out a lot. Exame in two days :D

Jackorer
Автор

This damn video amounts to nearly 60% of my exam :D
Thank you.
and I learned what an Aardvark is, which is always a bonus.

Stygianduck
Автор

Type sysout and press ctrl+space. Or in Netbeans type sout.

caveofprogramming
Автор

this guy is legend.Looking for some videos about building real world projects.(make them paid :)) )

LifeSuxTR
Автор

Awesome :-). How can we do union of two sets in best efficient way ?

sahilrally
Автор

This was great thank you. Really helped me understand the concept of sets! You're saving me on this late assignment!

jakspyder
Автор

you can use the diamond operator with newer version of java

larn
Автор

How would you apply this to your own class? I have a employee class that is implementing comparable, but when I try to add(new Employee("Name", 12323, 12, 12, 192), it only add one to the treeset.
I do this: mystreeset.add(new Employee("name", salary, hireday); many times, but when I print it only the first one get printed out, and the size is also only one. Any idea?

etelot
Автор

If your code is dependent on properties not defined in the interface but only the implementation, you shouldn't abstract away that information by referring to an
implementation instance by its interface.

carlhopkinson