Loop over TLegend entries

This is a duplicate of:

Example:

// TLegend* l was already defined and drawn
if(l==NULL) return;
TIter next(l->GetListOfPrimitives());
TLegendEntry* le;
UInt_t n = 1;
while((le=(TLegendEntry*)next()))
{
	le->SetOption("l");
	n++;
}

Alternatively:

TLegendEntry *tle = (TLegendEntry *)listA->At(2);