ArrayList<String> list = //List instance
String firstElement = list.get(0);
String sixthElement = list.get(5);
// if you're too lazy to do anything fancy
// here's a code snippet for ya
// replace 'TYPE' with whatever type your using
// like 'int' or 'String' for example
public static int indexOf(TYPE[] arr, TYPE element)
{
for (int index = 0; index < arr.length; index++)
{
if (arr[index] == element)
return index;
else break;
}
// the '-1' is the unique value to
// inform you that no element was found
return -1;
}
System.out.println(new String(list).indexOf("e"));
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;
}