why does my compare method throw exception — Comparison method violates its general contract!

后端 未结 7 1736
别那么骄傲
别那么骄傲 2020-11-30 12:49

Why does this code

public class SponsoredComparator implements Comparator {

    public boolean equals(SRE arg0, SRE arg1){
        return arg0.g         


        
7条回答
  •  甜味超标
    2020-11-30 13:14

    My solution: When I want to sort numbers and an array element is null, I put 0 then the error disappears. It is needed to take care that the sizes of each row in the two-dimensional arrays are the same.

提交回复
热议问题