integer list to get last element code example
Example 1: java get last element of list
ArrayList<Integer> list = new ArrayList<Integer>(5);
int last = list.get(list.size() - 1);
Example 2: how to find the last item of a list
list1 = ['a','b','c']
print(list1[-1])