mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-13 06:30:13 +08:00
Add toString
for TypeSafeMap implementations
This commit is contained in:
parent
49c6734722
commit
1ffa9eb957
@ -73,6 +73,10 @@ internal open class TypeSafeMapImpl(
|
|||||||
return map.hashCode()
|
return map.hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "TypeSafeMapImpl(map=$map)"
|
||||||
|
}
|
||||||
|
|
||||||
override operator fun <T> get(key: TypeKey<T>): T =
|
override operator fun <T> get(key: TypeKey<T>): T =
|
||||||
map[key.name]?.uncheckedCast() ?: throw NoSuchElementException(key.toString())
|
map[key.name]?.uncheckedCast() ?: throw NoSuchElementException(key.toString())
|
||||||
|
|
||||||
@ -94,6 +98,10 @@ internal class MutableTypeSafeMapImpl(
|
|||||||
return map.hashCode()
|
return map.hashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "MutableTypeSafeMapImpl(map=$map)"
|
||||||
|
}
|
||||||
|
|
||||||
override operator fun <T> set(key: TypeKey<T>, value: T) {
|
override operator fun <T> set(key: TypeKey<T>, value: T) {
|
||||||
map[key.name] = value
|
map[key.name] = value
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user