fork download
  1. import java.util.*;
  2.  
  3. class Ideone {
  4. public static void main (String[] args) {
  5. List<String> sortValues = new ArrayList<>(List.of("100","112","245","65","99"));
  6. sortValues.sort(Comparator.comparing(s -> !s.matches("\\d[\\d,]*") ? " " + s : String.format("%09d", Integer.parseInt(s.replace(",", "")))));
  7. System.out.println(sortValues);
  8. }
  9. }
Success #stdin #stdout 0.11s 48672KB
stdin
Standard input is empty
stdout
[65, 99, 100, 112, 245]