재귀 함수가 있지만 ArrayList에 이전 데이터를 추가 (저장)하고 싶습니다.재귀 함수 - ArrayList 저장 Java
나는 현재이 일을하고 있지만 저장하지 않습니다 : 당신의 도움에 대한
private ArrayList<String> checkNextPage(String urlGoogleToken){
ArrayList<String> listTokenFunction = new ArrayList<String>();
try
{
/* I AM DOING SOME STUFF */
if (jsonObj.has("next_page_token")){
String next_page_token = (String) jsonObj.get("next_page_token");
listTokenFunction.add(next_page_token); // I WANT TO SAVE THIS LIST
String result = urlGoogleToken.split("&pagetoken=")[0];
String urlGoogleMaps2 = result+"&pagetoken="+next_page_token;
checkNextPage(urlGoogleMaps2); // CALL THE FUNCTION
} else {
System.out.println("ELSE");
}
} catch (Exception e) {
e.printStackTrace();
}
return listTokenFunction;
}
감사합니다!
도움 주셔서 감사합니다. 잘 작동합니다 :-) – user3240520