작성
·
813
8
## EnumMap
Javadoc에 따르면
"when the map is created. Enum maps are represented internally as arrays. This representation is extremely compact and efficient."
-> hashmap 은 key를 bucket에 저장하고각 bucket이 linked list를 참조 하고 있음. (linkedlist에는 hash(key)가 같은 element가 들어감) 그런데 enummap 의 경우 key로 사용할 값이 제한되어 있으므로, 그 갯수만큼 길이를 가진 array를 선언하고. 해당 index에 값을 넣으면 됨.
## EnumSet
Javadoc에 따르면
"when the set is created. Enum sets are represented internally as bit vectors."
-> hashset은 hashmap 과 같은데 map의 value가 있다 없다를 표현하는 지시자 같은 값이 들어감. enumset은 값이 있다 없다만 표시하면 되니까 enummap 처럼 array로 구현하지 않고 10101011 같은 bitvector로 구현이 가능.