indexOf in a string array

前端 未结 6 930
太阳男子
太阳男子 2020-12-09 09:59

Is there anyway to get indexOf like you would get in a string.

output.add(\"1 2 3 4 5 6 7 8 9 10);  
String bigger[] = output.get(i).split(\" \");
int bigge         


        
6条回答
  •  Happy的楠姐
    2020-12-09 10:43

    Arrays do not have an indexOf() method; however, java.util.List does. So you can wrap your array in a list and use the List methods (except for add() and the like):

    output.add("1 2 3 4 5 6 7 8 9 10");  
    String bigger[] = output.get(i).split(" ");
    int biggerWhere = Arrays.asList(bigger).indexOf("10");
    

提交回复
热议问题