[Pharo-project] Set with nil

Bernat Romagosa tibabenfortlapalanca at gmail.com
Fri May 20 05:58:36 EDT 2011


You may want the collection from which you build a menu to be a Set because
you don't want to have repeated entries in a menu, and you'd want nil to be
there if your field can be empty. When the menu items are automatically
generated, it'd be nice to be able to do Whatever buildMenuFrom:
(myCollection asSet add: nil; yourself).

IMO this would be more elegant than doing myCollection asSet
asOrderedCollection add: nil; yourself, or any other way to ensure the
elements are unique and the collection includes nil.

2011/5/20 Henrik Sperre Johansen <henrik.s.johansen at veloxit.no>

> On 20.05.2011 11:36, Bernat Romagosa wrote:
>
>> On a dropdown menu where you can choose between 'apple' -> #apple,
>> 'orange' -> #orange or 'nothing' -> nil, for example :)
>>
>
> Huh?
> How does a Set figure into that?
>
> Cheers,
> Henry
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20110520/f0df49e8/attachment.html>


More information about the Pharo-dev mailing list