list java get index code example
Example 1: java array get index
public int getArrayIndex(int[] arr,int value) {
int k=0;
for(int i=0;i<arr.length;i++){
if(arr[i]==value){
k=i;
break;
}
}
return k;
}
Example 2: java first index of an arraylist
ArrayList<Type> array = new ArrayList<Type>();
System.out.printLn(array[0]);