Package eu.bandm.tools.umod.runtime
Class CollectionFactory
java.lang.Object
eu.bandm.tools.umod.runtime.CollectionFactory
Utility class which holds the factory methods for all collection
classes needed by a umod model.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <A> List<A> Factory method.static <A,B> Map <A, B> Factory method.static <A,B> Multimap <A, B> newMultimap(Class<?> classA, Class<?> classB) Factory method.static <A,B> NonNullKeyMap <A, B> newNonNullKeyMap(Class<A> classA, Class<B> classB) Factory method.static <A> NonNullList<A> newNonNullList(Class<?> elementClass) Factory method.static <A,B> NonNullMap <A, B> newNonNullMap(Class<?> classA, Class<?> classB) Factory method.static <A> NonNullSet<A> newNonNullSet(Class<?> elementClass) Factory method.static <A,B> NonNullValueMap <A, B> newNonNullValueMap(Class<?> classA, Class<?> classB) Factory method.static <A> Set<A> Factory method.
-
Method Details
-
newNonNullList
Factory method.- Type Parameters:
A- the type of the contained elements.- Parameters:
elementClass- the class of the contained elements. Is possibly used for selecting an implementation, etc. (Is not declared with<A>because that could be a parametrized type, which cannot parametrizeClass.)- Returns:
- the new created and empty collection.
- Throws:
IllegalArgumentException- if the given classes are not appropriate.
-
newNonNullSet
Factory method.- Type Parameters:
A- the type of the contained elements.- Parameters:
elementClass- the class of the contained elements. Is possibly used for selecting an implementation, etc. If it has a natural Comparator, a sorted set is returned. (Is not declared with<A>because that could be a parametrized type, which cannot parametrizeClass.)- Returns:
- the new created and empty collection.
- Throws:
IllegalArgumentException- if the given class is not appropriate.
-
newNonNullMap
Factory method.- Type Parameters:
A- the type of the contained keys,B- the type of the contained values.- Parameters:
classA- the classes of the contained keys. Is possibly used for selecting an implementation, etc. (Is not declared with<A>because that could be a parametrized type, which cannot parametrizeClass.)classB- the classes of the contained values. Is possibly used for selecting an implementation, etc. (Is not declared with<B>because that could be a parametrized type, which cannot parametrizeClass.)- Returns:
- the new created and empty collection.
- Throws:
IllegalArgumentException- if the given class is not appropriate.
-
newNonNullKeyMap
Factory method.- Type Parameters:
A- the type of the contained keys,B- the type of the contained values.- Parameters:
classA- the classes of the contained keys. Is possibly used for selecting an implementation, etc. If it has a natural Comparator, a sorted map is returned. (Is not declared with<A>because that could be a parametrized type, which cannot parametrizeClass.)classB- the classes of the contained values. Is possibly used for selecting an implementation, etc. (Is not declared with<B>because that could be a parametrized type, which cannot parametrizeClass.)- Returns:
- the new created and empty collection.
- Throws:
IllegalArgumentException- if the given class is not appropriate.
-
newNonNullValueMap
Factory method.- Type Parameters:
A- the type of the contained keys,B- the type of the contained values.- Parameters:
classA- the classes of the contained keys. Is possibly used for selecting an implementation, etc. If it has a natural Comparator, a sorted map is returned. (Is not declared with<A>because that could be a parametrized type, which cannot parametrizeClass.)classB- the classes of the contained values. Is possibly used for selecting an implementation, etc. (Is not declared with<B>because that could be a parametrized type, which cannot parametrizeClass.)- Returns:
- the new created and empty collection.
- Throws:
IllegalArgumentException- if the given class is not appropriate.
-
newList
Factory method.- Type Parameters:
A- the type of the contained elements.- Parameters:
elementClass- the class of the contained elements. Is possibly used for selecting an implementation, etc. (Is not declared with<A>because that could be a parametrized type, which cannot parametrizeClass.)- Returns:
- the new created and empty collection.
- Throws:
IllegalArgumentException- if the given class is not appropriate.
-
newSet
Factory method.- Type Parameters:
A- the type of the contained elements.- Parameters:
elementClass- the class of the contained elements. Is possibly used for selecting an implementation, etc. If it has a natural Comparator, a sorted map is returned. (Is not declared with<A>because that could be a parametrized type, which cannot parametrizeClass.)- Returns:
- the new created and empty collection.
- Throws:
IllegalArgumentException- if the given class is not appropriate.
-
newMap
Factory method.- Type Parameters:
A- the type of the contained keys,B- the type of the contained values.- Parameters:
classA- the class of the contained keys. Is possibly used for selecting an implementation, etc. If it has a natural Comparator, a sorted map is returned. (Is not declared with<A>because that could be a parametrized type, which cannot parametrizeClass.)classB- the class of the contained values. Is possibly used for selecting an implementation, etc. (Is not declared with<B>because that could be a parametrized type, which cannot parametrizeClass.)- Returns:
- the newly created and empty collection.
- Throws:
IllegalArgumentException- if the given classes are not appropriate.
-
newMultimap
Factory method.- Type Parameters:
A- the type of the left-side values.B- the type of the right-side values.- Parameters:
classA- the class of the contained keys. Is possibly used for selecting an implementation, etc. (Is not declared with<A>because that could be a parametrized type, which cannot parametrizeClass.)classB- the class of the contained values. Is possibly used for selecting an implementation, etc. (Is not declared with<B>because that could be a parametrized type, which cannot parametrizeClass.)- Returns:
- the newly created and empty collection.
- Throws:
IllegalArgumentException- if the given classes are not appropriate.
-