org.axonframework.util
Class CollectionUtils
java.lang.Object
org.axonframework.util.CollectionUtils
public abstract class CollectionUtils
- extends Object
Utility methods for operations on collections.
- Since:
- 0.7
- Author:
- Allard Buijze
|
Method Summary |
static
|
filterByType(Iterable<?> collection,
Class<T> expectedType)
Returns a list of objects of expectedType contained in the given collection. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
filterByType
public static <T> List<T> filterByType(Iterable<?> collection,
Class<T> expectedType)
- Returns a list of objects of
expectedType contained in the given collection. Any
objects in the collection that are not assignable to the given expectedType are filtered out.
The order of the items in the list is the same as the order they were provided by the collection. The given
collection remains unchanged by this method.
If the given collection is null, en empty list is returned.
- Type Parameters:
T - The type items in the returned List must be assignable to.- Parameters:
collection - An iterable (e.g. Collection) containing the unfiltered items.expectedType - The type items in the returned List must be assignable to.
- Returns:
- a list of objects of
expectedType. May be empty, but never null.
Copyright © 2011. All Rights Reserved.