Check out example codes for "get last n elements from list java". It will help you in understanding the concepts better.

Code Example 1

List<E> tail = l.subList(Math.max(l.size() - 3, 0), l.size());

Code Example 2

List<Post> myLastPosts = posts.subList(posts.size()-40, posts.size());

Learn ReactJs, React Native from akashmittal.com