[Glass] Is there a less hacky way of getting indexes of an unordered collection?

Mariano Martinez Peck via Glass glass at lists.gemtalksystems.com
Fri Jun 12 14:05:27 PDT 2015


I had to implement such an extension method:

getCurrentIndexes
| result iList |
result := OrderedCollection new.
iList := self _indexedPaths.
iList == nil
  ifFalse: [
    2 to: iList size by: 2 do: [ :i |
      (iList at: i) > 0 ifTrue: [ result add: (iList at: i - 1) ]
    ]
  ].
^ result

But it seems a bit hacky and cryptic. I am using GemStone 3.1.0.6.

Thanks!

-- 
Mariano
http://marianopeck.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20150612/c0ee91a6/attachment.html>


More information about the Glass mailing list