[Kotlin] Collections API - associate(), associateBy, associateWith(), groupBy()
associate associate()를 이용하면 List를 Map 형태로 변형시킬 수 있습니다. 단, groupBy()와의 차이점이 있습니다. associate()는 groupBy()와는 달리, key가 중복이 되면 마지막 요소를 Map의 value로 저장합니다. (groupBy()는 Map 형태로 만들기 때문에 key가 중복이 되어도 List에 전부 담을 수 있습니다.) 1. associate() associate() 함수 public inline fun Iterable.associate(transform: (T) -> Pair): Map { val capacity = mapCapacity(collectionSizeOrDefault(10)).coerceAtLeast(16) return associat..