Struct jni::objects::JMap [−][src]
pub struct JMap<'a> { /* 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> JMap<'a>
[src]
impl<'a> JMap<'a>
pub fn from_env(env: &'a JNIEnv<'a>, obj: JObject<'a>) -> Result<JMap<'a>>
[src]
pub fn from_env(env: &'a JNIEnv<'a>, obj: JObject<'a>) -> Result<JMap<'a>>
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, key: JObject<'a>) -> Result<Option<JObject>>
[src]
pub fn get(&self, key: JObject<'a>) -> Result<Option<JObject>>
Look up the value for a key. Returns Some
if it's found and None
if
a null pointer would be returned.
pub fn put(
&self,
key: JObject<'a>,
value: JObject<'a>
) -> Result<Option<JObject>>
[src]
pub fn put(
&self,
key: JObject<'a>,
value: JObject<'a>
) -> Result<Option<JObject>>
Look up the value for a key. Returns Some
with the old value if the
key already existed and None
if it's a new key.
pub fn remove(&self, key: JObject<'a>) -> Result<Option<JObject<'a>>>
[src]
pub fn remove(&self, key: JObject<'a>) -> Result<Option<JObject<'a>>>
Remove a value from the map. Returns Some
with the removed value and
None
if there was no value for the key.
pub fn iter(&'a self) -> Result<JMapIter<'a>>
[src]
pub fn iter(&'a self) -> Result<JMapIter<'a>>
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> Deref for JMap<'a>
[src]
impl<'a> Deref for JMap<'a>
type Target = JObject<'a>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
fn deref(&self) -> &Self::Target
Dereferences the value.
impl<'a> From<JMap<'a>> for JObject<'a>
[src]
impl<'a> From<JMap<'a>> for JObject<'a>