Skip to content

Commit

Permalink
Simplify actual implementations.
Browse files Browse the repository at this point in the history
  • Loading branch information
ychescale9 committed May 24, 2023
1 parent e09238c commit b6ca1b1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,15 @@ import java.util.concurrent.ConcurrentHashMap
internal actual class ConcurrentMutableMap<Key : Any, Value : Any> {
private val map = ConcurrentHashMap<Key, Value>()

actual val size: Int
get() = map.size
actual val size: Int get() = map.size

actual val values: Collection<Value>
get() = map.values
actual val values: Collection<Value> get() = map.values

actual operator fun get(key: Key): Value? {
return map[key]
}
actual operator fun get(key: Key): Value? = map[key]

actual fun put(key: Key, value: Value): Value? {
return map.put(key, value)
}
actual fun put(key: Key, value: Value): Value? = map.put(key, value)

actual fun remove(key: Key): Value? {
return map.remove(key)
}
actual fun remove(key: Key): Value? = map.remove(key)

actual fun clear() {
map.clear()
}
actual fun clear() = map.clear()
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,15 @@ import co.touchlab.stately.collections.IsoMutableMap
internal actual class ConcurrentMutableMap<Key : Any, Value : Any> {
private val map = IsoMutableMap<Key, Value>()

actual val size: Int
get() = map.size
actual val size: Int get() = map.size

actual val values: Collection<Value>
get() = map.values
actual val values: Collection<Value> get() = map.values

actual operator fun get(key: Key): Value? {
return map[key]
}
actual operator fun get(key: Key): Value? = map[key]

actual fun put(key: Key, value: Value): Value? {
return map.put(key, value)
}
actual fun put(key: Key, value: Value): Value? = map.put(key, value)

actual fun remove(key: Key): Value? {
return map.remove(key)
}
actual fun remove(key: Key): Value? = map.remove(key)

actual fun clear() {
map.clear()
}
actual fun clear() = map.clear()
}

0 comments on commit b6ca1b1

Please sign in to comment.