[Swift]Array Extension #2
Array Extension #2
mutating func switchValue(_ index1:Int,index2:Int){ let _index1:Int = (index1 < 0) ? self.count + index1 : index1 let _index2:Int = (index2 < 0) ? self.count + index2 : index2 let elm = self[_index1] self[_index1] = self[_index2] self[_index2] = elm }