Is API doc for ArrayList::sort() wrong?

238 views
Skip to first unread message

baba-papa

unread,
Aug 29, 2012, 1:27:40 AM8/29/12
to silverst...@googlegroups.com
If I try to sort an ArrayList I get an InvalidArgumentException "You can't pass SQL fragments to sort()". Due to the stack trace the following command was executed causing the exception:
ArrayList->sort(SilvercartProduct.ProductNumberShop ASC)
If I remove ' ASC' from the string everything works fine.
I think the API doc of the function ArrayList::sort() is wrong because it says you could add the sort order to the parameter as a string. Should I adjust the API doc or am I getting something wrong?

Uncle Cheese

unread,
Aug 29, 2012, 8:11:37 AM8/29/12
to silverst...@googlegroups.com
It needs to be passed as two separate arguments. sort("column","direction").

I agree, the docs are misleading, but accurate. Technically the above is SQL.

baba-papa

unread,
Aug 29, 2012, 10:27:53 AM8/29/12
to silverst...@googlegroups.com
@uncle_cheese: Thanks for your reply. I will change the API doc and provide a pull request.
Reply all
Reply to author
Forward
0 new messages