Answered by : stupid-seal-lkprxu0vos8u
firstNum = numbers[0];
lastNum = numbers[numbers.length-1];
Source : https://stackoverflow.com/questions/39860739/how-to-get-first-and-last-element-in-an-array-in-java | Last Update : Fri, 15 May 20
Answered by : busy-badger-oydyepme7a8i
ArrayList<Integer> list = new ArrayList<Integer>(5);
int last = list.get(list.size() - 1);
Source : | Last Update : Sat, 06 Jun 20
Answered by : proton
int e = list.get(list.size() - 1);
Source : https://stackoverflow.com/questions/687833/how-to-get-the-last-value-of-an-arraylist | Last Update : Fri, 05 Aug 22
Answered by : kritik-modi
int a[]={1,2,3};
int last = a[a.length-1];
Source : | Last Update : Sat, 27 Aug 22
Answered by : dark-dogfish-f96qufu7cjdu
List<Post> myLastPosts = posts.subList(posts.size()-40, posts.size());
Source : https://stackoverflow.com/questions/37219424/get-last-x-items-of-a-list-in-java | Last Update : Thu, 27 Aug 20
Answered by : dark-dogfish-f96qufu7cjdu
List<E> tail = l.subList(Math.max(l.size() - 3, 0), l.size());
Source : https://stackoverflow.com/questions/14605999/getting-the-last-three-elements-from-a-list-arraylist | Last Update : Thu, 27 Aug 20