Skip to content

Kotlin 컬렉션 함수형 API 학습 테스트 (Transformation, Grouping, Combination, ControlFlow 확장 함수)#21

Merged
sh1mj1 merged 32 commits intodevfrom
kotlin/collection-functional-api
May 5, 2025
Merged

Kotlin 컬렉션 함수형 API 학습 테스트 (Transformation, Grouping, Combination, ControlFlow 확장 함수)#21
sh1mj1 merged 32 commits intodevfrom
kotlin/collection-functional-api

Conversation

@sh1mj1
Copy link
Owner

@sh1mj1 sh1mj1 commented May 5, 2025

✨ 작업 내용 요약:
Kotlin 컬렉션 데이터를 변형(Transformation), 그루핑(Grouping), 조합(Combination)하는 함수들과 객체 컨텍스트에서 흐름을 제어하는 확장 함수들의 사용법을 학습하기 위한 테스트 코드를 추가했습니다. 각 함수가 어떤 상황에서 유용하게 사용될 수 있는지 다양한 케이스를 통해 검증합니다.

파일별 작업 요약:

TransformationTest.kt

  • List, Set, Map 타입의 다양한 변형 메서드 테스트 (map, mapIndexed, mapNotNull, mapIndexedNotNull, associate, associateWith, associateBy 등) 추가
  • 변형 결과를 다른 컬렉션에 추가하는 mapTo, associateTo 등 테스트

GroupingTest.kt

  • groupBy를 사용한 키 기반 그룹화 테스트
  • groupingBy와 함께 eachCount, fold, reduce, aggregate를 활용한 그룹별 집계 테스트 추가

CombinationTest.kt

  • List 조합 연산(+, -, union, intersect, subtract) 테스트
  • Map 조합 연산(+, merge) 테스트
  • Map의 entries, keys, values를 이용한 union, intersect, subtract 테스트

ControlFlowExtensionTest.kt

  • 스코프 함수(let, run, with, apply, also)의 사용법 및 특징 테스트 추가
  • 조건부 함수(takeIf, takeUnless)의 사용법 테스트 추가
  • 스코프 함수와 조건부 함수를 조합하여 사용하는 패턴 테스트 추가

sh1mj1 added 30 commits April 15, 2025 15:56
map, flatMap, associate methods
associateTo, associateWithTo, associateByTo
remove flattening test in MappingTest.kt
first, find, firstOrNull, last, findLast, lastOrNull, indexOf, all, any, none method
lastIndexOf, indexOfFirst, indexOfLast
sorted, sortedDescending, sortedBy, sortedByDescending, reversed
compareBy, thenBy, thenByDescending, naturalOrder, reverseOrder 추가
count, sum, sumOf, average, max, maxOfOrNull, reduce, fold, runningReduce, runningFold
groupBy, groupingBy.eachCount, groupingBy.fold, groupingBy.reduce, groupingBy.aggregate
distinct, distinctBy, zip, zipWithNext, windowed, chunked, partition, unzip
zip, zipWithNext, windowed, chunked, partition, unzip
mapKeys, mapValues, entries, keys, values
sh1mj1 added 2 commits May 5, 2025 15:58
리스트 조합 연산(+, -, union, intersect, subtract)
맵 조합 연산(+, merge, entries/keys/values를 사용한 union, intersect, subtract
스코프 함수에 대한 테스트: let, run, with, apply, also.

조건부 함수에 대한 테스트: takeIf, takeUnless.
@sh1mj1 sh1mj1 requested a review from Copilot May 5, 2025 07:17
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a comprehensive suite of tests to explore and validate Kotlin’s collection functions, including transformation, sorting, searching, grouping, flattening, filtering, control flow extensions, combination, and aggregation. Key changes include adding new test files for each functional area and leveraging Kotlin’s functional APIs to handle various collection operations.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
TransformationTest.kt Added tests for various List, Set, and Map transformation functions.
SortingTest.kt Tests added for numerous sorting methods including sortedWith and natural order sorting.
SearchingTest.kt New tests demonstrating element search functions and handling of missing elements.
MappingTest.kt Covering mapping operations including associate and mapIndexed variants.
GroupingTest.kt Introduced tests for grouping functions (groupBy, groupingBy, fold, reduce, aggregate).
FlatteningTest.kt Added tests to validate flattening collections using flatMap and similar APIs.
FilteringTest.kt Tests for filtering and partitioning of collections have been expanded.
ControlFlowExtensionTest.kt New tests showcasing scope functions and conditional execution with takeIf/takeUnless.
CombinationTest.kt Added tests for combining collections and merging maps.
AggregationTest.kt Comprehensive aggregation tests including sum, average, reduce, fold, and running-fold operations.

@sh1mj1 sh1mj1 changed the title Kotlin 컬렉션 함수형 API 학습 테스트 (Aggregation, Sorting, Searching) 추가 Kotlin 컬렉션 함수형 API 학습 테스트 (Transformation, Grouping, Combination, ControlFlow 확장 함수) May 5, 2025
@sh1mj1 sh1mj1 merged commit b22ee42 into dev May 5, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants