diff --git a/README.md b/README.md index aa6584c9..1fd7b710 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Please contribute to this repository to help it make better. Any change like new * If you like eclipse instead of intellij install eclipse https://eclipse.org/downloads/

Set up your desktop

+ * Pull the git repository. Go to command line and type git clone https://github.com/mission-peace/interview.git * Go to root directory of checked out project. * Run ./gradlew idea to generate idea related classes diff --git a/src/com/interview/recursion/StringPermutation.java b/src/com/interview/recursion/StringPermutation.java index 25dfab52..919ba22c 100644 --- a/src/com/interview/recursion/StringPermutation.java +++ b/src/com/interview/recursion/StringPermutation.java @@ -17,13 +17,7 @@ public class StringPermutation { public List permute(char input[]) { Map countMap = new TreeMap<>(); for (char ch : input) { - countMap.compute(ch, (key, val) -> { - if (val == null) { - return 1; - } else { - return val + 1; - } - }); + countMap.put(ch, countMap.getOrDefault(ch, 0)+1); } char str[] = new char[countMap.size()]; int count[] = new int[countMap.size()];