Bound mismatch for java Collections sorting

后端 未结 2 1611
春和景丽
春和景丽 2021-01-17 01:39

Hi need Help regarding java collection sorting. It gives me this error:

Bound mismatch: The generic method sort(List) of type Collections is not app         


        
2条回答
  •  礼貌的吻别
    2021-01-17 02:22

    Just add this import import java.util.Comparator;

    and remove this interface

    interface Comparator
    {
        int compare(WifiSSID obj1, WifiSSID obj2);
    }
    

    Your SortSSIDByid comparator class will now implement java.util.Comparator and that is what is required by the Collections.sort() method.

提交回复
热议问题