I have
int myArray[]= {12,23,10,22,10};
So i want to get index of 23
from myArray
with out iterating any loop (for
,while
...) .
I would do something like Arrays.asList(myArray).indexOf(23)
This is not work for me . I get -1
as output .
This is work with String[]
Like
String myArray[]= {"12","23","10","22","10"};
Arrays.asList(myArray).indexOf("23")
So why this is not working with int[]
? ?