From: "andrew cooke" <andrew@...>
Date: Wed, 1 Mar 2006 12:49:18 -0300 (CLST)
I needed a filter for a list. Rather than reinvent the wheel I downloaded FunctionalJ - http://functionalj.sourceforge.net/ It's not amazingly elegant (you need to name methods as strings, for example), but it does the job. Here's the final code: @SuppressWarnings("unchecked") public static List<? extends LifetimeAccessControl> filterValid(List<? extends LifetimeAccessControl> list) { return Functions.filterNot( new InstanceFunction(LifetimeAccessControl.class, "isExpired"), list); } Andrew
Mentioned earlier...
From: "andrew cooke" <andrew@...>
Date: Wed, 1 Mar 2006 12:53:46 -0300 (CLST)
Oooops. Mentioned here - http://www.acooke.org/cute/Functional1.html
Lists only
From: "andrew cooke" <andrew@...>
Date: Fri, 3 Mar 2006 09:17:01 -0300 (CLST)
I forgot to mention that for some crazy reason the library only works on lists. Given Java has the generic iterators that are supported by every collection you'd think that all collection types would be supported. Very odd indeed.
Fwd: Re: Lists only
From: "andrew cooke" <andrew@...>
Date: Tue, 29 Aug 2006 23:42:02 -0400 (CLT)
[The latest version also supports generics; it also has some new reflection functionality that might address the "strings" issue I mentioned above; Frederic's support for this package is very good - Andrew] ---------------------------- Original Message ---------------------------- Subject: Re: Lists only From: "Frederic Daoud" Date: Tue, August 29, 2006 10:44 pm -------------------------------------------------------------------------- Hi Andrew, Came across this on your blog: > I forgot to mention that for some crazy reason the library only works on > lists. Given Java has the generic iterators that are supported by every > collection you'd think that all collection types would be supported. Very > odd indeed. Indeed, very odd that I did that. I corrected this in version 0.8 - now the library uses collections. If I overlooked it somewhere please let me know. Also other comments or suggestions are always welcome.. http://functionalj.sourceforge.net Cheers, Frederic