jyhsu2000 / BannerMaker

Negating the result of compareTo/compare may have unexpected results JAVA-W1048
Anti-pattern
Major
5 months ago5 months old
39        itemStacks.sort((itemStack1, itemStack2) -> {
40            int c = Integer.compare(itemStack1.getType().ordinal(), itemStack2.getType().ordinal());
41            if (c == 0) {
42                c = -Integer.compare(itemStack1.getAmount(), itemStack2.getAmount());43            }
44            return c;
45        });