How to create Sublist from ArrayList

To create Sublist from ArrayList in java, we need to use the subList(int fromIndex,int toIndex) method provided by ArrayList. We will see the example on how to use the subList method.

public List<E> subList(int fromIndex,int toIndex) returns a new List.

Example : Create Sublist from ArrayList

Output

Reference

1. ArrayList