How to Check if an ArrayList Contain 2 values?

前端 未结 6 1187
忘掉有多难
忘掉有多难 2021-01-19 09:34

is there any way to check if a collection contain a value or more with better performance than looping twice with contains?

in other meaning something that would loo

6条回答
  •  隐瞒了意图╮
    2021-01-19 10:07

    You have to search each string.

    UPDATED

    List list=new ArrayList();
    list.add("Joe");
    list.add("Jasha");
    if(person.containsAll(list))
    {
       //do something
    }
    

提交回复
热议问题