I want to convert ArrayList in java to vector in c++. How can I do this?
Input: jobject input in c++, which is ArrayList in JAVA. Output: class named vector in c++;
//Find jclass 4 ArrayList, just test jposCommits and jnegCommits are instances of ArrayList
jclass cls_arraylist = env->FindClass("java/util/ArrayList");
//get element
jmethodID arraylist_get = env->GetMethodID(cls_arraylist, "get", "(I)Ljava/lang/Object;");
//get array size
jmethodID arraylist_size = env->GetMethodID(cls_arraylist,"size","()I");
//get the length of pos and neg commits
jint lenArrayList_byte32 = env->CallIntMethod(jobArrayList_byte32, arraylist_size);
vector<byte[]> retKeyV;
for (int i = 0; i < lenArrayList_byte32; ++i) {
jobject joneKey = env->CallObjectMethod(jobArrayList_byte32, arraylist_get, i);
What can I do next