TIL

240122 TIL

์˜ค๋Š˜ ํ•™์Šตํ•œ ๋‚ด์šฉ ์ฝ”ํ‹€๋ฆฐ ์ฝ”๋ฃจํ‹ด 2์žฅ ์‹œํ€ธ์Šค ๋นŒ๋” Collection๊ณผ ๋น„๊ตํ•˜์—ฌ Sequence๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์˜ ์žฅ์ ์€ ๋ฌด์—‡์ผ๊นŒ์š”? Effective Kotlin Second Edition 54. Prefer Sequences for big collections with more than one processing step ๋‚ด์ผ๋ฐฐ์›€์บ ํ”„ 1์ฃผ์ฐจ ๊ฐ•์˜ Leetcode https://leetcode.com/problems/set-mismatch/description lateinit var - primitive type์€ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๋‹ค. - ํƒ€์ž…์€ ๋ฐ˜๋“œ์‹œ non-nullable ์ด์–ด์•ผ ํ•œ๋‹ค. ์‚ฌ์šฉํ•˜๋Š” ์‹œ์ ์— ๊ฐ’์„ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค๋Š” lateinit๊ณผ ๊ฐ’์ด ์—†๋‹ค๋Š” ์˜๋ฏธ์˜ nullable์€ ์„œ๋กœ ์–ด์šธ๋ฆฌ์ง€ ์•Š์•„์„œ๋ผ๊ณ  ์ด..

2024.01.22 ๊ฒŒ์‹œ๋จ

TIL

240119 TIL

์˜ค๋Š˜ ํ•™์Šตํ•œ ๋‚ด์šฉ ๋ฆฌํŠธ ์ฝ”๋“œ ๋ฌธ์ œ ์–ด์ œ ํ’€์—ˆ๋˜ ๋ฌธ์ œ ๋•๋ถ„์— ๋งž์ถœ ์ˆ˜ ์žˆ์—ˆ๋‹ค. https://leetcode.com/problems/minimum-falling-path-sum Android ํ”„๋กœ์ ํŠธ ํ•™์Šต - Fragment์—์„œ Observe ํ•  ๋•Œ, viewLifecycleOwner๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ์ด์œ ๋Š” ๋ฌด์—‡์ผ๊นŒ์š”? - LiveData์˜ Object๋ฅผ ์—…๋ฐ์ดํŠธํ•˜๊ธฐ ์œ„ํ•œ setValue, postValue ํ•จ์ˆ˜์˜ ์ฐจ์ด๋ฅผ ๋งํ•ด์ฃผ์„ธ์š”. - Fragment์˜ onCreateView์™€ onViewCreated๋Š” ์–ด๋–ค ์ฐจ์ด๊ฐ€ ์žˆ์„๊นŒ์š”? ์ž์„ธํ•œ ํ•™์Šต ๋‚ด์šฉ ์ •๋ฆฌ https://dodobest.notion.site/01-19-9bc729f4961d40d3810eebaa84d743cd?pvs=4 ์˜ค๋Š˜ ํ•™์Šตํ•˜์ง€ ๋ชปํ•œ ๋‚ด์šฉ ์™œ ..

2024.01.19 ๊ฒŒ์‹œ๋จ

TIL

240118 TIL

์˜ค๋Š˜ ํ•™์Šตํ•œ ๋‚ด์šฉ ๋‚ด์ผ๋ฐฐ์›€์บ ํ”„ - Android ํ•™์Šต ์ž๋ฃŒ ~ 10. ์Šค์ฝ”ํ”„ ํ•จ์ˆ˜(์™„) - ํ”„๋กœํผํ‹ฐ๊ฐ€ ์žˆ๋Š” Kotlin ํด๋ž˜์Šค๋ฅผ Java์—์„œ ์‚ฌ์šฉํ•  ๋•Œ, ํ”„๋กœํผํ‹ฐ ์ด๋ฆ„์ด is๋กœ ์‹œ์ž‘ํ•˜๋ฉด ๊ฒŒํ„ฐ์—๋Š” get์„ ๋ถ™์ด์ง€ ์•Š๊ณ  ์›๋ž˜ ์ด๋ฆ„์„ ๊ทธ๋Œ€๋กœ ์‚ฌ์šฉํ•˜๋ฉฐ, ์„ธํ„ฐ์—๋Š” is๋ฅผ set์œผ๋กœ ๋ฐ”๊พผ ์ด๋ฆ„์„ ์‚ฌ์šฉํ•œ๋‹ค. class Person(val isMarried: Boolean) // ์ž๋ฐ”์—์„œ ์‚ฌ์šฉ์‹œ Person person = new Person(false); System.out.println(person.isMarried); // false person.setMarried(true); System.out.println(person.isMarried); // true ๊ฐœ๋ฐœ์ž ๋ฉด์ ‘ ์ค€๋น„ ๋ฐฉ๋ฒ• ๋ฉด์ ‘์€ ์•”๊ธฐ์—์„œ ์‹œ์ž‘ํ•˜๊ณ , ์•”๊ธฐ..

