I\'d like to do something like:
ArrayList objects = new ArrayList();
...
DozerBeanMapper MAPPER = new DozerBeanMapper
I faced a similar issue, and decided on using a generic utility method to avoid iterating every time I needed to perform such mapping.
public static List map(final Mapper mapper, final List source, final Class destType) {
final List dest = new ArrayList<>();
for (T element : source) {
dest.add(mapper.map(element, destType));
}
return dest;
}
Usage would then be something like:
final List accounts.....
final List actual = Util.map(mapper, accounts, NewObject.class);
Possibly this could be simplified further though.