[ 
https://issues.apache.org/jira/browse/PIG-56?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557401#action_12557401
 ] 

Charlie Groves commented on PIG-56:
-----------------------------------

foreach is indeed purely sugar.  I only switched everything because I find it 
to be delicious sugar that makes code more readable.  If you'd rather not apply 
a cosmetic change like that across the codebase, just ignore the patch and add 
Iterable<Tuple> to DataBag's implemented interfaces.  That's the only change in 
the patch that isn't conversions of existing uses of iterator.

> implement Iterable<Tuple> in DataBag
> ------------------------------------
>
>                 Key: PIG-56
>                 URL: https://issues.apache.org/jira/browse/PIG-56
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Charlie Groves
>            Priority: Minor
>         Attachments: iterable_databag.patch
>
>
> Now that DataBag has an iterator method, it can implement Iterable with no 
> other changes.  This would allow bags to be used in a foreach loop like 
> for(Tuple t : bag) {
>   // do something with t
> }
> The attached patch has DataBag implement iterable and converts all bag 
> iterator usages in pig to use foreach loops.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to