Linked Questions
264 questions linked to/from When to use LinkedList over ArrayList in Java?
79
votes
11
answers
151k
views
Performance differences between ArrayList and LinkedList [duplicate]
Yes, this is an old topic, but I still have some confusions.
In Java, people say:
ArrayList is faster than LinkedList if I randomly access its elements. I think random access means "give me the nth ...
19
votes
4
answers
31k
views
Which one runs faster, ArrayList or LinkedList? [duplicate]
List li = new LinkedList();
for (int i = 0; i < 100; i++) {
li.add(i);
}
long start1 = System.nanoTime();
li.get(57);
long end1 = System.nanoTime();
long diff1 = end1-start1;
System.out....
17
votes
1
answer
24k
views
Difference between arraylist and linkedList [duplicate]
Possible Duplicate:
When to use LinkedList<> over ArrayList<>?
When to use a linked list over an array/array list?
When should I use arrayList and when should I go for LinkedList?
...
14
votes
1
answer
7k
views
LinkedList vs ArrayList on a specific android example [duplicate]
I return a List from my A class. I would like to remove the first element from the list and add it as the last element to the same list. I did it this way.
myList.add(myList.get(0));
myList.remove(0);...
9
votes
3
answers
5k
views
When would you use a java.util.LinkedList [duplicate]
Possible Duplicate:
When to use LinkedList<> over ArrayList<>?
This is a genuine attempt to know when would one use a LinkedList;
From what i understand since the java.util....
9
votes
2
answers
11k
views
Insertion in the middle of ArrayList vs LinkedList [duplicate]
Talking in Java's context. If I want to insert in the middle of either an ArrayList or a linkedList, I've been told that Arraylist will perform terribly.
I understand that it is because, we need to ...
9
votes
4
answers
3k
views
Difference in LinkedList and ArrayList implementation? [duplicate]
Possible Duplicate:
When to use LinkedList<> over ArrayList<>?
I saw the API for the ArrayList and LinkedList and it seems to be same. Apart from their performance difference is there ...
-3
votes
2
answers
4k
views
ArrayList vs LinkedList Java [duplicate]
What is the difference between ArrayList and LinkedList? I watched a video on it by TheNewBoston but i am still confused. Please answer in a short form and in plain English. Please do not use any ...
15
votes
2
answers
577
views
comparison of Linkedlist over arraylist [duplicate]
I understood that LinkedList is implemented as a double linked list. Its performance on add and remove is better than Arraylist, but worse on get and set methods.
Does that mean I should choose ...
-1
votes
2
answers
7k
views
Index based Data structure in Java [duplicate]
I have some values (:a , :a , :b , :c , :f , :f) which I want to store in a unique index based Data structure, which I can later iterate over to get my values.
Can any one please let me know which is ...
0
votes
1
answer
4k
views
When to use ArrayList, LinkedList, and Stack in Java? [duplicate]
How do I decide which data structure to use for a more efficient program? I mostly use ArrayList.
I checked out other questions but I was not fully satisfied. If someone could help me I would be ...
1
vote
2
answers
4k
views
Runtime of arraylist operations add and remove by index [duplicate]
For Java ArrayList, is it accurate to say add and remove by index run in amortized constant time, meaning on average it is constant time (in rare cases linear time by setting up the memory so future ...
-3
votes
2
answers
1k
views
Linkedlist vs ArrayList implementation of List [duplicate]
Possible Duplicate:
When to use LinkedList<> over ArrayList<>?
What is the difference between these two list? they both implements the interface List what in what case would you use a ...
2
votes
1
answer
1k
views
When to use GlueList over ArrayList or LinkedList? [duplicate]
I came across new list implementation which called GlueList
I want to know when i should use over ArrayList or LinkedList.
2
votes
1
answer
805
views
Why is an ArrayList faster to create and add 10 million elements to than a LinkedList? [duplicate]
Yesterday I ran a benchmark in Java 17 where I repeatedly created a new Arraylist and Linkedlist and added 10.000.000 Elements to it.
By the nature of a LinkedList adding elements (creating a ...