gpt4 book ai didi

java - SparseArray 上 putAll 的等效方法

转载 作者:行者123 更新时间:2023-11-29 20:11:36 26 4
gpt4 key购买 nike

我想知道在 SparseArray 类的 HashMap 类上是否有与 putAll 方法等效的方法?

我很困惑是否应该使用 appendputsetValueAt 以及它是否会给我相同的结果。

是 SparseArrayX.append(i,SparseArrayY.valueAt(i)) = MapX.put(MapY); ?

最佳答案

SparseArray 类没有可用的 putAll() 方法。 Android Docs

append(int key, E value)
Puts a key/value pair into the array, optimizing for the case where the key is greater than all existing keys in the array.

put(int key, E value)
Adds a mapping from the specified key to the specified value, replacing the previous mapping from the specified key if there was one.

setValueAt(int index, E value)
Given an index in the range 0...size()-1, sets a new value for the indexth key-value mapping that this SparseArray stores.

关于java - SparseArray 上 putAll 的等效方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34744026/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com