I have list having data like a, b, c, d, e, f, g, h, i if i want this list i would say getList(); which returns me a arraylist,i need only the value at index 10 that is 'i' ,how would i do this ?
I'd go with get().
BTW, you can find the complete Java API docs here. I'd highly recommend bookmarking it.
getList().get(8);
Have in mind that index is 0-based. So index 8
means the 9th
item.
Advice: always look at the javadoc, or open the autocomplete of your IDE, to see what methods does your object have. Most of them are named and documented in a way that it is explicitly known what they actually do.
For example, in your case, google for "ArrayList", open the first result (from java.sun.com), and look through the methods there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With