看黄色标注部分,objectList的size在for循环外面是200,在里面直接是0.
int pageNumber = 1;
List<T> objectList = iClient.getEntities(this.yaasAware, pageNumber, false, token);
System.out.println("objectList :" + objectList.size()); //output result: 200
for(int i = 0; i < 200; i++){
System.out.println("objectList: " + objectList.size()); //output result: 0
pageNumber++;
renewToken();
System.out.println("objectList" + objectList.size());
for (T source : objectList) {
// transform the structure to indexing structure
E objectIndex = transformEntity(source, this.yaasAware, token);
checkAndIndexObject(objectIndex);
}
objectList = iClient.getEntities(this.yaasAware, pageNumber, false, token);
}
Output result:
你直接println(objectList),看打出来的两个对象地址一样不?
Println(objectList)的Output result