Listing Index Values

I have a list that has data like a, b, c, d, e, f, g, h, i if I want this list, I would say getList (); which arraylist returns to me, I only need the value at index 10, which is "i", how would I do it?

+3
source share
2 answers
getList().get(8);

Keep in mind that the tt index is based on 0. Thus, the index 8means an element 9th.

Tip: Always watch javadoc or open the autocomplete of your IDE to find out what methods your object uses. Most of them are named and documented in such a way that it is clearly known what they are actually doing.

, google "ArrayList", ( java.sun.com) .

+23

get().

, API Java . .

+1

Source: https://habr.com/ru/post/1726785/


All Articles