[Java] Clean Pure Comparator + Sort 22ms
\nclass Solution {\n    public String[] reorderLogFiles(String[] logs) {\n        Arrays.sort(logs, new LogComparator());\n        \n        return logs;\n    }
```\nclass Solution {\n    public String[] reorderLogFiles(String[] logs) {\n        Arrays.sort(logs, new LogComparator());\n        \n        return logs;\n    }\n}\n\nclass LogComparator implements Comparator<String>{\n    @Override \n    public int compare(String log1, String log2){\n        String[] words1 = log1.split(" ");\n        String[] words2 = log2.split(" ");\n        \n        int firstSpaceIndex = log1.indexOf(\' \');\n        int secondSpaceIndex = log2.indexOf(\' \');\n        \n        \n        boolean isLetter1 = isLetter(words1);\n        boolean isLetter2 = isLetter(words2);\n        \n        if (isLetter1 == true && isLetter2 == true){\n            //Then we need to sort lexicographically, but we need to ignore the first word.\n            return log1.substring(firstSpaceIndex+1).compareTo(log2.substring(secondSpaceIndex+1));\n        }else if (isLetter1 != isLetter2){ //This means one is true and one is false, therefore, one is a digit the other is a letter\n            return isLetter1 ? -1 : 1; //If the first word is a letter log, then second one is digit log and vice-versa.\n        } //else if isLetter1 == false && isLetter2 == false, both are digits therefore maintain the ordering.\n        \n        return 0;\n        \n    }\n    \n    boolean isLetter(String[] words){\n        //Get the first word of split string (not the id)\n        String firstWord = words[1]; //First word after id\n        //Get the first letter of the first word\n        char c = firstWord.charAt(0);\n        if (Character.isLetter(c)) return true;\n        \n        return false;\n    }\n    \n    \n}\n```
[]