I could see an argument for adding such a utility for Sequence (though unfortunately you wouldn't be able to add a corresponding version for Dictionary, since a dictionary doesn't provide any means of enumerating its keys).
On Aug 15, 2011, at 4:50 PM, Chris Bartlett wrote: > I'm not sure how others feel, but if I remember correctly (apologies > if I don't) Greg is not keen on utility methods/classes being part of > Pivot if they are trivial for individual developers to implement. > > However, if nobody has an issue with including a few targeted methods > such as the Sequence -> Iterator/Iterable ones I mentioned earlier, > then I would be happy to share and they could be added in a few > minutes. > > From my quick search of the nabble mailing list archives (which is not > a complete history), your post looked to be the 3rd one asking about, > or requesting that Sequence be Iterable. I also wondered the same > thing when I first started with Pivot (but never asked the question), > so that suggests there might be justification for including such > methods somewhere within Pivot. I would vote +1. > > > At the moment I have a big, ugly PivotUtil class organised via 10 or > more static inner classes full of little methods that have come in > handy in the past. So for instance there are inner classes relating > to collections, Windows, Displays, Keyboard handling, Listeners, > Components, Paths, ListViews, TreeViews, TableViews etc. Some of > these are probably obsolete now, some were the result of not > understanding the 'Pivot Way' (or intentionally subverting it), but > others are used pretty much any time I do Pivot work. > > Without wishing to go too far off topic, I see no reason why there > couldn't be a Pivot specific 'commons' type project *somewhere* that > did have a load of simple, but useful methods such as some of the ones > I just described, so that Pivot consumers do not have to re-invent the > wheel. (Taking inspiration from Apache Commons IO, Lang, Collections > etc) > > It could be hosted on Apache Extras unless there *was* a desire to > include it as an optional, but official part of Pivot (probably > documented so as to lower support and feature expectations, and not > used within Pivot itself to avoid a dependency). > > > On 16 August 2011 02:49, Roger L. Whitcomb <roger.whitc...@ingres.com> wrote: >> Could your utility class fit into org.apache.pivot.collections or >> org.apache.pivot.util as adapters of some kind? >> >> Roger Whitcomb | Architect, Engineering | roger.whitc...@ingres.com | Ingres >> | 500 Arguello Street | Suite 200 | Redwood City | CA | 94063 | USA +1 >> 650-587-5596 | fax: +1 650-587-5550 >> >> -----Original Message----- >> From: Chris Bartlett [mailto:cbartlet...@gmail.com] >> Sent: Monday, August 15, 2011 12:42 PM >> To: dev@pivot.apache.org >> Subject: Re: Should Sequence implement Iterable? >> >> Sometimes I can't find threads even when I know one exists, so no >> problems on that count. >> >> FWIW I have a utility class related to the Pivot collections package >> that has static methods which return an Iterable<T> or Iterator<T> for >> a supplied Sequence<T>. It is clunky but eases the pain. >> >> On 16 August 2011 02:28, Roger L. Whitcomb <roger.whitc...@ingres.com> wrote: >>> Thanks. Should have looked a little further before firing off the email.... >>> >>> Roger Whitcomb | Architect, Engineering | roger.whitc...@ingres.com | >>> Ingres | 500 Arguello Street | Suite 200 | Redwood City | CA | 94063 | USA >>> +1 650-587-5596 | fax: +1 650-587-5550 >>> >>> -----Original Message----- >>> From: Chris Bartlett [mailto:cbartlet...@gmail.com] >>> Sent: Monday, August 15, 2011 12:18 PM >>> To: dev@pivot.apache.org >>> Subject: Re: Should Sequence implement Iterable? >>> >>> Here is a previous thread on the same subject >>> http://apache-pivot-users.399431.n3.nabble.com/let-Sequence-lt-T-gt-extend-Iterable-lt-T-gt-td729282.html >>> >>> On 16 August 2011 02:06, Roger L. Whitcomb <roger.whitc...@ingres.com> >>> wrote: >>>> Maybe I am missing something, but wouldn't it make sense if >>>> org.apache.pivot.collections.Sequence implemented Iterable ? That way >>>> you could use the "foreach" construct on Containers that implement >>>> Sequence<Component>.... (for instance). >>>> >>>> >>>> >>>> Roger Whitcomb >>>> >>>> Architect, Engineering >>>> >>>> Ingres Corporation >>>> >>>> roger.whitc...@ingres.com <mailto:roger.whitc...@ingres.com> >>>> >>>> >>>> >>>> PHONE +1 650.587.5596 >>>> >>>> FAX +1 650.587.5550 >>>> >>>> >>>> >>>> www.ingres.com <http://www.ingres.com/> >>>> >>>> >>>> >>>> This transmission is confidential and intended solely for the use of the >>>> recipient named above. It may contain confidential, proprietary, or >>>> legally privileged information. If you are not the intended recipient, >>>> you are hereby notified that any unauthorized review, use, disclosure or >>>> distribution is strictly prohibited. If you have received this >>>> transmission in error, please contact the sender by reply e-mail and >>>> delete the original transmission and all copies from your system. >>>> >>>> >>>> >>>> >>> >>