Conversation
map, flatMap, associate methods
associateTo, associateWithTo, associateByTo
remove flattening test in MappingTest.kt
…in List and Map structures
…larations for type clarity
first, find, firstOrNull, last, findLast, lastOrNull, indexOf, all, any, none method
lastIndexOf, indexOfFirst, indexOfLast
sorted, sortedDescending, sortedBy, sortedByDescending, reversed
compareBy, thenBy, thenByDescending, naturalOrder, reverseOrder 추가
sort, sortDescending, sortBy, sortWith, reverse
toSortedMap
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
리스트 조합 연산(+, -, union, intersect, subtract) 맵 조합 연산(+, merge, entries/keys/values를 사용한 union, intersect, subtract
스코프 함수에 대한 테스트: let, run, with, apply, also. 조건부 함수에 대한 테스트: takeIf, takeUnless.
There was a problem hiding this comment.
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. |
app/src/test/java/com/example/learningtest/collection/functional/AggregationTest.kt
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✨ 작업 내용 요약:
Kotlin 컬렉션 데이터를 변형(Transformation), 그루핑(Grouping), 조합(Combination)하는 함수들과 객체 컨텍스트에서 흐름을 제어하는 확장 함수들의 사용법을 학습하기 위한 테스트 코드를 추가했습니다. 각 함수가 어떤 상황에서 유용하게 사용될 수 있는지 다양한 케이스를 통해 검증합니다.
파일별 작업 요약:
TransformationTest.ktmap,mapIndexed,mapNotNull,mapIndexedNotNull,associate,associateWith,associateBy등) 추가mapTo,associateTo등 테스트GroupingTest.ktgroupBy를 사용한 키 기반 그룹화 테스트groupingBy와 함께eachCount,fold,reduce,aggregate를 활용한 그룹별 집계 테스트 추가CombinationTest.kt+,-,union,intersect,subtract) 테스트+,merge) 테스트union,intersect,subtract테스트ControlFlowExtensionTest.ktlet,run,with,apply,also)의 사용법 및 특징 테스트 추가takeIf,takeUnless)의 사용법 테스트 추가