When I try:
print( uid.contains(randomUids));
I get a false.
Your code asks if uid
(a List
of String
s) contains randomUids
(another List
of String
s). It returns false because uid
's elements are not List
s; they're String
s.
Presuming that you want the nth element of uid
to correspond to the nth element of url
, and you can guarantee that uid.length == url.length
, you can construct a Map
of UIDs to URLs:
assert(uid.length == url.length);
var uidMap = <String, String>{
for (var i = 0; i < uid.length; i += 1)
uid[i]: url[i],
};
And then you can iterate over randomUids
and do lookups:
for (var uid in randomUids) {
if (uidMap.containsKey(uid)) {
print(uidMap[uid]);
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…