I am not quite familiar with the proper way to use WeakReference. I got some objects referenced by java.lang.ref.WeakReference. Occasionally, I want to inspect those objects. But since weakly referenced objects would be gc'ed at any time, how can I make sure they are still there by the time I inspect them?
Say, I first check that the WeakReference still contains a non-null value returned by get(). Does that mean this value will still be non-null when I use it some time later? By calling get() would I now create another strong reference to the object? And, if yes, does it mean I must set null to any variable I used to store the reference obtained from the get()?