android list集合中有相识查找的方法吗

 我来答
QQMSD8
2016-01-04 · 知道合伙人软件行家
QQMSD8
知道合伙人软件行家
采纳数:6788 获赞数:13239
没有做不到,只有想不到,帮助别人的同时也是对自己的提升

向TA提问 私信TA
展开全部
list集合有个方法 contains(Object),就是用来查找集合中是否存在某个对象的,以下为JDK中的源代码:
/**
* Returns <tt>true</tt> if this list contains the specified element.
* More formally, returns <tt>true</tt> if and only if this list contains
* at least one element <tt>e</tt> such that
* <tt>(o==null ? e==null : o.equals(e))</tt>.
*
* @param o element whose presence in this list is to be tested
* @return <tt>true</tt> if this list contains the specified element
*/
public boolean contains(Object o) {
return indexOf(o) >= 0;
}
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式