Expand description
Wrapper around java.util.List
Fields
inner: Object<'a>
The list itself
class: Class<'a>
The type contained in the List
Implementations
sourceimpl<'a> List<'a>
impl<'a> List<'a>
sourcepub fn new(env: &'a JNIEnv<'a>, object: Object<'a>, class: Class<'a>) -> Self
pub fn new(env: &'a JNIEnv<'a>, object: Object<'a>, class: Class<'a>) -> Self
Create a List abstraction from it’s raw components. The caller must guarantee that object
implements java.util.List
and that class
is the correct Class
sourcepub fn arraylist(env: &'a JNIEnv<'a>, v_class: Class<'a>) -> Result<Self>
pub fn arraylist(env: &'a JNIEnv<'a>, v_class: Class<'a>) -> Result<Self>
Create a new java.util.ArrayList
sourcepub fn add(&self, object: &Object<'a>) -> Result<bool>
pub fn add(&self, object: &Object<'a>) -> Result<bool>
Appends the specified element to the end of this list (optional operation).
sourcepub fn add_at(&self, object: &Object<'a>, index: i32) -> Result<()>
pub fn add_at(&self, object: &Object<'a>, index: i32) -> Result<()>
Inserts the specified element at the specified position in this list (optional operation).
sourcepub fn clear(&self) -> Result<()>
pub fn clear(&self) -> Result<()>
Removes all of the elements from this list (optional operation).
sourcepub fn contains(&self, object: &Object<'a>) -> Result<bool>
pub fn contains(&self, object: &Object<'a>) -> Result<bool>
Returns true if this list contains the specified element.
sourcepub fn get(&self, index: i32) -> Result<Option<Object<'a>>>
pub fn get(&self, index: i32) -> Result<Option<Object<'a>>>
Returns the element at the specified position in this list.
sourcepub fn index_of(&self, object: &Object<'a>) -> Result<i32>
pub fn index_of(&self, object: &Object<'a>) -> Result<i32>
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
sourcepub fn remove(&self, object: &Object<'a>) -> Result<bool>
pub fn remove(&self, object: &Object<'a>) -> Result<bool>
Removes the first occurrence of the specified element from this list, if it is present (optional operation).
sourcepub fn remove_at(&self, index: i32) -> Result<Option<Object<'a>>>
pub fn remove_at(&self, index: i32) -> Result<Option<Object<'a>>>
Removes the element at the specified position in this list (optional operation).
sourcepub fn set(&self, object: &Object<'a>, index: i32) -> Result<Option<Object<'a>>>
pub fn set(&self, object: &Object<'a>, index: i32) -> Result<Option<Object<'a>>>
Replaces the element at the specified position in this list with the specified element (optional operation).
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for List<'a>
impl<'a> !Send for List<'a>
impl<'a> !Sync for List<'a>
impl<'a> Unpin for List<'a>
impl<'a> UnwindSafe for List<'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