perms method

List<List<T>> perms()

Returns all the permutation of a list.

[].perms();
[[]]
[3].perms();
[[3]]
[2, 3].perms();
[[2, 3], [3, 2]]
[1, 2, 3].perms();
[[1, 2, 3], [2, 1, 3], [2, 3, 1], [1, 3, 2], [3, 1, 2], [3, 2, 1]]

Implementation

List<List<T>> perms() {
  return this._perms([...this]);
}