如何Arrays.asList(...)。包括(...)的作品? [英] How Arrays.asList(...).contains(...) works?
本文介绍了如何Arrays.asList(...)。包括(...)的作品?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下的code ..
String[] weekEnds={"0","6"};
for(int i=0;i<7;i++){
if(Arrays.asList(weekEnds).contains(i)){
System.out.println("I am in the array");
}
}
但它不进入if条件..我不知道在哪里我去错了..
在此先感谢..
but its not going into the if condition ..i dont know where im going wrong.. Thanks in Advance..
推荐答案
要么修改如果
条件
if(Arrays.asList(weekEnds).contains(String.valueOf(i))){
或更改您的阵列
Integer[] weekEnds={0,6};
这篇关于如何Arrays.asList(...)。包括(...)的作品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文