2024.01.18 ๊ฒŒ์‹œ๋จ

TIL

240117 TIL

์˜ค๋Š˜ ํ•™์Šตํ•œ ๋‚ด์šฉ ๋ฆฌํŠธ์ฝ”๋“œ ๋ฌธ์ œ ๋ฆฌ์ŠคํŠธ์—์„œ ์ค‘๋ณต์ด ์žˆ๋Š”์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋Š” ๊ฐ€์žฅ ๋น ๋ฅธ ๋ฐฉ๋ฒ•์€ hashSet์„ ํ™œ์šฉํ•˜๋Š” ๊ฒƒ์ด ๋งž์„๊นŒ? GPT4์— ๋”ฐ๋ฅด๋ฉด ๊ทธ๋ ‡๋‹ค๊ณ  ํ•œ๋‹ค.. https://leetcode.com/problems/unique-number-of-occurrences/description/ ๋‚ด์ผ๋ฐฐ์›€์บ ํ”„ - Android ํ•™์Šต ์ž๋ฃŒ ~ 7.ํด๋ž˜์Šค์™€ ์„ค๊ณ„ - kotlin์˜ MutableList๋Š” interface์ด๊ณ , mutableListOf๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ArrayList ๊ตฌํ˜„์ฒด๊ฐ€ ์‚ฌ์šฉ๋œ๋‹ค. - Kotlin list collection์˜ add, remove ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•ด์„œ ์ค‘๊ฐ„ ๊ฐ’์„ ์‚ญ์ œํ•˜๊ฑฐ๋‚˜ ๋”ํ•˜๋ฉด ๊ทธ ์ดํ›„์— ์žˆ๋Š” ๊ฐ’๋“ค์ด ํ•œ ์นธ์”ฉ ๋’ค๋กœ ์ด๋™ํ•˜๊ฑฐ๋‚˜ ์•ž์œผ๋กœ ์ด๋™ํ•œ๋‹ค. ๊ทธ๋ž˜์„œ O(n) ์‹œ๊ฐ„์ด ์†Œ์š”๋˜๊ธฐ ๋•Œ๋ฌธ์—..

2024.01.17 ๊ฒŒ์‹œ๋จ

TIL

240116 TIL

์˜ค๋Š˜ ํ•™์Šตํ•œ ๋‚ด์šฉ ๋ฆฌํŠธ์ฝ”๋“œ ๋ฌธ์ œ Set์˜ ๊ตฌํ˜„ ์›๋ฆฌ์— ๋Œ€ํ•ด ํ•™์Šตํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค https://leetcode.com/problems/insert-delete-getrandom-o1/description/ ๋‚ด์ผ๋ฐฐ์›€์บ ํ”„ - Android ํ•™์Šต ์ž๋ฃŒ - ์•ˆ๋“œ๋กœ์ด๋“œ๋Š” JVM์ด ์•„๋‹Œ ์•ˆ๋“œ๋กœ์ด๋“œ ๋Ÿฐํƒ€์ž„(ART)๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. - Kotlin์—์„œ String์€ Primitive type(๊ธฐ๋ณธ ํƒ€์ž…)์ด ์•„๋‹Œ Class๋‹ค. - ===๋Š” ๊ฐ์ฒด์˜ ์ฐธ์กฐ ๊ฐ’์„ ๋น„๊ตํ•œ๋‹ค. - Kotlin์˜ === ๋Š” Java์˜ ==์™€ ๋™์ผํ•˜๋‹ค. - Kotlin์˜ == ๋Š” Java์˜ equals์™€ ๋™์ผํ•˜๋‹ค. - String Interning์— ์˜ํ•ด ์ปดํŒŒ์ผ ๋‹จ๊ณ„์—์„œ ๋™์ผํ•œ String์„ ๊ฐ€๋ฆฌํ‚ค๋Š” ๋‹ค๋ฅธ ๋ณ€์ˆ˜๊ฐ€ ๋™์ผํ•œ ๊ฐ์ฒด ์ฃผ์†Ÿ๊ฐ’์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๋‹ค. - S..

