Paulo Gaspar wrote:
>
> Answer inline:
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> > Behalf Of Geir Magnusson Jr.
> >
> > ....
> >
> > > Just accepting an Iterator as the object to iterate trough in the
> > > #foreach.
> >
> > Yes. Ok. Agreed.
> >
> > ........
> >
> > > Yes, it works correctly but it would be more efficient to make the
> > > caching just using the listObject class as key.
> >
> > sorry?
>
> Now you cache what Iterator you got per Iterator object but it would be
> more efficient to cache it per listObject's class (listObject being the
> object to iterate trough in the #foreach).
Nooo.... I don't think so. I think I cache the class and type.
/*
* if we did figure it out, cache it
*/
if ( type != UNKNOWN )
{
icd = new IntrospectionCacheData();
icd.thingy = new Integer( type );
icd.contextData = c;
context.icachePut( this, icd );
}
>
> >...
> >
> > > That is a case where I would be better served with an Iterator as
> > > argument for the #foreach, since an Iterator over a ResultSet is so
> > > easy to implement.
> > > =:o)
> >
> > I thought I had you above, but I seem to have lost you again : an
> > Iterator is used in the foreach. I am cleaning up getIterator() a
> > little as per your's and Jeff's suggestions...
>
> Yes, you get Iterator's from object arrays, Collection's and Map's ...
> ...but what happens if the object to iterate trough in the #foreach is
> _already_ an Iterator???
ah! yep. good one.
> > > Have fun,
> > > Paulo
> >
> > Always do!
> >
> > geir
>
> Doing my best to have it here too,
> =:o)
*Thrilled* to hear it. :)
geir
--
Geir Magnusson Jr. [EMAIL PROTECTED]
Velocity : it's not just a good idea. It should be the law.
http://jakarta.apache.org/velocity