Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Advocacy > Proposal. Sort ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 2341 of 2478
Post > Topic >>

Proposal. Sort should return a boolean.

by Roedy Green <see_website@[EMAIL PROTECTED] > Dec 30, 2007 at 10:36 AM

Here is an idea.  I would like it if Collections. sort and Arrays.sort
would return a boolean.  true means something actually changed.  false
means the array was already in order.

Further there would be an additional boolean parameter to the sort to
say "items probably already in order".  The sort would then do a quick
check to make sure the items were in order, and if so, bypass the full
sort.

This would be useful when you have to  avoid needlessly calling
fireTableDataChanged after a sort.

It would also allow you to use sorts in an assert to ASSURE the data
are already sorted, and explode if they are not already sorted.

Since the sort is void now, all existing code would still work.  You
would just have an additional method call with the optional boolean
parameter, or perhaps only in would get the boolean return.
-- 
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 




 1 Posts in Topic:
Proposal. Sort should return a boolean.
Roedy Green <see_websi  2007-12-30 10:36:25 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Dec 4 1:46:25 CST 2008.