[Gambas-user] Enumerate collection in reverse order

Benoît Minisini gambas at ...1...
Sun Apr 10 13:10:26 CEST 2011


> Hi folks,
> 
> I have gone brain dead on this one.
> 
> All I want to do is enumerate a "naturally sorted" collection in reverse
> order.  By "naturally sorted" I mean that I know the order in which the
> items were added to the collection.  It's just that the order in which
> they were added (ascending time sequence, i.e. the newest data is the last
> entered) is just the opposite of how I want to access them.
> 
> A bit more detail.  The incoming data is received in ascending time
> sequence. Each data set is parsed and added to a collection of objects as
> it is received.  Now I want to process each of the objects starting with
> the most recent for reasons of the maths involved.  A simple example is:
> 	For the most recent sample, the degradation is 0
> 	For each next sample the degradation is the difference between the times
> that the two signals were received.
> 
> The practicality is that the math on the rest of the data is much more
> complex.
> 
> I know I can't "sort" the collection, but there must be a way to achieve
> this, isn't there?

What do you use a collection and not an array?

-- 
Benoît Minisini




More information about the User mailing list