find first and last index of element in list java code example Example: arraylist get last E e = list.get(list.size() - 1);