-
bluej hashset problem ;s
alright, i'm stuck on this part of my project and i really tried to get over it but nothing seems to get better...
My aim is to add a number of objects to a HashSet with a for-loop but i can't seem to accomplish that. The size of the HashSet stubbornly stays null. Here is the code:
/**
* Constructor for objects of class Pocket
*/
public Pocket()
{
// initialise instance variables
HashSet<Object> Object = new HashSet<Object>();
for(int i=0; i<20; i++) {
Object.add(new Object());
}
I might be missing something crucial here and call me a retard but i really cant see what it is so any help would be appreciated.
Thanks in advance :)
-
How are you checking the size of the hash set?
Oh, and Object is not a good name for a variable. Variables should start with a lower case so you don't end up with variables being the same name as classes.
-
Nevermind i fixed it already..
thx tho