swapped method

Coral<List<E>> swapped(
  1. int index1,
  2. int index2
)

Returns a new list with two elements swapped.

Implementation

Coral<List<E>> swapped(int index1, int index2) => _listCoral.map((list) {
      final copy = list.toList();
      col.ListExtensions(copy).swap(index1, index2);
      return List<E>.unmodifiable(copy);
    });