[−][src]Struct jni::objects::JList
Wrapper for JObjects that implement java/util/Map
. Provides methods to get
and set entries and a way to iterate over key/value pairs.
Looks up the class and method ids on creation rather than for every method call.
Methods
impl<'a: 'b, 'b> JList<'a, 'b>
[src]
pub fn from_env(env: &'b JNIEnv<'a>, obj: JObject<'a>) -> Result<JList<'a, 'b>>
[src]
Create a map from the environment and an object. This looks up the necessary class and method ids to call all of the methods on it so that exra work doesn't need to be done on every method call.
pub fn get(&self, idx: jint) -> Result<Option<JObject<'a>>>
[src]
Look up the value for a key. Returns Some
if it's found and None
if
a null pointer would be returned.
pub fn add(&self, value: JObject<'a>) -> Result<()>
[src]
Append an element to the list
pub fn insert(&self, idx: jint, value: JObject<'a>) -> Result<()>
[src]
Insert an element at a specific index
pub fn remove(&self, idx: jint) -> Result<Option<JObject<'a>>>
[src]
Remove an element from the list by index
pub fn size(&self) -> Result<jint>
[src]
Get the size of the list
pub fn pop(&self) -> Result<Option<JObject<'a>>>
[src]
Pop the last element from the list
Note that this calls size()
to determine the last index.
pub fn iter(&self) -> Result<JListIter<'a, 'b, '_>>
[src]
Get key/value iterator for the map. This is done by getting the
EntrySet
from java and iterating over it.
Methods from Deref<Target = JObject<'a>>
Trait Implementations
impl<'a: 'b, 'b> From<JList<'a, 'b>> for JObject<'a>
[src]
impl<'a: 'b, 'b> Deref for JList<'a, 'b>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,