HashSet In Java Tutorial #52
HTML-код
- Опубликовано: 2 фев 2025
- $1,000 OFF ANY Springboard Tech Bootcamps with my code ALEXLEE. See if you qualify for the JOB GUARANTEE! 👉 bit.ly/3HX970h
The HashSet in Java can be tricky at first. In this video I show you how you use the HashSet in Java! ✅Hopefully, what I've taught you will help you fix your HashSet Java code.
👑Start practicing now with 10 free java programs - alexlorenlee.com/
🐙 Source Code - github.com/ale...
Here are some useful HashSet Java methods:
hashset.add();
hashset.clear();
hashset.contains();
hashset.remove();
hashset.isEmpty();
hashset.iterator();
The HashSet in java code can be tricky at first... But SURELY you'll get it :) If you followed along, congrats! You learned-by-doing!
I hope you enjoyed this HashSet in Java tutorial! I like to have a nice mix of java tutorials and actual java programs for you all :)
Do you want to learn how to write java code from scratch, in Java? Check out my Java Tutorial For Beginners: • Coding For Beginners I...
Was this able to fix your Java Hashset code?
Full Java Tutorial For Beginners Playlist: • Full Java Course by Al...
Free Tips: bit.ly/3U6HXcb
Disclosure: The Springboard link provided is linked to my affiliate account & supports the channel.
~
Alex Lee
If you’re new to programming but want a career in tech, I HIGHLY RECOMMEND applying to one of Springboard’s online coding bootcamps (use code ALEXLEE for $1,000 off): bit.ly/3HX970h
Programming can be hard to learn by just reading. If only you knew how much and how fast I learn from your videos. I won't forget you when I make it to google.
dog.... i subscribed as soon as i seen the class name HashBrowns
Comment to show gratitude towards this whole channel...
Hope you reach 1 mill subs soon!
Broooooo I remember when you only had 100 views literally not to long ago lol!! You came a long way bro! Congrats
Thank you. Now i get it what my teacher can't tell me :D
"It's hashed all around so that's why it's called a hashSet" Gold. Good video! Thank you.
It is not Hashed, it was sum of alll numbers
man you are the God of Java
The best java teacher on youtube
10:10 it is not a random number 42, is the sum of all the value ( 13 +24 +5 =42) , dunno what's mean by your "disperse" ,maybe we are talking about the same thing
That's true. But if you make a HashSet then the hashCode() will return a number once again. For example if the HashSet contains [a, b, c] then the hashCode(); returns 294
Your videos are great!
Thanks!!
My man said "RIP Harambe" and I'm here for it 😂😂😂😂😂
This is an amazing channel
Your videos are so useful! Can you make separate tutorial on Stringbuilder?
Thankyou for your videos, Why would you use a hashset and not an array to print out each value?
Plz tag me of someone answer
Hashsets do not allow duplicate data, that is probably the main reason to use a hashset over an array.
Nice explained sir thankyou
Dude! You’re AMAZING!!!!!
What is the reason to use an iterator instead of a normal loop?
Good explanation, Thank you!
10:10
doesnt that the sum of the values??
13 + 24 + 5 = 42
can you plz tell us what are the difference btw the array list, HashSet, linked list, and array deque????
HOOOOOOLY. That's strange 8:15 . Cause like, 24 is my favourite number aswell and i legit tell the same reason why i like that number ( Cause its divisible with a lot of numbers ). mhmh just wanted to share :)
and, Kobe Bryant's number
Thank you so much, you really helped me
Great video!
Iterator is it wrong?
Congrats. You just fully replaced my professor. I should be paying you my tuition!
Quality stuff dude
This was really helpful 🖖
Hi Alex! first of all thank you very much!
My question to you is what are the difrences between a Hashmap and a Hashset?
HashSet is a set, e.g. {1,2,3,4,5}
HashMap is a key -> value (key to value) map, e.g. {a -> 1, b -> 2, c -> 2, d -> 1}
@@anujkumarpatel2686 thank you !
@@anujkumarpatel2686 Good explanation, Thank you!
Then what's the difference between hashset and arraylist
Hashset doesn't accept duplicates, while arraylist do
Also you can't get let's say the 1. element from a hashset.
986 likes! Lets go people :) Great video Alex
Thanks so much!
9:49 you are lovely for the your hand gesture
He could've admitted that he didn't know much about HashSets. The way he explained HashSets is not expected from a youtuber who uploads content to educate viewers
Considering that this is a fairly new channel, I hope I can get this message across to you...
What you are doing is great, your delivery is clear and concise, and in that regard, would it be possible to hold our hands through a relatively (to someone who had gone through the basic syntax) complex Java application, preferably a desktop with SQL queries and proper Swing usage?
A lot of the code on RUclips is pretty much the onscreen creating of the source code with little to no explanation as to why we use what we just used, and it was be a massive help if you can make something similar giving us your logic and reasoning behind the work.
how do you know it was an inside job
seems like a hashset is basically an appendable array that doesn’t allow for duplicates. are there any other benefits to using a hashset over an array
Thanks it helped a lot
Does anybody know how I can get that same list of options at 3:16 to appear in blueJ when I use classes from the java-library? That way I wouldn't have to go to their website everytime I want to explore the different methods of a java-library class? Is that possible to do in blueJ?
If at all possible... a video on HashTables or maybe just a video illustrating the differences between types of Hashing
when you use hashcode, the result is sum of all number in the HashBrowns, is it something to be considered?
does hashset allow duplicate values ?
so helpful but ,what is the difference with the Array List?
it is showning red line under integer and saying that integer cannot resolved into a type pls suggest me what can i do......
HashSet implements the set interface, that is one of the two main interfaces in the java collection.. There are a lot of things to learn about this hashSet object..
write "sout" then CTRL+SPACE as a short cut for ''System.out.println()"
it's weird , some of his videos he did , some he didn't , maybe he is afraid of confusing people
@@rittenbrake1613 true,
for me i was just trying to give it as a hint to others.
@@venusisalwaysabove yes sure ! It helps a lot , when I was a beginner , I dunno this shortcut too
@@venusisalwaysabove yes sure ! Thank you Ayoub ! It helps a lot , when I was a beginner , I dunno this shortcut too
sout tab
Can we use (for each loop) in HasSet Just like You used While ?
I have a hashset witch contains a Custom Object added. Example:
private static Set people= new HashSet();
How can i create a function to retrieve a specific People to the hashset witch pass a People name?
Ex:
public People checkName(String name) {
return // RETURN THE PEOPLE OF THE HASH CONTAINS name passed
}
please help me
Alex, please can you tell me the music you used at the end of the video?
darude sandstorm
i like your IDE. Which is you using. Kindly tell me or paste link here so i can download
www.tomorrowtides.com/ictjournaldevfixed.html
@@sneakycheeky531 this link is dancing 💃
@@kitty_kee he's using eclipse. most software have there name at the top .
@@sneakycheeky531 exactly! 😎 now I have netBean IDE that is better than eclipse and parallel to Android Studio for making mobile apps. I recommend you to use netBeans.
@@kitty_kee im already using it. add me on discord disco#9740
Thanks dude!
Thanks a lot
Can you do hash table and priority queue?
For Integers, anyway, the hashcode is the total of the numbers you put in.
Thanks sir
Excellent video, thanks!! I was wondering if you can have multiple types in parameter of hashset? for example: HashSet hashbrowns = new HashSet();
and if this is possible, how would the iterator handle multiple types? Thanks
I don't think you can have more than 1 data type parameter for HashSet, only for HashMap where there is a key and a value.
What is the difference between Hashset and Stringbuilder?
Stringbuilder is only for strings I guess but I think there is more to it
what are the differences of hash-set and tree-set ?
the ordering is different tree-sets have natural ordering.
Very useful.
Awesome videos
When do I use HashSets when programming in the field? What's the benefit?
Amazing!
I liked the video as soon as he said RIP HArambe
Can somebody enlighten me, when are hash sets a good choice instead of other data structures?
Why are you not uploading video related Java
In HashSet , outputs are random why?
Please consider describing the time complexity also.
Alex, please don't confuse your viewers with things that you don't know. The way you explained HashSets at 9:48 freaked me out. I hope you will upload content that you really know about and give the viewers a better understanding. Cheers 😁😁
what's the common uses of HashSet ? and why we need it when we have arrays and ArrayList ?
Hashsets are not index-based, they take the values inside the list randomly ~ I think they're used to generate random values (like unique keys). And are faster that Arraylist for searching the list.
What's the difference between hashSet and arrayList?
sets cant have duplicate values
what is the difference between Set set = new HashSet(); and HashSet set = new HashSet();
Hashset is a member of the collection set, so the object declared can be of both type, hashset or set, output will be same. Similar case with List list= new ArrayLIst() and List list= new LIst(), as arraylist is a member of collection List
@@anupriya1661 thx
@@anupriya1661 you cannot instantiate List as it's an interface.
You could have explained the difference between a set and a list, they look very similar to me.
its really hard to see whats on the screen what you cant take your eyes off the bottom right corner.
Hmmm, what's the difference between HashSet and an ArrayList, apart from the name, it function almost the same with ArrayList... At least from the example you give
Can anybody tell me what's exactly the difference between a HashMap and a HashSet?
first of all, HashMap implements Map interface, but the HashSet implements Set interface.Beside that, the HashMap work with key and value; it cannot have duplicate keys (but it can have duplicate values). and it use Put() as the inserting method.
HashSet, cannot have duplicate value . It use Add() as the inserting method . and its slower than HashMap.
@@venusisalwaysabove Also HashSet can only have 1 data type parameter, while HashMap can have 2.
Great Harambe meme 👌
Rest in Power, Harambe ✊😤🤭
why dont you just use arrayList for everything?
Why 5 is printed..? Bt not 3 or 1
hey thanks for explaining things so magically ..i have a question....its pretty much the same as a hashMap...then whats the difference.
HashMap also contains a key for its values
from now on i will call as alligators , diamonds are boring.
ducklips
tysm
10:11 I dont really understand what he meant by that. Can somebody explain?
Or wait.. is it the sum of all values?
Iterator is so confusing ....can someone help..??
gracias otra vez
9:48 If you are coming here to know why we call it HashSet then here's your answer 🤣😁
Good video, but flashing the patreon advertising with sound all 10 s is annoying. Doing this at the end of the video is better.
bro realy said rip harambe hahhahahahhahaha
op bro
like for Harambe
learning with background music is fun pls do this for whole video
Still giggling at harambe memes in 2023
why am i so stupid ugh
Thanks for flexing ur Mac :(
"orangatang"
Orangatang? Really that's the way how you spell it in english? :D
You show how to use but you didnt explained why we should prefer it or what exactly it does .
God bless the deslike button that can not show anymore.
orangatang......................................
orangatang
useless video you should show the difference between arraylist and hashset instead of typing same code in each video
I get wanting to push your website and subscribe/like, etc, but those sound effects are so irritating and distracting that I'll probably never watch another one of your videos despite the good content. Seriously, don't ruin your product for the sake of advertising Alex; you already ask for support at the start of the video, don't go overboard.
What is the difference between Hashset and ArrayList?