I am working on a multi-platform project where code in commonMain cannot import Java packages. I want to implement/use a thread-safe HashMap exactly like ConcurrentHashMap in Java. How can I do this purely in Kotlin?
2 Likes
It would be useful to have an example of what exactly you’re trying to do.
But I believe this might be what you’re looking for:
Hope that helps
ConcurrentMap is from a Java package, as I mentioned in the question, I need it purely in Kotlin. Basically, I need my HashMap to be thread-safe so multiple can threads can do insert/remove.
@rajkukadia Have you looked at : GitHub - touchlab/Stately: Kotlin Multiplatform State Library