Check if a String is in an ArrayList of Strings

后端 未结 3 911
感情败类
感情败类 2020-12-14 14:31

How can I check if a String is there in the List?

I want to assign 1 to temp if there is a result, 2

3条回答
  •  北海茫月
    2020-12-14 14:47

    The List interface already has this solved.

    int temp = 2;
    if(bankAccNos.contains(bakAccNo)) temp=1;
    

    More can be found in the documentation about List.

提交回复
热议问题