#1.11 Java Collections Framework in Hindi | How to get subList of an ArrayList



In this video we will see how to get a sublist from an existing ArrayList. We will be doing it using the subList method of ArrayList class.
Syntax:-
List subList(int fromIndex, int toIndex)
………………………………………………………………………………………………………………
Here fromIndex is inclusive and toIndex is exclusive. There are few important points regarding this method which are –
1). The subList method throws IndexOutOfBoundsException – if the specified indexes are out of the range of ArrayList (fromIndex not less than 0 || toIndex not greater than size).
2). IllegalArgumentException – if the starting index is greater than the end point index (fromIndex greater than toIndex).

#programminggalaxy #arraylistinjava
#arraylist #arraylistshortinjava

Nguồn: https://federicobellucci.net/

Xem thêm bài viết khác: https://federicobellucci.net/cong-nghe/


Article Categories:
Công Nghệ

Leave a Comment

Your email address will not be published. Required fields are marked *