java - Access arraylist which way is better -


As

I have 4 ways to access an arraylist.

1) Java 5 Forward Loop 2) Looping array list for loop and shape () method. 3) Errating Arrielast using the operator. 4) array list using list arriter in Java.

My question is ... is everyone the same? everyone is fine? any difference? (Especially for Iterator I ask for it)

1) If you want to track the index If there is no need / item status, you will not delete items in the middle of the walk. This strategy explicitly removes the burden of getting the next item to process.

2) When you want to track the index / status of the object that you process, you can still modify the list, but you can get to process the item yourself. .

3) It is better if you want to remove items from the list,

4) If you need to forward the list and go to the backward place, replace items etc. Will be allowed.

Each of them has their own use cases.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -