Return type from a Comparator

前端 未结 6 1399
暖寄归人
暖寄归人 2020-12-09 15:16

What does the return value inside the Comparator actually mean?

For example :

class TreeSetDemo
{
    public static void main(String         


        
6条回答
  •  情歌与酒
    2020-12-09 16:01

    You are confusing return-type and return-value. The return-type is int. The return value is described in the documentation:

    Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

提交回复
热议问题