- Timestamp:
- 06/26/13 13:27:31 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/util/lang/Containers.java
r84 r86 4 4 import java.util.Iterator; 5 5 import java.util.List; 6 6 7 import org.apache.commons.collections.functors.InstanceofPredicate; 8 import org.apache.commons.collections.functors.NotPredicate; 7 9 import org.apache.commons.collections.iterators.FilterIterator; 8 10 … … 20 22 } 21 23 22 @SuppressWarnings("unchecked")23 24 public static <T> Iterable<T> filterInstanceof(Iterator<? super T> i, Class<T> type) { 24 25 return new IterableIterator<T>(new FilterIterator(i, new InstanceofPredicate(type))); 25 26 } 26 27 27 @SuppressWarnings("unchecked")28 28 public static <T> Iterable<T> filterInstanceof(Iterable<? super T> i, Class<T> type) { 29 29 return new IterableIterator<T>(new FilterIterator(i.iterator(), new InstanceofPredicate(type))); 30 30 } 31 31 32 @SuppressWarnings("unchecked")33 32 public static <T> Iterable<T> filterInstanceof(Collection<? super T> c, Class<T> type) { 34 33 return new IterableIterator<T>(new FilterIterator(c.iterator(), new InstanceofPredicate(type))); 35 34 } 36 35 37 // @SuppressWarnings("unchecked") 38 // public static <T> Iterable<T> filterNotInstanceof(Collection<T> c, Class<? extends T> type) { 39 // return new IterableIterator<T>(new FilterIterator(c.iterator(), new NotPredicate(new InstanceofPredicate(type)))); 40 // } 36 public static <T> Iterable<T> filterNotInstanceof(Collection<T> c, Class<? extends T> type) { 37 return new IterableIterator<T>(new FilterIterator(c.iterator(), new NotPredicate(new InstanceofPredicate(type)))); 38 } 41 39 }
Note: See TracChangeset
for help on using the changeset viewer.