Searching in an array with custom comparator in java

前端 未结 4 1720
醉酒成梦
醉酒成梦 2021-01-17 00:58

Why does it always return 49999 no matter what strToSearch variable holds? Even with the clank search variable it returns the same. Have I missed s

4条回答
  •  攒了一身酷
    2021-01-17 01:20

    In your 2nd if-Statement: since your strToSearch = "12" and do not contain a ",", the

    o2.indexOf(",") != -1
    

    will always return false.

    Delete the hole if-Statement or at least the last part and it works.

提交回复
热议问题