The documentation for WeakHashMap states that it is intended primarily for use with key objects whose equals methods test for object identity using the == operator. Because WeakHashMap uses a key's own equals and hashcode methods, it is better suited for implementing methods that behave like {@link String#intern}. However, because WeakHashMap stongly references values, {@link Utils#intern Utils.intern} provides a safer intern mechanism.
In this implementation, all key objects are tested for equality using the == operator, and null keys are not permitted. IdentityMap is therefore better suited for "canonicalized" mappings.
Note: Weakly referenced entries may be automatically removed during either accessor or mutator operations, possibly causing a concurrent modification to be detected. Therefore, even if multiple threads are only accessing this map, be sure to synchronize this map first. Also, do not rely on the value returned by size() when using an iterator from this map. The iterators may return less entries than the amount reported by size(). @author Brian S O'Neill @version 19 , 00/12/18 @see java.util.WeakHashMap @see java.util.HashMap
Map
implementation that matches keys and values based on ==
not equals()
. This map will violate the detail of various Map and map view contracts. As a general rule, don't compare this map to other maps.
Note that IdentityMap is not synchronized and is not thread-safe. If you wish to use this map from multiple threads concurrently, you must use appropriate synchronization. The simplest approach is to wrap this map using {@link java.util.Collections#synchronizedMap(Map)}. This class may throw exceptions when accessed by concurrent threads without synchronization. @since Commons Collections 3.0 @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $ @author java util HashMap @author Stephen Colebourne
Map
interface.
@author Ralf Joachim
@version $Revision: 7491 $ $Date: 2006-04-13 10:49:49 -0600 (Thu, 13 Apr 2006) $
@since 0.9.9
==
instead of {@link #equals(Object)}. This class is not a strict implementation the {@link Map} interface.It intentionally violates the {@link Map} contract, which requires the use of{@link #equals(Object)} when comparing keys. @since 1.2
Purpose: Provides the interface for IdentityMap interaction.
Responsibilities: Provides access to all of the public interface for the EclipseLink IdentityMaps. This interface can be used if implementing custom identity maps that are radically different than the stock IdentityMaps otherwise simply extending the appropriate IdentityMap implementation is the best approach. @see CacheKey @since EclipseLink 1.0M7
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|