Intermediate Java Tutorial – 16 – HashSet

///Intermediate Java Tutorial – 16 – HashSet

Intermediate Java Tutorial – 16 – HashSet

FavoriteLoadingAdd to favorites

Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –

source

Java468x60
By |2019-12-09T00:23:50+00:00December 9th, 2019|Java Video Tutorials|27 Comments

27 Comments

  1. Cute User December 9, 2019 at 12:23 am - Reply

    Great tut 😀 when u said all we have to do, i thought of is follow the damn train CJ 😂😂

  2. victor valdez December 9, 2019 at 12:23 am - Reply

    is this a hashmap?

  3. MrBabarino December 9, 2019 at 12:23 am - Reply

    So the print order is not retained? Every time I print after removing one instance of "bob", I get a different order than our dear overlord Bucky.

  4. Mihlen December 9, 2019 at 12:23 am - Reply

    Go ahead

  5. Ke vin December 9, 2019 at 12:23 am - Reply

    2018 and you're still a hero bucky!!!!!!!!!!!!!!!!!

  6. Kristijan Pavlović December 9, 2019 at 12:23 am - Reply

    There is one thing that bothers me.
    Why do you every time use System.out.printf("%s", arg); and lane after u use System.out.println(); when you could just use once System.out.println(); with list, array or anything in it and it would just print it and go to new line. This way you have 2 lines of code instead of one for nothing.

  7. Shay Axelrod December 9, 2019 at 12:23 am - Reply

    I got this output.. Can anyone relate?
    [apple, bob, ham, bob, bacon]
    [apple, bacon, bob, ham]

  8. ravi teja December 9, 2019 at 12:23 am - Reply

    Can't we convert Array to Set? instead converting Array to List and then list to Set.

  9. Bilal Ahmed December 9, 2019 at 12:23 am - Reply

    Send BOB and Vegena 😉

  10. Patrascu Lucian December 9, 2019 at 12:23 am - Reply

    – The HashSet subclass (from superclass Set) rearranges every element
    – The LinkedHashSet subclass links with the elements and won't rearrange them

  11. Aman Jain December 9, 2019 at 12:23 am - Reply

    it doesn't remove three of a same kind!

  12. Zoro Ale December 9, 2019 at 12:23 am - Reply

    SHtring ;)))))

  13. Michael Bucceri December 9, 2019 at 12:23 am - Reply

    Hmm, when I typed in Set<String> set = new HashSet<String>(list);

    it is telling me that the type HashSet is not generic; it cannot be parameterized with arguments <String>

    Any advice on what I can do to fix this issue???

  14. Loizos Vasileiou December 9, 2019 at 12:23 am - Reply

    what about if you want to replace the 2nd bob with a new element.???
    for example

    Output : [apple, bob, ham, tomato, bacon]

  15. Evgeni Kuzmov December 9, 2019 at 12:23 am - Reply

    so, HashSet is an object, not a method?

  16. LuXxenatorX December 9, 2019 at 12:23 am - Reply

    ssssibilance

  17. Devin M December 9, 2019 at 12:23 am - Reply

    does the hashset randomly compile the lists elements? like instead of the lists original order, the set displays the elements in the wrong order

  18. Damir Huselja December 9, 2019 at 12:23 am - Reply

    Hello Bucky,
    my issue: the program removes the first instance of bob not the second :/

  19. Henteti Ahmed December 9, 2019 at 12:23 am - Reply

    Thanks

  20. Jinhua Chen December 9, 2019 at 12:23 am - Reply

    import java.util.*;

    public class julian {
        public static void main(String[] args) {

           String[] things = {"apple", "bob", "ham", "bob", "bacon"};
            List<String> list = Arrays.asList(things);

            System.out.printf("%s ", list);
            System.out.println();

            Set<String> set = new HashSet<String>(list);
            System.out.printf("%s ", set);
        }
    }

  21. Sou Dutta December 9, 2019 at 12:23 am - Reply

    how the set is automatically getting rearranged in a typical manner
    ?

  22. 6BuSh December 9, 2019 at 12:23 am - Reply

    Can someone please explain me what's the difference in constructing the hashset object as:
    HashSet<String> set = new HashSet<String>(list)
    instead of
    Set<String> set = new HashSet<String>(list) as shown in the tutorial?

  23. Sina Madani December 9, 2019 at 12:23 am - Reply

    Seems useful. Nice tutorial

  24. Gates Wang December 9, 2019 at 12:23 am - Reply

    For some reason I keep getting a compile error saying that HashSet is not generic.

  25. Wolfguarde December 9, 2019 at 12:23 am - Reply

    Interesting little bug… somehow my first array parametre is last in the set's print output. Doesn't really affect anything in the tutorial, but I'm curious… why is this happening?

  26. Mistermaarten150 December 9, 2019 at 12:23 am - Reply

    But which bob did it remove?

  27. khuong nguyen December 9, 2019 at 12:23 am - Reply

    what should i do if i want to insert data from a text file to hash set?

Leave A Comment

*