pub struct JListIter<'list, 'local, 'other_local_1: 'obj_ref, 'obj_ref> { /* private fields */ }
Expand description
An iterator over the keys and values in a java.util.List
. See
JList::iter
for more information.
TODO: make the iterator implementation for java iterators its own thing and generic enough to use elsewhere.
Implementations§
source§impl<'list, 'local, 'other_local_1: 'obj_ref, 'obj_ref> JListIter<'list, 'local, 'other_local_1, 'obj_ref>
impl<'list, 'local, 'other_local_1: 'obj_ref, 'obj_ref> JListIter<'list, 'local, 'other_local_1, 'obj_ref>
sourcepub fn next<'other_local_2>(
&mut self,
env: &mut JNIEnv<'other_local_2>
) -> Result<Option<JObject<'other_local_2>>>
pub fn next<'other_local_2>( &mut self, env: &mut JNIEnv<'other_local_2> ) -> Result<Option<JObject<'other_local_2>>>
Advances the iterator and returns the next object in the
java.util.List
, or None
if there are no more objects.
See JList::iter
for more information.
This method creates a new local reference. To prevent excessive memory
usage or overflow error, the local reference should be deleted using
JNIEnv::delete_local_ref
or JNIEnv::auto_local
before the next
loop iteration. Alternatively, if the list is known to have a small,
predictable size, the loop could be wrapped in
JNIEnv::with_local_frame
to delete all of the local references at
once.
This method returns:
Ok(Some(_))
: if there was another object in the list.Ok(None)
: if there are no more objects in the list.Err(_)
: if there was an error calling the Java method to get the next object.
This is like std::iter::Iterator::next
, but requires a parameter of
type &mut JNIEnv
in order to call into Java.