Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个字典数组,其中包含一些值和键。假设键 k1、k2、k3、k4 等...从这个数组中我需要找到键 k1 的对象,我知道同一字典的键 k3 的对象。是否有任何不使用迭代的方法,即使用谓词或键值编码(KVC)
如果不搜索数组,这是不可能的,因为k3无法知道它被用作字典之一中的键。事实上,它可以用作多个字典中的键。
k3
不,您需要遍历数组,检查键k3并k1在找到匹配项时返回。
k1