文章詳情頁
java - 請(qǐng)問Map map = new HashMap;與Map map = Maps.Hashmap;創(chuàng)建的map對(duì)象有什么區(qū)別?
瀏覽:109日期:2024-02-17 15:51:14
問題描述
問題解答
回答1:你說的是com.google.common.collect.Maps.newHashMap()嗎?
回答2:沒什么區(qū)別,你看下源碼就知道了:
/** * Creates a <i>mutable</i>, empty {@code HashMap} instance. * * <p><b>Note:</b> if mutability is not required, use {@link * ImmutableMap#of()} instead. * * <p><b>Note:</b> if {@code K} is an {@code enum} type, use {@link * #newEnumMap} instead. * * @return a new, empty {@code HashMap} */ public static <K, V> HashMap<K, V> newHashMap() { return new HashMap<K, V>(); }
標(biāo)簽:
java
相關(guān)文章:
1. MySQL主鍵沖突時(shí)的更新操作和替換操作在功能上有什么差別(如圖)2. 關(guān)于mysql聯(lián)合查詢一對(duì)多的顯示結(jié)果問題3. python - scrapy url去重4. mysql在限制條件下篩選某列數(shù)據(jù)相同的值5. 數(shù)據(jù)庫 - Mysql的存儲(chǔ)過程真的是個(gè)坑!求助下面的存儲(chǔ)過程哪里錯(cuò)啦,實(shí)在是找不到哪里的問題了。6. 小白學(xué)python的問題 關(guān)于%d和%s的區(qū)別7. python執(zhí)行cmd命令,怎么讓他執(zhí)行類似Ctrl+C效果將其結(jié)束命令?8. 實(shí)現(xiàn)bing搜索工具urlAPI提交9. python - Django有哪些成功項(xiàng)目?10. Python從URL中提取域名
排行榜

熱門標(biāo)簽