Example & Tutorial understanding programming in easy ways.

When to use ArrayList or LinkedList?


                    ArrayList                         LinkedList
1 Adding new elements is pretty slower than. 1 Adding new elements is pretty fast for either type of list.
2 ArrayList, doing random lookup using "get" is fast. 2 LinkedList, doing random lookup using "get" is slow.
3 The removing elements, using ArrayList is slow. 3 removing elements, using LinkedList is fast.
4 This is because all remaining elements in the underlying array of Object instances must be shifted down for each remove operation. 4 It's slow because there's no efficient way to index into the middle of a linked list.
5 best for cases where you're doing random access on the list. 5 deletion can be done simply by changing a couple of links.
  6 A LinkedList works better if you're doing a lot of editing in the middle of the list.

Read More →
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!