[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –
Intermediate Java Tutorial – 16 – HashSet
by
Tags:
Comments
22 responses to “Intermediate Java Tutorial – 16 – HashSet”
-
Can't we convert Array to Set? instead converting Array to List and then list to Set.
-
Send BOB and Vegena 😉
-
– The HashSet subclass (from superclass Set) rearranges every element
– The LinkedHashSet subclass links with the elements and won't rearrange them -
it doesn't remove three of a same kind!
-
SHtring ;)))))
-
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???
-
what about if you want to replace the 2nd bob with a new element.???
for exampleOutput : [apple, bob, ham, tomato, bacon]
-
Could I overwrite the current list?
Like instead of doing:
Set<String> set = new HashSet<String>(list);
Could I do:
list = new HashSet<String>(list); -
so, HashSet is an object, not a method?
-
ssssibilance
-
does the hashset randomly compile the lists elements? like instead of the lists original order, the set displays the elements in the wrong order
-
Hello Bucky,
my issue: the program removes the first instance of bob not the second :/ -
Bucky these data Structures are kinda hard to understand without illustrating…
-
Thanks
-
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);
}
} -
how the set is automatically getting rearranged in a typical manner
? -
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? -
Seems useful. Nice tutorial
-
For some reason I keep getting a compile error saying that HashSet is not generic.
-
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?
-
But which bob did it remove?
-
what should i do if i want to insert data from a text file to hash set?
Leave a Reply