I have a curious situation - there is a HashMap, that is initialized as follows:
    HashMap<String, HashSet<String>> downloadMap = new HashMap<String, HashSet<String>>();
and then I have the following things, that will be executed indefinitely via a quartz scheduler:
    myHashSet = retrieve(animal);
    downloadMap.put(myKey, myHashSet);
    // do stuff
    downloadMap.get(myKey).clear();
What happens after, is that one value gets associated with the different keys. So, for instance, I will have things like:
 Kitens [cute kitten, sad kitten]
 Puppies [cute kitten, sad kitten]
Which never should happen.
Particularly, after I retrieve the HashSet of the kittens:
 myHashSet = retrieve(animal);
myHashSet = [cute kitten, sad kitten] downloadMap = Kittens [], Puppies[]
then put() is executed and I get:
 downloadMap =  Kitens [cute kitten, sad kitten], Puppies [cute kitten, sad kitten]
Does anyone knows why this is the case?
Thank you in advance!
 
     
     
     
    