Many times I want to swap the positions of the elements in the List. At this time, I can use the following code, which means to swap the positions of the index1 and index2 elements in the data
- //data is List
- Collections.swap(data,index1,index2);
Many times I want to swap the positions of the elements in the List. At this time, I can use the following code, which means to swap the positions of the index1 and index2 elements in the data