commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Ernst (JIRA)" <j...@apache.org>
Subject [jira] Commented: (IO-181) LineIterator should implement Iterable
Date Wed, 18 Nov 2009 17:18:39 GMT

    [ https://issues.apache.org/jira/browse/IO-181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12779533#action_12779533
] 

Michael Ernst commented on IO-181:
----------------------------------

The potential problem with this design is that it assumes that there is exactly one iterator
for the object at a time.  Clients may expect that it is possible to have multiple iterators
over a given Iterable, and thus may expect that each call to Iterable.iterator returns a fresh
iterator that shares no state with other iterators.  (Clients shouldn't expect this in the
absence of documentation, but they might.)

I think it's worth it for the convenience, so long as this behavior is documented.

> LineIterator should implement Iterable 
> ---------------------------------------
>
>                 Key: IO-181
>                 URL: https://issues.apache.org/jira/browse/IO-181
>             Project: Commons IO
>          Issue Type: Improvement
>    Affects Versions: 1.4
>            Reporter: Michael Ernst
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> org.apache.commons.io.LineIterator does not implement Iterable.  This makes
> it impossible to use in certain stylized ways, such as in a new-style for
> statement.  Such use is not always desirable (it might temporarily leak a
> file descriptor, until the finalizer is called), but should be possible in
> situations where it is known to be acceptable.

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


Mime
View raw message