Questions tagged [kotlin]
Kotlin is a statically typed programming language that compiles to JVM bytecode, JavaScript, or native binaries.
251 questions
0
votes
0
answers
11
views
LazyColumn compared to RecyclerView in Jetpack Compose
I’m building a simple Food Manager screen using Jetpack Compose.
The UI allows users to:
Select a food category (Fruit, Vegetable, Snack, Drink).
Select an item from that category.
Add the ...
0
votes
0
answers
36
views
Spring 7 RouterFunctions and BeanRegistrarDsl med Kotlin
I am looking for a good way to structure my Kotlin code using Spring Boot 4 and Spring 7. The new features I am using are:
Reflectionless dependency injection via ...
0
votes
0
answers
41
views
ReadWrite Lock compatible with coroutines
A while ago I wrote for my own needs a (non-reentrant) read-write lock for kotlin's coroutines. I got no reactions on the relevant github thread. I think it's a nice code, so I thought I'd share it ...
3
votes
1
answer
49
views
Kotlin coroutines in Jetpack Compose: Dispatcher-usage
I have implemented a timer in Jetpack Compose. It counts down a given amount of seconds. The remaining seconds are displayed. Moreover the past and remaining seconds are displayed as a circular graph. ...
3
votes
1
answer
89
views
Jetpack Compose registration screen
I’ve created a Jetpack Compose function called RegisterName for a registration screen where users input a nickname and agree to an EULA before proceeding. The function works as intended, but I’m ...
3
votes
0
answers
78
views
Bridging the gap between Spring's JdbcTemplate and Kotlin coroutines
I'm learning about Kotlin coroutines. I'm wondering if I can use them to increase the throughput of my spring-boot application which is currently very heavily dependent on jdbc connections, without ...
2
votes
2
answers
85
views
LFU cache in Kotlin
I've been working on the classic LFU (Least Frequently Used) cache running in O(1) time problem lately and, as a student, I kind of struggled with the algorithms I found online. I got most of the idea ...
2
votes
1
answer
120
views
Kotlin Compose authentication with Google and Facebook using a CircularProgressIndicator for UI loading
I had this problem: https://stackoverflow.com/questions/78528358/how-to-prevent-circularprogressindicator-from-freezing-during-authentication-in
Now after fixing it, I want to make sure that this is ...
5
votes
1
answer
96
views
Calculating a weight from a tag using kotlin
I'm not really happy with the below solution.
Background is that I am receiving results from a graphql query that includes tags, and I want to translate these tags into weights and save those results ...
4
votes
1
answer
202
views
Logic to check if app was launched for the first time using DataStore
I have written a dummy code to check if an app was launched for the time using DataStore. It is working however i want to know if this can be optimised and i also observed a small glitch initially ...
5
votes
1
answer
126
views
Compose Grid With Lists
I have created a Grid out of using the new concept of List in Kotlin. I'm open to any feed back to how this code could be improved. It functions as expected and I'm happy with the results.
...
2
votes
1
answer
100
views
Handling View State & Side Effects with Lifecycle Awareness in Jetpack Compose MVI Composable
I'm working on a stateful Jetpack Compose composable that follows the MVI architecture. I'm using collectAsStateWithLifecycle() to observe the view state from a view model, but I'm unsure about the ...
4
votes
1
answer
138
views
Turn List<Either<A, B>> into Either<A, List<B>>
I'm trying to integrate Arrow-kt's Either into an application that needs to parse and validate filter input. This input is a comma separated list of criteria. ...
5
votes
2
answers
279
views
Kotlin: scoped functions with try/catch support
I'm working with Kotlin for some time. Compared to Java it's more concise. Still it has some legacy inherited from Java. For example the try-catch-construct. Though it has been upgraded from a ...
3
votes
1
answer
78
views
Recursive item recipe creation
I was trying to write code that would get as input a recipe consisting of item materials and would create all possible recipes that could be used to create craftable of the recipe.
The Recipe is ...