// 如果series字段的对象数量小于第一个集合的数量,循环复制series中的对象使其数量相等
if (seriesArray.size() < firstObjectRemainingElements) {
JsonNode firstSeriesObject = seriesArray.get(0);
for (int i = seriesArray.size(); i < firstObjectRemainingElements; i++) {
seriesArray.add(firstSeriesObject.deepCopy());
}
} else {
// 删除多余的对象
while (seriesArray.size() > firstObjectRemainingElements) {
seriesArray.remove(seriesArray.size() - 1);
}
}
// 更新series中每个对象的name字段
for (int i = 0; i < firstObjectRemainingElements; i++) {
((ObjectNode) seriesArray.get(i)).put("name", lists.get(0).get(i));
}
01-12
9889
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-14
828
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)