CategoryHashSetHashMap
DefinitionA collection class that stores unique elements.A collection class that stores key-value pairs.
Data StorageStores values (elements) only.Stores key-value pairs.
DuplicatesDoes not allow duplicate elements.Keys cannot be duplicated, but values can be duplicated.
Null ValuesAllows only one null value.Allows one null key and multiple null values.
Class HierarchyCollection โ†’ Set โ†’ HashSetMap โ†’ HashMap
SynchronizationNot synchronized (not thread-safe).Not synchronized (not thread-safe).
PerformanceFast on average (O(1)) for basic operations.Fast on average (O(1)) for basic operations.
Internal ImplementationInternally uses a HashMap (stores values as keys with a dummy object as value).Uses its own hash table structure internally.
Key Methodsadd(), remove(), contains(), etc.put(), get(), remove(), containsKey(), etc.
Primary UseUsed to store a collection of unique elements.Used for efficient lookup/storage of values by key.
ExamplesMember IDs, unique tag lists, etc.Mapping structures like product ID โ†’ price, user ID โ†’ age.

Korean VER.

๊ธฐ์ค€HashSetHashMap
์ •์˜๊ณ ์œ ํ•œ ์š”์†Œ๋ฅผ ์ €์žฅํ•˜๋Š” ์ปฌ๋ ‰์…˜ ํด๋ž˜์Šคํ‚ค-๊ฐ’ ์Œ์„ ์ €์žฅํ•˜๋Š” ์ปฌ๋ ‰์…˜ ํด๋ž˜์Šค
๋ฐ์ดํ„ฐ ์ €์žฅ ๋ฐฉ์‹๊ฐ’(value)๋งŒ ์ €์žฅํ‚ค(key)์™€ ๊ฐ’(value)์„ ์Œ์œผ๋กœ ์ €์žฅ
์ค‘๋ณต ํ—ˆ์šฉ์ค‘๋ณต ์š”์†Œ๋ฅผ ํ—ˆ์šฉํ•˜์ง€ ์•Š์Œํ‚ค๋Š” ์ค‘๋ณต ํ—ˆ์šฉ๋˜์ง€ ์•Š์ง€๋งŒ, ๊ฐ’์€ ์ค‘๋ณต ๊ฐ€๋Šฅ
Null ํ—ˆ์šฉ๋‹จ ํ•˜๋‚˜์˜ null ๊ฐ’ ํ—ˆ์šฉํ•˜๋‚˜์˜ null ํ‚ค์™€ ์—ฌ๋Ÿฌ ๊ฐœ์˜ null ๊ฐ’ ํ—ˆ์šฉ
ํด๋ž˜์Šค ๊ณ„์ธตCollection โ†’ Set โ†’ HashSetMap โ†’ HashMap
๋™๊ธฐํ™”๋น„๋™๊ธฐํ™”๋จ๋น„๋™๊ธฐํ™”๋จ
์„ฑ๋Šฅํ‰๊ท ์ ์œผ๋กœ ๋น ๋ฆ„ (O(1))ํ‰๊ท ์ ์œผ๋กœ ๋น ๋ฆ„ (O(1))
๋‚ด๋ถ€ ๊ตฌํ˜„๋‚ด๋ถ€์ ์œผ๋กœ HashMap์„ ์‚ฌ์šฉ (๊ฐ’์€ ๋”๋ฏธ ๊ฐ์ฒด๋กœ ์ €์žฅ)์ž์ฒด์ ์œผ๋กœ ํ•ด์‹œ ํ…Œ์ด๋ธ” ๊ตฌ์กฐ ์‚ฌ์šฉ
์ฃผ์š” ๋ฉ”์„œ๋“œadd(), remove(), contains() ๋“ฑput(), get(), remove(), containsKey() ๋“ฑ
์‚ฌ์šฉ ๋ชฉ์ ๊ณ ์œ ํ•œ ์š”์†Œ๋“ค์˜ ์ง‘ํ•ฉ์„ ์ €์žฅํ•  ๋•Œ ์‚ฌ์šฉํ‚ค๋กœ ๊ฐ’์„ ํšจ์œจ์ ์œผ๋กœ ์กฐํšŒ/์ €์žฅํ•  ๋•Œ ์‚ฌ์šฉ
์˜ˆ์‹œํšŒ์› ID, ์œ ์ผํ•œ ํƒœ๊ทธ ๋ชฉ๋ก ๋“ฑ์ƒํ’ˆID โ†’ ๊ฐ€๊ฒฉ, ์‚ฌ์šฉ์žID โ†’ ๋‚˜์ด ๋“ฑ ๋งคํ•‘ ๊ตฌ์กฐ