[Solved] How “java.util.Comparator.compare(String o1, String o2) ” method works
Strings are comparable in a lexicographic order (i.e., the order they’d appear in a dictionary). If you want to implement a Comparator for clothes sizes, you’d have to write the logic yourself. E.g.: public class ClothesSizeComparator implements Comparator<String> { private static final List<String> SIZES = Arrays.asList(“XS”, “S”, “M”, “L”, “XL”, “XXL”, “3XL”); @Override public int … Read more