|
[
Permlink
| « Hide
]
Dusan Chromy added a comment - 01/Jun/06 04:09 AM
Addition of algorithm methods with an Iterator argument
Dusan Chromy made changes - 01/Jun/06 04:09 AM
JUnit tests for newly added methods
Dusan Chromy made changes - 01/Jun/06 04:10 AM
It just occured to me - in the middle of CollectionUtils-style programming
Imagine you have an input collection of "raw" objects which you transform to something else by applying a Transformer. Now if you're only interested in finding a transformed object that satisfies a given predicate, having an Iterator flavour of find/exists method will allow you write a code like this: Predicate predicate = ... ; This is going to perform better than the workaround: CollectionUtils.find( CollectionUtils.collect( rawList, transformer ), predicate ); Because the latter needs to apply the transformer to all elements in the list, even if the first transformed element satisfies the predicate.
Stephen Colebourne made changes - 19/Jul/06 10:07 PM
BTW, CollectionUtils has been updated in the 4.0 branch to take Iterable as a parameter wherever possible.
But that CollectionUtils.find( CollectionUtils.collect( rawList, transformer ), predicate ); optimisation presents an interesting challenge to doing something similar with Iterables. Considering that IteratorUtils.toList(Iterator) is available, I don't see much value here and would vote WONTFIX. Dissent?
Sorry for the delay in responding to the suggestion to close this
feature request. Unless I am missing something, the functionality provided by creating Attaching Dusan's changes as a patch as it's hard to work with old copies.
Henri Yandell made changes - 20/May/08 07:29 AM
Henri Yandell made changes - 04/Nov/08 03:43 AM
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||