Hi all,

I've been thinking lately that I'd like to try out collection-style closures
in Java, albeit as best as we can do with inner-classes. What I'd like to
end up is generic versions of Map & List that are exactly the same, but *
also* have methods like list.forEach(...), list.filter(....),
list.anySatisfy(....) where the ... is a inner class that extends an
interface or abstract class which the list or map knows how do iterate over
and do the semantically meaningfull thing with.

Basically I want to be able to work with collections without having to write
for( : ) loops, while( ) loops or even look at Iterators, I want to be able
to write predicates that the list is smart enough to work with, but still
have all the normal list & map functions available without too many helper
objects or static calls around.

My question is, before I go spending time I don't have on writing my own,
does anyone know of a good collection API(s) in Java that already does this?

I've had a poke around and found this guy with a pimped foreach
loop<http://www.iam.unibe.ch/%7Eakuhn/blog/2008/pimp-my-foreach-loop/>,
but I don't like his syntax because he still uses an explicit loop, not to
mention the magic static calls. I also had a quick poke around in apache
commons-collections (we're currently using 2.1.1 and the closure interface
there looks a bit lonely, 3.2 seems to have lots more goodness but from what
I've seen the syntax there is very closure-y, but not quite what I'm looking
for from what I've seen ) and the Google Collections API doesn't seem to
have much closure-y goodness either.

any ideas anyone? Should I just write it myself or try to work with
commons-collections?

cheers!

matt.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to javaposse@googlegroups.com
To unsubscribe from this group, send email to 
javaposse+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to