[{"data":1,"prerenderedAt":1088},["ShallowReactive",2],{"blog-\u002Fblog\u002Fjava-collections-framework-list-map-set":3},{"id":4,"title":5,"body":6,"description":1074,"difficulty":1075,"extension":1076,"framework":1077,"frameworkSlug":131,"meta":1078,"navigation":794,"order":139,"path":1079,"qaPath":1080,"seo":1081,"stem":1082,"subtopic":1083,"topic":1084,"topicSlug":1085,"updated":1086,"__hash__":1087},"blog\u002Fblog\u002Fjava-collections-framework-list-map-set.md","Java Collections Framework — Lists, Maps & Sets Explained",{"type":7,"value":8,"toc":1062},"minimark",[9,14,35,39,50,105,126,201,205,221,273,312,316,334,399,422,453,457,460,501,591,601,605,614,723,734,738,748,824,837,841,871,921,957,961,1003,1007,1058],[10,11,13],"h2",{"id":12},"the-java-collections-framework","The Java Collections Framework",[15,16,17,18,22,23,26,27,30,31,34],"p",{},"Almost every Java program stores groups of objects, and the Collections Framework is how.\nChoosing the right collection — and understanding how ",[19,20,21],"code",{},"HashMap"," works, why\n",[19,24,25],{},"ConcurrentModificationException"," happens, and how ",[19,28,29],{},"equals","\u002F",[19,32,33],{},"hashCode"," underpin it all —\nis a staple of Java interviews and of writing efficient code. This guide covers the\ninterfaces, the implementations, and the trade-offs.",[10,36,38],{"id":37},"the-hierarchy","The hierarchy",[15,40,41,42,45,46,49],{},"The root is ",[19,43,44],{},"Iterable"," -> ",[19,47,48],{},"Collection",", which branches into:",[51,52,53,71,88],"ul",{},[54,55,56,62,63,66,67,70],"li",{},[57,58,59],"strong",{},[19,60,61],{},"List"," — ordered, indexed, allows duplicates (",[19,64,65],{},"ArrayList",", ",[19,68,69],{},"LinkedList",").",[54,72,73,78,79,66,82,66,85,70],{},[57,74,75],{},[19,76,77],{},"Set"," — no duplicates (",[19,80,81],{},"HashSet",[19,83,84],{},"TreeSet",[19,86,87],{},"LinkedHashSet",[54,89,90,98,99,66,102,70],{},[57,91,92,30,95],{},[19,93,94],{},"Queue",[19,96,97],{},"Deque"," — processing order (",[19,100,101],{},"ArrayDeque",[19,103,104],{},"PriorityQueue",[15,106,107,112,113,116,117,119,120,122,123,125],{},[57,108,109],{},[19,110,111],{},"Map"," is part of the framework but ",[57,114,115],{},"not"," a ",[19,118,48],{}," — it stores key->value pairs.\nProgram to the interface (",[19,121,61],{},", not ",[19,124,65],{},") so you can swap implementations freely.",[127,128,133],"pre",{"className":129,"code":130,"language":131,"meta":132,"style":132},"language-java shiki shiki-themes github-light github-dark","List\u003CString> list = new ArrayList\u003C>();\nSet\u003CString>  set  = new HashSet\u003C>();\nMap\u003CString, Integer> map = new HashMap\u003C>();\n","java","",[19,134,135,160,178],{"__ignoreMap":132},[136,137,140,144,148,151,154,157],"span",{"class":138,"line":139},"line",1,[136,141,143],{"class":142},"sVt8B","List\u003C",[136,145,147],{"class":146},"szBVR","String",[136,149,150],{"class":142},"> list ",[136,152,153],{"class":146},"=",[136,155,156],{"class":146}," new",[136,158,159],{"class":142}," ArrayList\u003C>();\n",[136,161,163,166,168,171,173,175],{"class":138,"line":162},2,[136,164,165],{"class":142},"Set\u003C",[136,167,147],{"class":146},[136,169,170],{"class":142},">  set  ",[136,172,153],{"class":146},[136,174,156],{"class":146},[136,176,177],{"class":142}," HashSet\u003C>();\n",[136,179,181,184,186,188,191,194,196,198],{"class":138,"line":180},3,[136,182,183],{"class":142},"Map\u003C",[136,185,147],{"class":146},[136,187,66],{"class":142},[136,189,190],{"class":146},"Integer",[136,192,193],{"class":142},"> map ",[136,195,153],{"class":146},[136,197,156],{"class":146},[136,199,200],{"class":142}," HashMap\u003C>();\n",[10,202,204],{"id":203},"lists-arraylist-vs-linkedlist","Lists: ArrayList vs LinkedList",[51,206,207,214],{},[54,208,209,213],{},[57,210,211],{},[19,212,65],{}," — a resizable array. O(1) random access; O(1) amortized append; O(n)\nmiddle insert\u002Fremove (shifting). Cache-friendly.",[54,215,216,220],{},[57,217,218],{},[19,219,69],{}," — a doubly-linked list. O(1) insert\u002Fremove at the ends; O(n) index\naccess; more memory per element.",[127,222,224],{"className":129,"code":223,"language":131,"meta":132,"style":132},"List\u003CInteger> a = new ArrayList\u003C>(1000); \u002F\u002F pre-size to skip resizes\na.get(500); \u002F\u002F O(1)\n",[19,225,226,253],{"__ignoreMap":132},[136,227,228,230,232,235,237,239,242,246,249],{"class":138,"line":139},[136,229,143],{"class":142},[136,231,190],{"class":146},[136,233,234],{"class":142},"> a ",[136,236,153],{"class":146},[136,238,156],{"class":146},[136,240,241],{"class":142}," ArrayList\u003C>(",[136,243,245],{"class":244},"sj4cs","1000",[136,247,248],{"class":142},"); ",[136,250,252],{"class":251},"sJ8bj","\u002F\u002F pre-size to skip resizes\n",[136,254,255,258,262,265,268,270],{"class":138,"line":162},[136,256,257],{"class":142},"a.",[136,259,261],{"class":260},"sScJk","get",[136,263,264],{"class":142},"(",[136,266,267],{"class":244},"500",[136,269,248],{"class":142},[136,271,272],{"class":251},"\u002F\u002F O(1)\n",[15,274,275,276,281,282,284,285,287,288,291,292,295,296,299,300,303,304,307,308,311],{},"In practice ",[57,277,278,280],{},[19,279,65],{}," wins almost always"," — its cache locality beats ",[19,283,69],{},"\neven for many insert\u002Fremove patterns. ",[19,286,65],{}," grows by ~1.5× when full (an O(n) copy),\ngiving ",[57,289,290],{},"amortized O(1)"," appends; pre-size it if you know the count. One trap:\n",[19,293,294],{},"list.remove(int)"," removes ",[57,297,298],{},"by index",", while ",[19,301,302],{},"list.remove(Object)"," removes by value —\nfor a ",[19,305,306],{},"List\u003CInteger>",", box with ",[19,309,310],{},"Integer.valueOf(x)"," to remove a value.",[10,313,315],{"id":314},"how-hashmap-works","How HashMap works",[15,317,318,319,321,322,325,326,329,330,333],{},"A ",[19,320,21],{}," is an array of ",[57,323,324],{},"buckets",". To store a key it computes ",[19,327,328],{},"hashCode()",", spreads\nthe bits, and maps it to a bucket. Collisions chain in a linked list, which ",[57,331,332],{},"converts to\na balanced tree"," once a bucket exceeds 8 entries (table ≥ 64), keeping worst-case lookups\nat O(log n).",[127,335,337],{"className":129,"code":336,"language":131,"meta":132,"style":132},"Map\u003CString, Integer> m = new HashMap\u003C>();\nm.put(\"a\", 1);  \u002F\u002F hash -> bucket -> store\nm.get(\"a\");     \u002F\u002F hash -> bucket -> equals() scan -> 1\n",[19,338,339,358,383],{"__ignoreMap":132},[136,340,341,343,345,347,349,352,354,356],{"class":138,"line":139},[136,342,183],{"class":142},[136,344,147],{"class":146},[136,346,66],{"class":142},[136,348,190],{"class":146},[136,350,351],{"class":142},"> m ",[136,353,153],{"class":146},[136,355,156],{"class":146},[136,357,200],{"class":142},[136,359,360,363,366,368,372,374,377,380],{"class":138,"line":162},[136,361,362],{"class":142},"m.",[136,364,365],{"class":260},"put",[136,367,264],{"class":142},[136,369,371],{"class":370},"sZZnC","\"a\"",[136,373,66],{"class":142},[136,375,376],{"class":244},"1",[136,378,379],{"class":142},");  ",[136,381,382],{"class":251},"\u002F\u002F hash -> bucket -> store\n",[136,384,385,387,389,391,393,396],{"class":138,"line":180},[136,386,362],{"class":142},[136,388,261],{"class":260},[136,390,264],{"class":142},[136,392,371],{"class":370},[136,394,395],{"class":142},");     ",[136,397,398],{"class":251},"\u002F\u002F hash -> bucket -> equals() scan -> 1\n",[15,400,401,402,405,406,409,410,413,414,417,418,421],{},"Lookups and inserts are ",[57,403,404],{},"O(1) average",". The map has a ",[57,407,408],{},"capacity"," (buckets, default 16)\nand a ",[57,411,412],{},"load factor"," (default 0.75); when ",[19,415,416],{},"size > capacity × loadFactor"," it ",[57,419,420],{},"resizes","\n(doubles) and rehashes — so pre-size a known-large map to avoid repeated O(n) resizes.",[15,423,424,426,427,430,431,433,434,439,440,445,446,449,450,70],{},[19,425,21],{}," allows one ",[19,428,429],{},"null"," key and ",[19,432,429],{}," values and isn't synchronized.\n",[57,435,436],{},[19,437,438],{},"Hashtable"," is the legacy fully-synchronized version; ",[57,441,442],{},[19,443,444],{},"ConcurrentHashMap"," is the\nmodern thread-safe choice with fine-grained locking and atomic methods (",[19,447,448],{},"merge",",\n",[19,451,452],{},"computeIfAbsent",[10,454,456],{"id":455},"sets-and-maps-ordering-variants","Sets and Maps: ordering variants",[15,458,459],{},"The Set and Map families mirror each other:",[51,461,462,471,481],{},[54,463,464,470],{},[57,465,466,30,468],{},[19,467,81],{},[19,469,21],{}," — no order, O(1).",[54,472,473,480],{},[57,474,475,30,477],{},[19,476,87],{},[19,478,479],{},"LinkedHashMap"," — insertion order (LinkedHashMap also supports\naccess order, enabling LRU caches), O(1).",[54,482,483,490,491,449,494,66,497,500],{},[57,484,485,30,487],{},[19,486,84],{},[19,488,489],{},"TreeMap"," — sorted, O(log n), with navigation methods (",[19,492,493],{},"floor",[19,495,496],{},"ceiling",[19,498,499],{},"subMap",") for range and nearest-value queries.",[127,502,504],{"className":129,"code":503,"language":131,"meta":132,"style":132},"new HashSet\u003C>(List.of(3,1,2));       \u002F\u002F order undefined\nnew LinkedHashSet\u003C>(List.of(3,1,2)); \u002F\u002F [3, 1, 2]\nnew TreeSet\u003C>(List.of(3,1,2));       \u002F\u002F [1, 2, 3]\n",[19,505,506,538,565],{"__ignoreMap":132},[136,507,508,511,514,517,519,522,525,527,529,532,535],{"class":138,"line":139},[136,509,510],{"class":146},"new",[136,512,513],{"class":142}," HashSet\u003C>(List.",[136,515,516],{"class":260},"of",[136,518,264],{"class":142},[136,520,521],{"class":244},"3",[136,523,524],{"class":142},",",[136,526,376],{"class":244},[136,528,524],{"class":142},[136,530,531],{"class":244},"2",[136,533,534],{"class":142},"));       ",[136,536,537],{"class":251},"\u002F\u002F order undefined\n",[136,539,540,542,545,547,549,551,553,555,557,559,562],{"class":138,"line":162},[136,541,510],{"class":146},[136,543,544],{"class":142}," LinkedHashSet\u003C>(List.",[136,546,516],{"class":260},[136,548,264],{"class":142},[136,550,521],{"class":244},[136,552,524],{"class":142},[136,554,376],{"class":244},[136,556,524],{"class":142},[136,558,531],{"class":244},[136,560,561],{"class":142},")); ",[136,563,564],{"class":251},"\u002F\u002F [3, 1, 2]\n",[136,566,567,569,572,574,576,578,580,582,584,586,588],{"class":138,"line":180},[136,568,510],{"class":146},[136,570,571],{"class":142}," TreeSet\u003C>(List.",[136,573,516],{"class":260},[136,575,264],{"class":142},[136,577,521],{"class":244},[136,579,524],{"class":142},[136,581,376],{"class":244},[136,583,524],{"class":142},[136,585,531],{"class":244},[136,587,534],{"class":142},[136,589,590],{"class":251},"\u002F\u002F [1, 2, 3]\n",[15,592,593,594,30,597,600],{},"Choose by need: speed -> Hash; remember order -> Linked; sorted\u002Frange -> Tree. For enum keys,\nthe specialized ",[19,595,596],{},"EnumSet",[19,598,599],{},"EnumMap"," are far faster.",[10,602,604],{"id":603},"why-equals-and-hashcode-matter","Why equals and hashCode matter",[15,606,607,608,613],{},"Hash-based collections locate elements by ",[57,609,610,611],{},"hash first, then ",[19,612,29],{},". If two equal\nobjects have different hash codes, they land in different buckets and the collection can't\nrecognize them — duplicates in a Set, failed lookups in a Map.",[127,615,617],{"className":129,"code":616,"language":131,"meta":132,"style":132},"class Key {\n  int id;\n  @Override public boolean equals(Object o) { return o instanceof Key k && k.id == id; }\n  @Override public int hashCode() { return Integer.hashCode(id); }\n}\n",[19,618,619,630,638,689,717],{"__ignoreMap":132},[136,620,621,624,627],{"class":138,"line":139},[136,622,623],{"class":146},"class",[136,625,626],{"class":260}," Key",[136,628,629],{"class":142}," {\n",[136,631,632,635],{"class":138,"line":162},[136,633,634],{"class":146},"  int",[136,636,637],{"class":142}," id;\n",[136,639,640,643,646,649,652,655,658,662,665,668,671,674,677,680,683,686],{"class":138,"line":180},[136,641,642],{"class":142},"  @",[136,644,645],{"class":146},"Override",[136,647,648],{"class":146}," public",[136,650,651],{"class":146}," boolean",[136,653,654],{"class":260}," equals",[136,656,657],{"class":142},"(Object ",[136,659,661],{"class":660},"s4XuR","o",[136,663,664],{"class":142},") { ",[136,666,667],{"class":146},"return",[136,669,670],{"class":142}," o ",[136,672,673],{"class":146},"instanceof",[136,675,676],{"class":142}," Key k ",[136,678,679],{"class":146},"&&",[136,681,682],{"class":142}," k.id ",[136,684,685],{"class":146},"==",[136,687,688],{"class":142}," id; }\n",[136,690,692,694,696,698,701,704,707,709,712,714],{"class":138,"line":691},4,[136,693,642],{"class":142},[136,695,645],{"class":146},[136,697,648],{"class":146},[136,699,700],{"class":146}," int",[136,702,703],{"class":260}," hashCode",[136,705,706],{"class":142},"() { ",[136,708,667],{"class":146},[136,710,711],{"class":142}," Integer.",[136,713,33],{"class":260},[136,715,716],{"class":142},"(id); }\n",[136,718,720],{"class":138,"line":719},5,[136,721,722],{"class":142},"}\n",[15,724,725,726,729,730,733],{},"Always override ",[57,727,728],{},"both together",", on the same fields. And use ",[57,731,732],{},"immutable keys"," —\nmutating a key after insertion changes its hash, stranding it in the wrong bucket.",[10,735,737],{"id":736},"iteration-and-fail-fast-behavior","Iteration and fail-fast behavior",[15,739,740,741,744,745,747],{},"Most iterators are ",[57,742,743],{},"fail-fast",": structurally modifying a collection during iteration\n(other than via the iterator) throws ",[19,746,25],{},".",[127,749,751],{"className":129,"code":750,"language":131,"meta":132,"style":132},"\u002F\u002F throws\nfor (String s : list) if (s.isEmpty()) list.remove(s);\n\n\u002F\u002F safe\nlist.removeIf(String::isEmpty);\n\u002F\u002F or iterator.remove(), or map.values().removeIf(...)\n",[19,752,753,758,790,796,801,818],{"__ignoreMap":132},[136,754,755],{"class":138,"line":139},[136,756,757],{"class":251},"\u002F\u002F throws\n",[136,759,760,763,766,769,772,775,778,781,784,787],{"class":138,"line":162},[136,761,762],{"class":146},"for",[136,764,765],{"class":142}," (String s ",[136,767,768],{"class":146},":",[136,770,771],{"class":142}," list) ",[136,773,774],{"class":146},"if",[136,776,777],{"class":142}," (s.",[136,779,780],{"class":260},"isEmpty",[136,782,783],{"class":142},"()) list.",[136,785,786],{"class":260},"remove",[136,788,789],{"class":142},"(s);\n",[136,791,792],{"class":138,"line":180},[136,793,795],{"emptyLinePlaceholder":794},true,"\n",[136,797,798],{"class":138,"line":691},[136,799,800],{"class":251},"\u002F\u002F safe\n",[136,802,803,806,809,812,815],{"class":138,"line":719},[136,804,805],{"class":142},"list.",[136,807,808],{"class":260},"removeIf",[136,810,811],{"class":142},"(String",[136,813,814],{"class":146},"::",[136,816,817],{"class":142},"isEmpty);\n",[136,819,821],{"class":138,"line":820},6,[136,822,823],{"class":251},"\u002F\u002F or iterator.remove(), or map.values().removeIf(...)\n",[15,825,826,827,66,830,832,833,836],{},"Concurrent collections (",[19,828,829],{},"CopyOnWriteArrayList",[19,831,444],{},") are ",[57,834,835],{},"fail-safe"," —\nthey iterate over a snapshot and don't throw.",[10,838,840],{"id":839},"comparable-vs-comparator-and-generics","Comparable vs Comparator, and generics",[51,842,843,859],{},[54,844,845,850,851,854,855,858],{},[57,846,847],{},[19,848,849],{},"Comparable\u003CT>"," — the type's ",[57,852,853],{},"natural"," ordering, via ",[19,856,857],{},"compareTo"," implemented by\nthe class.",[54,860,861,866,867,870],{},[57,862,863],{},[19,864,865],{},"Comparator\u003CT>"," — an ",[57,868,869],{},"external"," ordering, so you can define many without touching\nthe class, and compose them.",[127,872,874],{"className":129,"code":873,"language":131,"meta":132,"style":132},"users.sort(Comparator.comparingInt((User u) -> u.age).reversed()\n                     .thenComparing(u -> u.name));\n",[19,875,876,905],{"__ignoreMap":132},[136,877,878,881,884,887,890,893,896,899,902],{"class":138,"line":139},[136,879,880],{"class":142},"users.",[136,882,883],{"class":260},"sort",[136,885,886],{"class":142},"(Comparator.",[136,888,889],{"class":260},"comparingInt",[136,891,892],{"class":142},"((User u) ",[136,894,895],{"class":146},"->",[136,897,898],{"class":142}," u.age).",[136,900,901],{"class":260},"reversed",[136,903,904],{"class":142},"()\n",[136,906,907,910,913,916,918],{"class":138,"line":162},[136,908,909],{"class":142},"                     .",[136,911,912],{"class":260},"thenComparing",[136,914,915],{"class":142},"(u ",[136,917,895],{"class":146},[136,919,920],{"class":142}," u.name));\n",[15,922,923,926,927,930,931,934,935,937,938,941,942,945,946,949,950,953,954,747],{},[57,924,925],{},"Generics"," give compile-time type safety and remove casts; remember ",[57,928,929],{},"type erasure","\nmeans ",[19,932,933],{},"List\u003CString>"," and ",[19,936,306],{}," share a runtime class (so no ",[19,939,940],{},"new T[]",", no\n",[19,943,944],{},"instanceof List\u003CString>","). Bounded wildcards follow ",[57,947,948],{},"PECS"," — Producer ",[19,951,952],{},"extends",",\nConsumer ",[19,955,956],{},"super",[10,958,960],{"id":959},"choosing-the-right-collection","Choosing the right collection",[15,962,963,964,966,967,969,970,972,973,30,975,977,978,980,981,983,984,986,987,989,990,66,993,996,997,30,1000,747],{},"Match the structure to the dominant operation: ordered\u002Findexed -> ",[19,965,65],{},"; uniqueness\n-> ",[19,968,81],{},"; key lookups -> ",[19,971,21],{},"; sorted\u002Frange -> ",[19,974,489],{},[19,976,84],{},"; insertion order\n-> ",[19,979,479],{},"; stack\u002Fqueue -> ",[19,982,101],{},"; priority -> ",[19,985,104],{},"; concurrent ->\n",[19,988,444],{},". Prefer the immutable factories (",[19,991,992],{},"List.of",[19,994,995],{},"Map.of",") for constants,\nand avoid the legacy synchronized ",[19,998,999],{},"Vector",[19,1001,1002],{},"Stack",[10,1004,1006],{"id":1005},"recap","Recap",[15,1008,1009,1010,1013,1014,1017,1018,1021,1022,1025,1026,934,1030,1034,1035,1037,1038,1045,1046,1048,1049,1057],{},"The framework gives you ",[57,1011,1012],{},"Lists"," (ordered), ",[57,1015,1016],{},"Sets"," (unique), ",[57,1019,1020],{},"Maps"," (key->value), and\n",[57,1023,1024],{},"Queues\u002FDeques",", each with implementations tuned for different access patterns.\n",[57,1027,1028],{},[19,1029,65],{},[57,1031,1032],{},[19,1033,21],{}," are the everyday defaults; understand how ",[19,1036,21],{},"'s\nbuckets, load factor, and treeification give O(1) average lookups, why ",[57,1039,1040,1042,1043],{},[19,1041,29],{},"\u002F\n",[19,1044,33],{}," must be consistent, and how ",[57,1047,743],{}," iteration and ",[57,1050,1051,1042,1054],{},[19,1052,1053],{},"Comparable",[19,1055,1056],{},"Comparator"," work. Pick by access pattern — lookup, order, uniqueness, concurrency — and\nthe right collection usually falls out.",[1059,1060,1061],"style",{},"html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}",{"title":132,"searchDepth":162,"depth":162,"links":1063},[1064,1065,1066,1067,1068,1069,1070,1071,1072,1073],{"id":12,"depth":162,"text":13},{"id":37,"depth":162,"text":38},{"id":203,"depth":162,"text":204},{"id":314,"depth":162,"text":315},{"id":455,"depth":162,"text":456},{"id":603,"depth":162,"text":604},{"id":736,"depth":162,"text":737},{"id":839,"depth":162,"text":840},{"id":959,"depth":162,"text":960},{"id":1005,"depth":162,"text":1006},"Java Collections Framework interview questions — List vs Set vs Map, ArrayList vs LinkedList, HashMap internals, fail-fast iterators, Comparable vs Comparator, generics and immutable collections.","medium","md","Java",{},"\u002Fblog\u002Fjava-collections-framework-list-map-set","\u002Fjava\u002Fcollections\u002Flist-map-set",{"title":5,"description":1074},"blog\u002Fjava-collections-framework-list-map-set","Lists, Maps & Sets","Collections","collections","2026-06-18","YXuKOg9cms0V1h7K8b1kd_OE8MjMaQv17pgibn7QB-0",1781808673081]