[Glass] SortedCollection with IdentitySet and Index - an alternative ?

James Foster via Glass glass at lists.gemtalksystems.com
Thu Apr 12 15:40:57 PDT 2018


Hi Marten,

Yes, this is exactly what indexes are designed to provide. Consider the following:

| set stream |
set := IdentitySet withAll: #(1 3 5 7 9).
set createEqualityIndexOn: '' withLastElementClass: Integer.
set equalityIndexedPaths.
stream := set selectAsStream: {:each | each > 0}.
stream next -> stream reversed next "1 -> 9"

See chapter 7 of the Programming Guide.

James

> On Apr 12, 2018, at 12:50 PM, Marten Feldtmann via Glass <glass at lists.gemtalksystems.com> wrote:
> 
> Is it possible to use an IdentitySet with index structure as some kind of SortedCollection ? Has anyone tried this ? Is the index structure available to get the first or the last item of that Set ?
> 
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20180412/9d4df3a6/attachment.html>


More information about the Glass mailing list