I am wondering if there is a more efficient way of swapping two elements in an Array, than doing something like this:
String temp = arr[1];
arr[1] = arr[2];
arr[2] = temp;
Well, this is obviously not bad or even wrong, but I need to swap very often so I am interested if there are any Libs or something that provide a more efficient way to do this?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…