How to Check if an ArrayList Contain 2 values?

前端 未结 6 1340
忘掉有多难
忘掉有多难 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:09

    Simply use Arrays class

    person.containsAll(Arrays.asList("Jasha","Joe"));
    

提交回复
热议问题