[Newbies] How to doubble sort a collection
Raymond Asselin
jgr.asselin at me.com
Wed Feb 4 18:22:07 UTC 2015
For now I implemented:
sortedNotes
^notes sort:[:a :b | (a date = b date) and:[a temps > b temps]] .
AND
notesSorted
^notes sort:[:a :b | a date = b date
ifTrue:[a temps > b temps]
ifFalse:[a date > b date]] .
does exactly the same result.
But there is still notes in a same date that do not sort correctly, the begining is good and after 5 or so objects
I get some witch do not seem to be sorted.
BTW don't know the difference between sort: and sorted:
it seems as if the last one produce a new collection and the first one produce same collection but sorted.
Note: I use 24 hours instead of a.m. / p.m. is this may cause problems?
> Le 2015-02-04 à 12:00, Paul DeBruicker <pdebruic at gmail.com> a écrit :
>
> a date = b date
> ifTrue:[a temps > b temps]
> ifFalse:[a date > b date]
More information about the Beginners
mailing list