Or with http://code.google.com/p/totallylazy/ (ignoring imports):
sequence(1,2,3,4).filter(even());
Or apache collections:
CollectionUtils.filter(new ArrayList(Arrays.asList(1, 2, 3, 4)), new Predicate()
{
public boolean evaluate(Object v)
{
return ((Integer) v).intValue() % 2 == 0;
}
});
[1] http://code.google.com/p/guava-libraries/