display the last element of an arraylist java on every loop code example
Example 1: arraylist get last
E e = list.get(list.size() - 1);
Example 2: get last n elements from list java
List<Post> myLastPosts = posts.subList(posts.size()-40, posts.size());