0

So, If I have a sequence 1,2,3,4,5,6,7,8,9 I need a collection of all possible lists of the same elements for example

2,4,3,9,8,6,5,7,1
2,4,3,9,6,8,5,7,1
1,4,3,9,6,8,5,7,2

et cetera...

How can I do this with for comprehension?

  • 2
    ```List.permutations``` ? Does this help? https://www.scala-lang.org/api/2.12.3/scala/collection/immutable/List.html#permutations:Iterator[Repr] – sinanspd Feb 16 '20 at 18:02
  • 2
    Probably `combinations` or `permutations` - please take a look to the [**scaladoc**](https://www.scala-lang.org/api/current/scala/collection/immutable/List.html) before asking. – Luis Miguel Mejía Suárez Feb 16 '20 at 18:02

0 Answers0