![](/img/trans.png)
[英]What's the different between the result of HashMap.entrySet() and LinkedHashMap.entrySet(),do they have the same performance?
[英]Debugging HashMap shows a recursive entrySet? What is it?
我正在使用HashMap<String,Serializable>
並且在調試時遞歸地看到以下內容。 這意味着什么? 為什么會這樣呢?
HashMap$EntrySet
是一個內部類,它有一個名為明確提及this$0
到HashMap
。 並且HashMap
具有引用它的private transient Set<Map.Entry<K,V>> entrySet
字段private transient Set<Map.Entry<K,V>> entrySet
。 因此,只是通常的循環引用。
HashMap
實例具有類型為HashMap$EntrySet
的字段entrySet
。 由於EntrySet
類是HashMap
的內部類,因此它隱含了對包含實例的引用( this$0
)。
這是正常現象, EntrySet
實例訪問包含的HashMap
實例是必需的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.