Do I have to .clear() HashSet and HashMap everytime, when variable is no longer used?
I have a lot of temporary variables in methods in my application that are HashSets and HashMaps. Do I have to clear them everytime when, for example, method is done? Will GC remove it automaticly if object will not be longer used by something?
I am asking because a lot of people point that I have to clear data in any hashmap if program is done and data stored in hashmap will not longer be used.