[jira] [Commented] (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:comment-tabpanelfocusedCommentId=14577799#comment-14577799 ] Andy Seaborne commented on COLLECTIONS-442: --- [~tn],[~mbenson] - interesting to hear that. Jena has moved to Java8 and for java.lang.Iterable processing we have mostly adopted streams (or left it alone :-) ). There is still a lot of code where iterators are the design pattern and streams are not the right design so I'll be interested in looking at FluentIterable et al. 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 was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (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:comment-tabpanelfocusedCommentId=14577759#comment-14577759 ] Thomas Neidhart commented on COLLECTIONS-442: - Sorry for the delay, but most of the proposed contributions have now been integrated in commons-collections (see the related sub-tasks). The proposed Iter class has been re-designed for the Iterable interface (see FluentIterable). Most of the methods in Iter have been added, with a few exceptions: fold, reduce - they require additional functional interfaces. Currently it is unclear how to proceed with the functional part in collections, especially considering all the changes in Java 8. It would be quite easy to add them later on if needed though. 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 was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (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:comment-tabpanelfocusedCommentId=13649668#comment-13649668 ] Andy Seaborne commented on COLLECTIONS-442: --- I like the style. Attached is another take on this. The main class is Iter that provides two styles: * A style like the FluentIterator style of method chaining. * Static methods to provide short sequences to that one-step operations can be applied to regular iterators and iterables Also includes a PeekInterator for looking oen step ahead. The function-application style is useful for short sequences; the chainign is better for longer sequences. {noformat} iter = Iter.removeNulls(iter) ; {noformat} Example of each style: (example.IterExample.java): {noformat} public class IterExample { public static void main(String ... args) { ListInteger x = Arrays.asList(1,2,3,2,3) ; // Chaining style IterString iter = Iter.iter(x) .filter(new FilterInteger() { @Override public boolean accept(Integer item) { return item.intValue() = 2 ; }}) .distinct() .append(x.iterator()) .map(new TransformInteger,String() { @Override public String convert(Integer item) { return [+String.valueOf(item)+] ; }}) ; System.out.println(iter.toList()); // Function application style. IteratorInteger it = Iter.filter(x, new FilterInteger() { @Override public boolean accept(Integer item) { return item.intValue() = 2 ; }}) ; it = Iter.distinct(it) ; IteratorString its = Iter.map(it, new TransformInteger,String() { @Override public String convert(Integer item) { return [+String.valueOf(item)+] ; }}) ; ListString y = Iter.toList(its) ; System.out.println(y); } } {noformat} 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] [Commented] (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:comment-tabpanelfocusedCommentId=13649751#comment-13649751 ] Thomas Neidhart commented on COLLECTIONS-442: - Thanks for the feedback! I like both styles, and as you say, they can be useful under different circumstances. At collections, we already have a class IteratorUtils, where all the static functions should go (some of them are already there) imho. Tbh I am not such a big fan of these *Utils, and their quite expressive method names, but thats the common style of collections, so we should better stick to it to be consistent. For the method chaining style: I will re-work it further to mimic the API of Iter, we should just use the existing classes in collections to avoid duplication of code / effort. Regarding more additions from jena, I will create sub-tasks for each addition to better keep track of the things that have been added. The PeekingIterator is definitely useful. 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] [Commented] (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:comment-tabpanelfocusedCommentId=13650156#comment-13650156 ] Matt Benson commented on COLLECTIONS-442: - My only concern is that the long-term plan for {{[collections]}}, AFAIK, was to remove its functor types in favor of the Commons {{[functor]}} API. Since {{functor}}'s API has now been split to a separate artifact it wouldn't be that hard to simply depend on it in {{collections}}; however {{functor}} has yet to be released. :| 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] [Commented] (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:comment-tabpanelfocusedCommentId=13636199#comment-13636199 ] Andy Seaborne commented on COLLECTIONS-442: --- Jena also has https://svn.apache.org/repos/asf/jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/iterator/Iter.java (tests in src/test/java) with many operations plain Java iterators. 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] [Commented] (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:comment-tabpanelfocusedCommentId=13636208#comment-13636208 ] Thomas Neidhart commented on COLLECTIONS-442: - These are some really nice and useful iterator implementations. Thanks for the pointer. We will see how we can add them already for 4.0, but currently we are focusing on getting a release out. 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