// Path: src/main/java/org/paukov/combinatorics3/PermutationGenerator.java
// public enum TreatDuplicatesAs {
//   DIFFERENT,
//   IDENTICAL
// }


import static java.util.Arrays.asList;
import static java.util.stream.Collectors.toList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Iterator;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.paukov.combinatorics3.PermutationGenerator.TreatDuplicatesAs;
            .stream()
            .collect(toList());

    assertThat(permutations).hasSize(3);
    assertThat(permutations.get(0)).containsExactly("a", "a");
    assertThat(permutations.get(1)).containsExactly("a", "b");
    assertThat(permutations.get(2)).containsExactly("b", "a");
  }

  @Test
  public void test_k_2_of_3_permutation_ignore_duplicates() {
    List<List<String>> permutations =
        Generator.permutation("a", "a", "b")
            .k(2)
            .stream()
            .collect(toList());

    assertThat(permutations).hasSize(6);
    assertThat(permutations.get(0)).containsExactly("a", "a");
    assertThat(permutations.get(1)).containsExactly("a", "a");
    assertThat(permutations.get(2)).containsExactly("a", "b");
    assertThat(permutations.get(3)).containsExactly("b", "a");
    assertThat(permutations.get(4)).containsExactly("a", "b");
    assertThat(permutations.get(5)).containsExactly("b", "a");
  }

  @Test
  public void test_k_1_of_3_with_duplicates_permutation() {
    List<List<String>> permutations =
        Generator.permutation("a", "a", "b")
// Path: src/main/java/org/paukov/combinatorics3/PermutationGenerator.java
// public enum TreatDuplicatesAs {
//   DIFFERENT,
//   IDENTICAL
// }


// Path: src/test/java/org/paukov/combinatorics3/KPermutationTest.java
import static java.util.Arrays.asList;
import static java.util.stream.Collectors.toList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Iterator;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.paukov.combinatorics3.PermutationGenerator.TreatDuplicatesAs;

            .stream()
            .collect(toList());

    assertThat(permutations).hasSize(3);
    assertThat(permutations.get(0)).containsExactly("a", "a");
    assertThat(permutations.get(1)).containsExactly("a", "b");
    assertThat(permutations.get(2)).containsExactly("b", "a");
  }

  @Test
  public void test_k_2_of_3_permutation_ignore_duplicates() {
    List<List<String>> permutations =
        Generator.permutation("a", "a", "b")
            .k(2)
            .stream()
            .collect(toList());

    assertThat(permutations).hasSize(6);
    assertThat(permutations.get(0)).containsExactly("a", "a");
    assertThat(permutations.get(1)).containsExactly("a", "a");
    assertThat(permutations.get(2)).containsExactly("a", "b");
    assertThat(permutations.get(3)).containsExactly("b", "a");
    assertThat(permutations.get(4)).containsExactly("a", "b");
    assertThat(permutations.get(5)).containsExactly("b", "a");
  }

  @Test
  public void test_k_1_of_3_with_duplicates_permutation() {
    List<List<String>> permutations =
        Generator.permutation("a", "a", "b")
            .k(1, TreatDuplicatesAs.IDENTICAL)