mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-20 15:10:05 +08:00
feat: prepend & append
This commit is contained in:
parent
c89637a429
commit
a65f56fa26
@ -122,6 +122,20 @@ object Util {
|
|||||||
val currentMap = (to[k] as Map<*, *>).toMutableMap()
|
val currentMap = (to[k] as Map<*, *>).toMutableMap()
|
||||||
currentMap += v
|
currentMap += v
|
||||||
to[k] = currentMap
|
to[k] = currentMap
|
||||||
|
} else if (v is List<*>) {
|
||||||
|
if (k.startsWith("+")) { // prepend
|
||||||
|
val dstKey = k.removePrefix("+")
|
||||||
|
var currentList = (to[dstKey] as List<*>).toMutableList()
|
||||||
|
currentList = (v + currentList).toMutableList()
|
||||||
|
to[dstKey] = currentList
|
||||||
|
} else if (k.endsWith("+")) { // append
|
||||||
|
val dstKey = k.removeSuffix("+")
|
||||||
|
var currentList = (to[dstKey] as List<*>).toMutableList()
|
||||||
|
currentList = (currentList + v).toMutableList()
|
||||||
|
to[dstKey] = currentList
|
||||||
|
} else {
|
||||||
|
to[k] = v
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
to[k] = v
|
to[k] = v
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user