@@ -0,0 +1,1086 @@
+package com.rampatra.strings;%0A%0Aimport java.util.Set;%0Aimport java.util.TreeSet;%0Aimport java.util.stream.Collectors;%0A%0A/**%0A * @author rampatra%0A * @since 2019-04-02%0A */%0Apublic class RemoveDuplicatesAndArrangeLetters %7B%0A%0A    private static String removeDuplicatesAndArrangeLettersLexicographically(String str) %7B%0A        Set%3CCharacter%3E charSet = new TreeSet%3C%3E();%0A        char%5B%5D chars = str.toCharArray();%0A%0A        for (char ch : chars) %7B%0A            charSet.add(ch);%0A        %7D%0A        %0A        return charSet.toString();%0A    %7D%0A%0A    private static String removeDuplicatesAndArrangeLettersLexicographically_Java8(String str) %7B%0A        return str.chars()%0A                .distinct()%0A                .sorted()%0A                .mapToObj(i -%3E (char) i)%0A                .map(String::valueOf)%0A                .collect(Collectors.joining());%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        System.out.println(removeDuplicatesAndArrangeLettersLexicographically(%22algo&dsInJava%22));%0A        System.out.println(removeDuplicatesAndArrangeLettersLexicographically_Java8(%22algo&dsInJava%22));%0A    %7D%0A%7D%0A

Remove duplicates and arrange letters lexicographically