Java Collection Framework LinkedList question.

Asked 2 years ago, Updated 2 years ago, 50 views

The LinkedList feature states that when you remove an object from a particular index, only the link is parallelized and the rest of the link is not changed When I tried it myself, it moved up the same as Arraylist. So, this chain type is just an internal style Are you saying that's Other than the speed difference, I can't really feel the difference...

java list

2022-09-20 15:54

1 Answers

ArrayList has a value for the index, so when a certain value is cleared, a shift action is performed to pull the index forward.

When a specific value is cleared, LinkedList only modifies the next reference value of the previous node to the reference value of the cleared value.

Therefore, if you look at ArrayList or LinkedList or stored objects/data from the front, it seems to be moving forward equally.

In terms of time, ArrayList, such as stack/queue or heap, is easier to delete than ArrayList for additional deletion.


2022-09-20 15:54

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.