17 #ifndef __CONSTRUCT_HPP__ 18 #define __CONSTRUCT_HPP__ 24 bool construct(JNIEnv* env, jboolean jbool);
32 std::vector<T> result;
34 jclass clazz = env->GetObjectClass(jiterable);
38 env->GetMethodID(clazz,
"iterator",
"()Ljava/util/Iterator;");
39 jobject jiterator = env->CallObjectMethod(jiterable, iterator);
41 jclass iteratorClazz = env->GetObjectClass(jiterator);
44 jmethodID hasNext = env->GetMethodID(iteratorClazz,
"hasNext",
"()Z");
47 env->GetMethodID(iteratorClazz,
"next",
"()Ljava/lang/Object;");
49 while (env->CallBooleanMethod(jiterator, hasNext)) {
51 jobject jitem = env->CallObjectMethod(jiterator, next);
52 result.emplace_back(construct<T>(env, jitem));
58 #endif // __CONSTRUCT_HPP__ bool construct(JNIEnv *env, jboolean jbool)
std::vector< T > constructFromIterable(JNIEnv *env, jobject jiterable)
Definition: construct.hpp:30