[jira] [Updated] (COLLECTIONS-442) A set of enhanced iterator classes donated by the Apache Jena project
[ https://issues.apache.org/jira/browse/COLLECTIONS-442?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Thomas Neidhart updated COLLECTIONS-442: Fix Version/s: (was: 4.0) 4.x A set of enhanced iterator classes donated by the Apache Jena project - Key: COLLECTIONS-442 URL: https://issues.apache.org/jira/browse/COLLECTIONS-442 Project: Commons Collections Issue Type: Improvement Components: Iterator Reporter: Claude Warren Fix For: 4.x Attachments: COLLECTIONS-442.tar.gz, FluentIterator.java, iter-src.zip A set of templated (Generic) iterators that add filtering, mapping, and conversion to set or list collections. Tests included. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (COLLECTIONS-442) A set of enhanced iterator classes donated by the Apache Jena project
[ https://issues.apache.org/jira/browse/COLLECTIONS-442?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andy Seaborne updated COLLECTIONS-442: -- Attachment: iter-src.zip A set of enhanced iterator classes donated by the Apache Jena project - Key: COLLECTIONS-442 URL: https://issues.apache.org/jira/browse/COLLECTIONS-442 Project: Commons Collections Issue Type: Improvement Components: Iterator Reporter: Claude Warren Fix For: 4.0 Attachments: COLLECTIONS-442.tar.gz, FluentIterator.java, iter-src.zip A set of templated (Generic) iterators that add filtering, mapping, and conversion to set or list collections. Tests included. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (COLLECTIONS-442) A set of enhanced iterator classes donated by the Apache Jena project
[ https://issues.apache.org/jira/browse/COLLECTIONS-442?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andy Seaborne updated COLLECTIONS-442: -- Attachment: (was: iter-src.zip) A set of enhanced iterator classes donated by the Apache Jena project - Key: COLLECTIONS-442 URL: https://issues.apache.org/jira/browse/COLLECTIONS-442 Project: Commons Collections Issue Type: Improvement Components: Iterator Reporter: Claude Warren Fix For: 4.0 Attachments: COLLECTIONS-442.tar.gz, FluentIterator.java, iter-src.zip A set of templated (Generic) iterators that add filtering, mapping, and conversion to set or list collections. Tests included. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (COLLECTIONS-442) A set of enhanced iterator classes donated by the Apache Jena project
[ https://issues.apache.org/jira/browse/COLLECTIONS-442?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andy Seaborne updated COLLECTIONS-442: -- Attachment: iter-src.zip A set of enhanced iterator classes donated by the Apache Jena project - Key: COLLECTIONS-442 URL: https://issues.apache.org/jira/browse/COLLECTIONS-442 Project: Commons Collections Issue Type: Improvement Components: Iterator Reporter: Claude Warren Fix For: 4.0 Attachments: COLLECTIONS-442.tar.gz, FluentIterator.java, iter-src.zip A set of templated (Generic) iterators that add filtering, mapping, and conversion to set or list collections. Tests included. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (COLLECTIONS-442) A set of enhanced iterator classes donated by the Apache Jena project
[ https://issues.apache.org/jira/browse/COLLECTIONS-442?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Thomas Neidhart updated COLLECTIONS-442: Attachment: FluentIterator.java I have reworked the patch a bit, see the attached file. My rationale was as follows: * reuse existing code as much as possible * use real classes instead of interfaces to avoid problems with breaking compatibility when extending later on An example how to use the interface: {noformat} public class MyTest { public static void main(String[] args) { ListInteger list = new ArrayListInteger(); list.add(1); list.add(2); list.add(3); list.add(2); list.add(3); FluentIteratorString it = FluentIterator.Integerempty() .andThen(list.iterator()) .dropIf(new PredicateInteger() { public boolean evaluate(Integer object) { return object.intValue() 2; } }) .unique() .andThen(list.iterator()) .mapWith(new TransformerInteger, String() { public String transform(Integer input) { return [ + String.valueOf(input.intValue()) + ]; } }); System.out.println(it.toList()); } } {noformat} This prints {noformat} [[2], [3], [1], [2], [3], [2], [3]] {noformat} In the original patch, andThen behaved differently to the other composition methods in the sense, that only andThen returned the same object. All the other methods returned a new object. This could be error-prone when people do things like this: {noformat} it.andThen(...) it.filterKeep(...) {noformat} in fact, the andThen will update it, while filterKeep will return a new object and leave it untouched. This is fine as long as you do method chaining but can lead to unexpected errors or behavior in other cases. So I decided to be consistent and always return the same object. The only exception is the mapWith method, which will always return a new object as the generic return type may change. I am not completely happy with the class name, so if somebody has a better idea? Any comments are welcome, if the API is accepted we can still include it for the upcoming 4.0-alpha1 which I plan to release in 1-2 weeks. A set of enhanced iterator classes donated by the Apache Jena project - Key: COLLECTIONS-442 URL: https://issues.apache.org/jira/browse/COLLECTIONS-442 Project: Commons Collections Issue Type: Improvement Components: Iterator Reporter: Claude Warren Fix For: 4.0 Attachments: COLLECTIONS-442.tar.gz, FluentIterator.java A set of templated (Generic) iterators that add filtering, mapping, and conversion to set or list collections. Tests included. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (COLLECTIONS-442) A set of enhanced iterator classes donated by the Apache Jena project
[ https://issues.apache.org/jira/browse/COLLECTIONS-442?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Thomas Neidhart updated COLLECTIONS-442: Fix Version/s: (was: 4.x) 4.0 A set of enhanced iterator classes donated by the Apache Jena project - Key: COLLECTIONS-442 URL: https://issues.apache.org/jira/browse/COLLECTIONS-442 Project: Commons Collections Issue Type: Improvement Components: Iterator Reporter: Claude Warren Fix For: 4.0 Attachments: COLLECTIONS-442.tar.gz A set of templated (Generic) iterators that add filtering, mapping, and conversion to set or list collections. Tests included. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (COLLECTIONS-442) A set of enhanced iterator classes donated by the Apache Jena project
[ https://issues.apache.org/jira/browse/COLLECTIONS-442?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Thomas Neidhart updated COLLECTIONS-442: Fix Version/s: 4.x A set of enhanced iterator classes donated by the Apache Jena project - Key: COLLECTIONS-442 URL: https://issues.apache.org/jira/browse/COLLECTIONS-442 Project: Commons Collections Issue Type: Improvement Components: Iterator Reporter: Claude Warren Fix For: 4.x Attachments: COLLECTIONS-442.tar.gz A set of templated (Generic) iterators that add filtering, mapping, and conversion to set or list collections. Tests included. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (COLLECTIONS-442) A set of enhanced iterator classes donated by the Apache Jena project
[ https://issues.apache.org/jira/browse/COLLECTIONS-442?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Claude Warren updated COLLECTIONS-442: -- Attachment: COLLECTIONS-442.tar.gz source code for collecitons and test cases A set of enhanced iterator classes donated by the Apache Jena project - Key: COLLECTIONS-442 URL: https://issues.apache.org/jira/browse/COLLECTIONS-442 Project: Commons Collections Issue Type: Improvement Components: Iterator Reporter: Claude Warren Attachments: COLLECTIONS-442.tar.gz A set of templated (Generic) iterators that add filtering, mapping, and conversion to set or list collections. Tests included. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira