perf[stream]: stream.toList() replaces collect(Collectors.toList())

This commit is contained in:
sun committed 2023-09-12 13:58:46 +08:00
1 parent ac2d01e6fb
commit ad7e4f3481
17 files changed
+29 -29

No files matched your search

@@ -127,7 +127,7 @@ public class MongodbAccessor implements IAccessor {
@SuppressWarnings("unchecked")
var entityClazz = (Class<E>) entities.get(0).getClass();
var collection = OrmContext.getOrmManager().getCollection(entityClazz);
var ids = entities.stream().map(it -> (it).id()).toList();;
var ids = entities.stream().map(it -> (it).id()).toList();
collection.deleteMany(in("_id", ids));
}
+3 -3
View File
@@ -230,7 +230,7 @@ public class EntityCache<PK extends Comparable<PK>, E extends IEntity<PK>> imple
return new ReplaceOneModel<>(filter, it);
})
.toList();;
.toList();
var result = collection.bulkWrite(batchList, new BulkWriteOptions().ordered(false));
if (result.getModifiedCount() == batchList.size()) {
@@ -261,7 +261,7 @@ public class EntityCache<PK extends Comparable<PK>, E extends IEntity<PK>> imple
return;
}
var ids = updateList.stream().map(it -> it.id()).toList();;
var ids = updateList.stream().map(it -> it.id()).toList();
try {
@SuppressWarnings("unchecked")
@@ -314,7 +314,7 @@ public class EntityCache<PK extends Comparable<PK>, E extends IEntity<PK>> imple
if (allPnodes.isEmpty()) {
return Collections.emptyList();
}
return allPnodes.stream().map(it -> it.getEntity()).toList();;
return allPnodes.stream().map(it -> it.getEntity()).toList();
}
@Override