• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

collections binarySearch: always return 1 ?

 
Edward Chen
Ranch Hand
Posts: 798
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am doing some Collections.binarySearch, but I find it will always return "1". In the coding below, no matter you search t1,t2, it always return "1", Where is the bug ?

THanks

 
Paul Clapham
Sheriff
Pie
Posts: 20203
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The bug is in these two lines:Look very closely...
 
Edward Chen
Ranch Hand
Posts: 798
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. Yes, one copy-paste waste me 40 minutes....

Thanks
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unit tests are your friend...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic