pub struct Map<'a> {
pub inner: Object<'a>,
pub k_class: Class<'a>,
pub v_class: Class<'a>,
/* private fields */
}
Expand description
Wrapper around java.util.Map
Fields
inner: Object<'a>
The Map itself
k_class: Class<'a>
The key Class
v_class: Class<'a>
The Value Class
Implementations
sourceimpl<'a> Map<'a>
impl<'a> Map<'a>
sourcepub fn new(
env: &'a JNIEnv<'a>,
object: Object<'a>,
k_class: Class<'a>,
v_class: Class<'a>
) -> Self
pub fn new(
env: &'a JNIEnv<'a>,
object: Object<'a>,
k_class: Class<'a>,
v_class: Class<'a>
) -> Self
Create a Map wrapper from an existing Map object. The caller must guarantee that the passed in Object implements Map and is not null.
sourcepub fn hashmap(
env: &'a JNIEnv<'a>,
k_class: Class<'a>,
v_class: Class<'a>
) -> Result<Self>
pub fn hashmap(
env: &'a JNIEnv<'a>,
k_class: Class<'a>,
v_class: Class<'a>
) -> Result<Self>
Constructs an empty HashMap with the default initial capacity (16) and the default load factor (0.75).
sourcepub fn hashmap_with_capacity(
env: &'a JNIEnv<'a>,
k_class: Class<'a>,
v_class: Class<'a>,
initial_capacity: i32
) -> Result<Self>
pub fn hashmap_with_capacity(
env: &'a JNIEnv<'a>,
k_class: Class<'a>,
v_class: Class<'a>,
initial_capacity: i32
) -> Result<Self>
Constructs an empty HashMap with the specified initial capacity and the default load factor (0.75).
sourcepub fn hashmap_with_capacity_and_load_factor(
env: &'a JNIEnv<'a>,
k_class: Class<'a>,
v_class: Class<'a>,
initial_capacity: i32,
load_factor: f32
) -> Result<Self>
pub fn hashmap_with_capacity_and_load_factor(
env: &'a JNIEnv<'a>,
k_class: Class<'a>,
v_class: Class<'a>,
initial_capacity: i32,
load_factor: f32
) -> Result<Self>
Constructs an empty HashMap with the specified initial capacity and load factor.
sourcepub fn put(
&self,
key: Object<'a>,
value: Object<'a>
) -> Result<Option<Object<'a>>>
pub fn put(
&self,
key: Object<'a>,
value: Object<'a>
) -> Result<Option<Object<'a>>>
Associates the specified value with the specified key in this map (optional operation).
sourcepub fn get(&self, key: &Object<'a>) -> Result<Option<Object<'a>>>
pub fn get(&self, key: &Object<'a>) -> Result<Option<Object<'a>>>
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.
sourcepub fn is_empty(&self) -> Result<bool>
pub fn is_empty(&self) -> Result<bool>
Returns true if this map contains no key-value mappings.
sourcepub fn contains_key(&self, key: &Object<'a>) -> Result<bool>
pub fn contains_key(&self, key: &Object<'a>) -> Result<bool>
Returns true if this map contains a mapping for the specified key.
sourcepub fn contains_value(&self, value: &Object<'a>) -> Result<bool>
pub fn contains_value(&self, value: &Object<'a>) -> Result<bool>
Returns true if this map maps one or more keys to the specified value.
sourcepub fn remove(&self, key: &Object<'a>) -> Result<Option<Object<'a>>>
pub fn remove(&self, key: &Object<'a>) -> Result<Option<Object<'a>>>
Removes the mapping for a key from this map if it is present (optional operation).
sourcepub fn remove_if_mapped(
&self,
key: &Object<'a>,
value: &Object<'a>
) -> Result<bool>
pub fn remove_if_mapped(
&self,
key: &Object<'a>,
value: &Object<'a>
) -> Result<bool>
Removes the entry for the specified key only if it is currently mapped to the specified value.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Map<'a>
impl<'a> !Send for Map<'a>
impl<'a> !Sync for Map<'a>
impl<'a> Unpin for Map<'a>
impl<'a> UnwindSafe for Map<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more