import java.util.*;
class Solution {
public String[] solution(String[] strings, int n) {
Comparator<String> stringComparator = Comparator.comparing(a -> a.charAt(n));
return Arrays.stream(strings)
.sorted(stringComparator.thenComparing(Comparator.naturalOrder()))
.toArray(String[]::new);
}
}
https://school.programmers.co.kr/learn/courses/30/lessons/12915