On 2 March 2011 22:55, <mben...@apache.org> wrote: > Author: mbenson > Date: Wed Mar 2 22:55:02 2011 > New Revision: 1076446 > > URL: http://svn.apache.org/viewvc?rev=1076446&view=rev > Log: > add FilteredIterable > > Added: > > commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/FilteredIterable.java > (with props) > > commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestFilteredIterable.java > (with props) > > Added: > commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/FilteredIterable.java > URL: > http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/FilteredIterable.java?rev=1076446&view=auto > ============================================================================== > --- > commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/FilteredIterable.java > (added) > +++ > commons/sandbox/functor/trunk/src/main/java/org/apache/commons/functor/core/collection/FilteredIterable.java > Wed Mar 2 22:55:02 2011 > @@ -0,0 +1,172 @@ > +/* > + * Licensed to the Apache Software Foundation (ASF) under one or more > + * contributor license agreements. See the NOTICE file distributed with > + * this work for additional information regarding copyright ownership. > + * The ASF licenses this file to You under the Apache License, Version 2.0 > + * (the "License"); you may not use this file except in compliance with > + * the License. You may obtain a copy of the License at > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, software > + * distributed under the License is distributed on an "AS IS" BASIS, > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > + * See the License for the specific language governing permissions and > + * limitations under the License. > + */ > +package org.apache.commons.functor.core.collection; > + > +import java.util.Collections; > +import java.util.Iterator; > + > +import org.apache.commons.functor.UnaryFunction; > +import org.apache.commons.functor.UnaryPredicate; > +import org.apache.commons.functor.core.IsInstance; > +import org.apache.commons.functor.core.composite.UnaryAnd; > + > +/** > + * Adds a fluent filtering API to any {@link Iterable}. > + * > + * @version $Revision$ $Date$ > + * > + * @param <T> > + */ > +public class FilteredIterable<T> implements Iterable<T> { > + @SuppressWarnings({ "rawtypes", "unchecked" }) > + // type irrelevant for empty instance > + private static final FilteredIterable EMPTY = new > FilteredIterable(Collections.EMPTY_LIST) {
BTW, using Collections.emptyList() instead should allow the @Suppress tag to be removed. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org