For Python, I can do something like array.index(element) to get the index for an element in array. How can I do this in Java using regular arrays, not arrayList? Is there a similar function?
For Python, I can do something like array.index(element) to get the index for an
Share
You can use
Arrays.asListthen useList.indexOf. The other suggestions to useArrays.binarySearchare good but require the array to be sorted.