core :: AbstractArray :: swap_at
var a = [10, 20, 30, 40] a.swap_at(1, 3) assert a == [10, 40, 30, 20]
# Invert two elements in the array # # var a = [10, 20, 30, 40] # a.swap_at(1, 3) # assert a == [10, 40, 30, 20] fun swap_at(a: Int,b: Int) do var e = self[a] self[a] = self[b] self[b] = e end
redef fun swap_at(a, b) do mutex.lock super mutex.unlock end
redef fun swap_at(a, b) do mutex.lock real_collection.swap_at(a, b) mutex.unlock end