Swap elements in LinkedList

前端 未结 7 1784
别那么骄傲
别那么骄傲 2020-12-20 14:32

I want to maintain order of the elements being added in a list. So, I used a LinkedList in Java.

Now I want to be able to swap two elements in the linke

7条回答
  •  Happy的楠姐
    2020-12-20 15:27

    Take a look at ArrayList , this class will both maintain the insertion order and provide O(1) random access.

提交回复
热议问题