[][src]Struct jni::objects::JList

pub struct JList<'a: 'b, 'b> { /* fields omitted */ }

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]

type Target = JObject<'a>

The resulting type after dereferencing.

Auto Trait Implementations

impl<'a, 'b> !Send for JList<'a, 'b>

impl<'a, 'b> !Sync for JList<'a, 'b>

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.