update at 2022-02-25 14:56:41 by ehlxr

This commit is contained in:
ehlxr 2022-02-25 14:56:41 +08:00
parent bac25e0830
commit d4fa79c52c

View File

@ -93,25 +93,39 @@ pub extern "system" fn Java_me_ehlxr_HelloWorld_getFiled(
"".to_string() "".to_string()
}; };
let map_object = unwrap(&env, env.new_object("java/util/LinkedHashMap", "()V", &[])); let jlist = unwrap(
let jmap = JMap::from_env(&env, map_object).unwrap(); &env,
jmap.put( JList::from_env(
JObject::from(env.new_string("kd").unwrap()), &env,
long_to_jobj(env, 666 as i64), unwrap(&env, env.new_object("java/util/ArrayList", "()V", &[])),
) ),
.unwrap(); );
jmap.put(
JObject::from(env.new_string("kk").unwrap()), let jmap = unwrap(
long_to_jobj(env, 999 as i64), &env,
) JMap::from_env(
.unwrap(); &env,
unwrap(&env, env.new_object("java/util/LinkedHashMap", "()V", &[])),
),
);
unwrap(
&env,
jmap.put(
JObject::from(env.new_string("kd").unwrap()),
long_to_jobj(env, 666 as i64),
),
);
unwrap(
&env,
jmap.put(
JObject::from(env.new_string("kk").unwrap()),
long_to_jobj(env, 999 as i64),
),
);
let jmap2 = jmap.clone(); let jmap2 = jmap.clone();
let list_object = env.new_object("java/util/ArrayList", "()V", &[]).unwrap(); unwrap(&env, jlist.add(JObject::from(jmap)));
let jlist = JList::from_env(&env, list_object).unwrap(); unwrap(&env, jlist.add(jmap2));
jlist.add(JObject::from(jmap)).unwrap();
jlist.add(jmap2).unwrap();
jlist.into_inner() jlist.into_inner()