ray*_*0nd 11 salesforce apex-code
有没有办法检查列表是否包含某个元素?我查看了List函数,没有看到像Java或C#这样的contains()函数,所以我想知道其他人是如何处理它的.
我真的需要使用一个List我不能使用地图在这个例子中一样在这里
我现在拥有的真的很糟糕..
for (String s : allContacts)
{
for(String ic:insertedContacts)
{
if (s != ic )
{
errorContacts.add(s);
break;
}
break;
}
}
Run Code Online (Sandbox Code Playgroud)
Mat*_*t K 25
套装可能就是你要找的东西.
Set<String> mySet = new Set<String>();
Set.addAll()
方法将所有List元素添加到集合中.mySet.addAll(myList);
.Set.contains()
方法检查您要查找的元素的Set. 归档时间: |
|
查看次数: |
34446 次 |
最近记录: |