I have an ArrayList
, lets say: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
How can I want to get elements from the 2nd to 4th index, so the output would be [3, 4, 5]
?
Use List.sublist() as you can find in Oracle documentation :
http://docs.oracle.com/javase/7/docs/api/java/util/List.html#subList(int,%20int)