| Author |
related to best practice
|
vasu chowdary
Ranch Hand
Joined: Mar 15, 2008
Posts: 84
|
|
Hi,
I have small doubt about ArrayList. As a part of the webservice response object i get the ArrayList where i can find exactly 3(not more ,not less and not null) objects in that list.Based on the 1st object value i have to populate another object and based on 2nd object i have to populate another object.So my question is instead of writing below logic
can i directly access the object based on the index like below
>
|
 |
Akhilesh Trivedi
Ranch Hand
Joined: Jun 22, 2005
Posts: 1493
|
|
|
Why not?
|
Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
|
 |
Matthew Brown
Bartender
Joined: Apr 06, 2010
Posts: 3793
|
|
|
Just remember that it's zero-indexed, so use arrayList.get(0), etc.
|
 |
James Boswell
Ranch Hand
Joined: Nov 09, 2011
Posts: 657
|
|
You mean:
|
 |
vasu chowdary
Ranch Hand
Joined: Mar 15, 2008
Posts: 84
|
|
yes i mean
arrayList.get(0);
arrayList.get(1);
arrayList.get(2);
i heared that this not the best practice.is it correct?
|
 |
Akhilesh Trivedi
Ranch Hand
Joined: Jun 22, 2005
Posts: 1493
|
|
vasu chowdary wrote:...webservice response object i get the ArrayList
Think why it is ArrayList and not an array?
|
 |
 |
|
|
subject: related to best practice
|
|
|