Java permutation generation

public List<String> permutation(List<String> list, String target, String ans){
  if(target.length() <= 1) {
    list.add(ans + target);
  } else {
    for (int i = 0; i < target.length(); i++) {
      permutation(
        list,
        target.substring(0, i) + target.substring(i + 1),
        ans + target.charAt(i));
    }
  }
  return list;
}

Enumeration of all combinations Java

Recommended Posts

Java permutation generation
[Java] Stream API-Stream generation
[Java] Password generation (Pasay)
[Java] New Thread generation method (2)
Java
[Java] Random number generation method (Random)
Java
[Java Silver] Array generation method
[Java] New Thread generation method (1)
Recent Java API specification generation
Java learning (0)
Studying Java ―― 3
Java protected
[Java] Annotation
[Java] Module
Java array
Studying Java ―― 9
Java scratch scratch
Java tips, tips
Java methods
Java method
java (constructor)
Java array
[Java] ArrayDeque
java (override)
Java Day 2018
Java string
java (array)
Java static
Java serialization
java beginner 4
JAVA paid
Studying Java ―― 4
Java (set)
java shellsort
[Java] compareTo
Studying Java -5
java (interface)
Java memorandum
☾ Java / Collection
Java array
Studying Java ―― 1
[Java] Array
[Java] Polymorphism
Studying Java # 0
java framework
Java features
[Java] Inheritance
FastScanner Java
Java features
java beginner 3
Java memo
java (encapsulation)
Java inheritance
Java basics
Decompile Java
[Java] Annotation
java notes
java beginner
Java (add2)
JAVA (Map)