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 HierarchyCollectionSetHashSetMapHashMap
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 → 나이 등 매핑 구조