2024.01.16 ๊ฒŒ์‹œ๋จ

TIL

์Šคํƒ€ํ„ฐ ๋…ธํŠธ

๋‚ด๊ฐ€ ์•ฑ ํŠธ๋ž™(iOS, Android)์— ์ฐธ์—ฌํ•œ ๊ณ„๊ธฐ๋Š” ๋ฌด์—‡์ธ๊ฐ€์š”? ์˜ฌํ•ด 2์›”์— ํ•™๊ต๋ฅผ ์กธ์—…ํ•˜๊ณ , ํ•˜๋ฐ˜๊ธฐ ์ฑ„์šฉ๊นŒ์ง€ ๋…ํ•™๋ณด๋‹ค๋Š” ๊ต์œก ํ”„๋กœ๊ทธ๋žจ์— ์ฐธ์—ฌํ•˜๋Š” ๊ฒƒ์ด ์ข‹๋‹ค๊ณ  ์ƒ๊ฐํ•ด์„œ ์ฐธ์—ฌํ–ˆ์Šต๋‹ˆ๋‹ค. ๋…ํ•™ํ•  ๋•Œ, ์ •๋‹ต์ด ์—†๋Š” ๊ตฌํ˜„์— ๋Œ€ํ•œ ๋‚˜์˜ ์„ ํƒ๊ณผ ๊ทผ๊ฑฐ๊ฐ€ ์˜ณ์€์ง€ ํŒ๋‹จํ•˜๊ธฐ ํž˜๋“ค์—ˆ๋Š”๋ฐ, ํ•™์Šต ์‹œ๊ฐ„ ๋™์•ˆ ํ˜„์—… ๊ฐœ๋ฐœ์ž์ธ ํŠœํ„ฐ ๋‹˜๋“ค์ด ์ƒ์ฃผํ•˜์—ฌ ์งˆ๋ฌธ์„ ๋ฐ›์•„์ค€๋‹ค๋Š” ์ ์ด ์ข‹์•˜์Šต๋‹ˆ๋‹ค. ๋‚ด๊ฐ€ ์ดํ•ดํ•œ ์•ฑ๊ฐœ๋ฐœ์ž๋Š” ์–ด๋–ค ์—ญํ• ์„ ํ•˜๋Š” ์‚ฌ๋žŒ์ธ๊ฐ€์š”? ๋ชจ๋ฐ”์ผ ํ™˜๊ฒฝ์—์„œ ์‚ฌ์šฉ์ž์—๊ฒŒ ์ œ๊ณต๋˜๋Š” ์„œ๋น„์Šค๋ฅผ ๊ฐœ๋ฐœํ•˜๋Š” ์‚ฌ๋žŒ์ด๋ผ๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ๊ฐœ๋ฐœ์„ ๊ฒฝํ—˜ํ•ด๋ณด์…จ๋‚˜์š”? ํ•ด๋ณด์…จ๋‹ค๋ฉด ์–ด๋–ค ๊ฒฝํ—˜์„ ํ•˜์…จ๋Š”์ง€๋ฅผ ์ž‘์„ฑํ•ด์ฃผ์‹œ๊ณ , ์•„๋‹ˆ๋ผ๋ฉด ์•ฑ๊ฐœ๋ฐœ์— ๋Œ€ํ•ด ์ฐพ์•„๋ณธ ๊ฒƒ์„ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”. ํƒ€ ๊ต์œกํ”„๋กœ๊ทธ๋žจ์—์„œ ํŒ€ํ”„๋กœ์ ํŠธ๋กœ ๋Œ€์ค‘๊ตํ†ต ๋ง‰์ฐจ ์ •๋ณด ์•ฑ์„ ๊ฐœ๋ฐœํ•œ ๊ฒฝํ—˜์ด ์žˆ์Šต๋‹ˆ๋‹ค. https://gi..

2024.01.16 ๊ฒŒ์‹œ๋จ

ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

์„ค์ •

Android Studio Junit5 ์„ค์ • ๋ฐฉ๋ฒ•(Test events were not received)

Android Stduio์—์„œ ์œ ๋‹› ํ…Œ์ŠคํŠธ๋ฅผ ์‹คํ–‰ํ•œ ํ›„, Test events were not received ์˜ค๋ฅ˜๊ฐ€ ๋‚˜์™”๋‹ค. org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:testDebugUnitTest'. Caused by: org.gradle.api.tasks.testing.TestExecutionException: No tests found for given includes: [com.github.dodobest.fruitcardgame.model.game.CardDeckImplTest](--tests filter) Junit5๋ฅผ ์‹คํ–‰ํ•˜๊ธฐ ์œ„ํ•œ gradle ์„ค์ •์ด ๋ˆ„๋ฝ๋˜์–ด ๊ทธ๋ ‡๋‹ค. Android ๊ณต์‹ ๋ฌธ์„œ์—..

