/**
*
* @version 2018年2月7日 上午10:03:57
* @param input 元素集合
* @param selectedList 需要被移动的元素
* @param cursor 移动的位数
*/
private void moveElement(List<Object> input,List<Object> selectedList,int cursor) {
if (cursor > 0) {
Collections.reverse(selectedList);
}
for (Object selectedObj : selectedList) {
int selectedIndex = input.indexOf(selectedObj);
int replaceIndex = selectedIndex + cursor;
Collections.swap(input, selectedIndex, replaceIndex);
}
}
移动List集合中多个元素的
猜你喜欢
转载自blog.csdn.net/ASDQWE09876/article/details/79276915
今日推荐
周排行