DATAMONGO-1449 - Switched to foreach loop in collection handling of MappingMongoConverter.

This should result in minor to moderate performance improvement for iteration on Collections/Arrays during DBObject to object mapping.

Original pull request: #368.
This commit is contained in:
Kevin Dosey
2016-06-11 10:03:28 -04:00
committed by Oliver Gierke
parent c84bfbccf4
commit fe5bb515b7

View File

@@ -901,9 +901,7 @@ public class MappingMongoConverter extends AbstractMongoConverter implements App
Collection<Object> items = targetType.getType().isArray() ? new ArrayList<Object>()
: CollectionFactory.createCollection(collectionType, rawComponentType, sourceValue.size());
for (int i = 0; i < sourceValue.size(); i++) {
Object dbObjItem = sourceValue.get(i);
for (Object dbObjItem : sourceValue) {
if (dbObjItem instanceof DBRef) {
items.add(DBRef.class.equals(rawComponentType) ? dbObjItem