2024.01.01 ๊ฒŒ์‹œ๋จ

ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

๊ธฐํƒ€

Leetcode ํ”„๋ฆฌ๋ฏธ์—„ ๊ตฌ๋งค

LeetCode๋กœ ์ฝ”๋”ฉํ…Œ์ŠคํŠธ๋ฅผ ์ค€๋น„ํ•˜๊ณ  ์žˆ๋Š”๋ฐ, Daily Problem์„ ๋งค์ผ ํ‘ธ๋Š” ๊ฒƒ์„ ์ง€ํ‚ค๊ธฐ ์–ด๋ ค์› ๋‹ค. ๋˜ํ•œ ๋‹จ์ˆœํžˆ ๋ฌธ์ œ๋ฅผ ํ‘ผ๋‹ค๊ณ  ํ•ด์„œ, ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ์‚ฌ๊ณ ๋ ฅ์ด๋‚˜ ์•„์ด๋””์–ด๊ฐ€ ์ฆ์ง„๋œ๋‹ค๋Š” ๋Š๋‚Œ์„ ๋ฐ›์ง€ ๋ชปํ–ˆ๋‹ค. ๊ฐ€๊ฒฉ์€ ๋น„์‹ธ์ง€๋งŒ, FAANG์—์„œ ์ถœ์ œํ•˜๋Š” ์ฝ”๋”ฉํ…Œ์ŠคํŠธ ๋ฌธ์ œ์™€ ์ถœ์ œ ๋นˆ๋„๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๊ณ , ์ง€๋ถˆํ•œ ๊ธˆ์•ก์ด ๋ฐ์ผ๋ฆฌ ๋ฌธ์ œ๋ฅผ ํ‘ธ๋Š”๋ฐ ๊ฐ•์ œ์„ฑ์„ ์ค„ ๊ฒƒ ๊ฐ™์•„์„œ ๊ตฌ๋งคํ–ˆ๋‹ค. ๋˜ํ•œ ์œ ๋ฃŒ ๊ฒฐ์ œ ์ดํ›„, ์–ผ๋งˆ๋‚˜ ํ•™์Šตํ–ˆ๋Š”์ง€๋Š” ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ์•„์ด๋””๋„ ์ƒˆ๋กœ ์ƒ์„ฑํ–ˆ๋‹ค.

2023.11.26 ๊ฒŒ์‹œ๋จ

ํฌ์ŠคํŒ… ์ธ๋„ค์ผ ์ด๋ฏธ์ง€

ํ•™์Šต

Android popUpTo๊ฐ€ ๋™์ž‘ํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ

Android Navigation Component์—์„œ ์ œ๊ณตํ•˜๋Š” popUpTo๋ฅผ ์„ค์ •ํ–ˆ์Œ์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ , ๋’ค๋กœ๊ฐ€๊ธฐ๋ฅผ ๋ˆŒ๋ €์„ ๋•Œ, ํ•ด๋‹น Fragment๋กœ ์ด๋™ํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ์›์ธ popUpTo๋กœ ์„ค์ •ํ•œ Fragment๊ฐ€ backstack์— ์กด์žฌํ•˜์ง€ ์•Š์•„, popUpTo๊ฐ€ ๋™์ž‘ํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ์ด๊ฒƒ์€ RuntimeException์œผ๋กœ ๋ฐœ์ƒํ•˜์ง€ ์•Š๊ณ , Logcat์—์„œ I(info)๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค. ์•„๋ž˜ ์‚ฌ์ง„ Logcat ๋งˆ์ง€๋ง‰์— destionation์ธ Fragment๊ฐ€ backstack์— ์กด์žฌํ•˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์—, ์„ค์ •ํ•œ popUpTo๊ฐ€ ๋ฌด์‹œ๋˜๋Š” ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์•„๋ž˜ ์Šคํƒ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ ๋‹ต๋ณ€์„ ๋ณด๊ณ  MessageFragment๊ฐ€ backstack์—์„œ ์ง€์›Œ์ง€๋Š”์ง€ ํ™•์ธํ•ด๋ด์•ผ๊ฒ ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ž˜..

2023.11.13 ๊ฒŒ์‹œ๋จ