×

Loading...

java.lang.ref.WeekReference represents a reference which will be held for one week before being finalized by the garbage collector...

Just kidding with jabber's typo.
java.lang.ref package contains classes coping with the garbage collector.
java.lang.ref.Reference refers some types of indirect reference to a referent.
the subclasses of java.lang.ref.Reference interact with the garbage collector in different ways.
java.lang.ref.WeakReference is one of the three subclasses, it does NOT prevent that refent object from being finalized by the garbage collector. the garbage collector will clear the WeakreRerence if the garbage collector finds no more direct references..

WeakReference is used by java.util.WeakHashMap. WeakHashMap is useful if u want to attach additional information to an object but don't need it beprotected.
Report

Replies, comments and Discussions: