logo       

Re: [OT] Case insensitive comparison not stable ?: msg#00141

lang.smalltalk.squeak.seaside

Subject: Re: [OT] Case insensitive comparison not stable ?

Francois Beausoleil wrote:

>Hello everyone !
>
>I know this is off-topic, but at least recognize a few names here :)
>
>Anyway, I can't seem to sort a set of objects represented by names
>case insensitively. Here's what I have at the moment (some methods
>omitted for brevity):
>
>Object subclass: #Author
> instanceVariableNames: 'name email messages'
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Message-Board-Model'!
>
><= other
> ^ name caseInsensitiveLessOrEqual: (other name)
>
>Set subclass: #AuthorRepository
> instanceVariableNames: ''
> classVariableNames: ''
> poolDictionaries: ''
> category: 'Message-Board-Model'!
>
>sortedByName
> ^ SortedCollection new addAll: self.
>
>
>
addAll: returns the argument, not the collection. You need:

sortedByName
^SortedCollection new addAll: self; yourself

David


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise