这是弱一致性的一种特殊形式;存储系统保证如果对象没有新的更新,最终所有访问都将返回最后更新的值。
This is a specific form of weak consistency; the storage system guarantees that if no new updates are made to the object, eventually all accesses will return the last updated value.
用于存储键-值映射的 Entry 类型扩展了 WeakReference,因此当 expungeStaleEntries() 要求下一个失效的弱引用时,它得到一个 Entry。
The Entry type, which is used to store the key-value mapping, extends WeakReference, so when expungeStaleEntries() asks for the next expired weak reference, it gets back an Entry.
因为这是弱引用最常见的用法,WeakHashMap也被添加到JD k 1.2的类库中,它对键(而不是对值)使用弱引用。
Because this is such a common use for weak references, WeakHashMap, which USES weak references for keys (but not for values), was also added to the class library in JDK 1.2.
应用推荐