Struct blackboxmc_java::util::JavaArrayList
source · pub struct JavaArrayList<'mc>(_, _);Expand description
Resizable-array implementation of the List interface. Implements all optional list operations, and permits all elements, including null. In addition to implementing the List interface, this class provides methods to manipulate the size of the array that is used internally to store the list. (This class is roughly equivalent to Vector, except that it is unsynchronized.)
The size, isEmpty, get, set, iterator, and listIterator operations run in constant time. The add operation runs in amortized constant time, that is, adding n elements requires O(n) time. All of the other operations run in linear time (roughly speaking). The constant factor is low compared to that for the LinkedList implementation.
Each ArrayList instance has a capacity. The capacity is the size of the array used to store the elements in the list. It is always at least as large as the list size. As elements are added to an ArrayList, its capacity grows automatically. The details of the growth policy are not specified beyond the fact that adding an element has constant amortized time cost.
An application can increase the capacity of an ArrayList instance before adding a large number of elements using the ensureCapacity operation. This may reduce the amount of incremental reallocation.
Note that this implementation is not synchronized. If multiple threads access an ArrayList instance concurrently, and at least one of the threads modifies the list structurally, it must be synchronized externally. (A structural modification is any operation that adds or deletes one or more elements, or explicitly resizes the backing array; merely setting the value of an element is not a structural modification.) This is typically accomplished by synchronizing on some object that naturally encapsulates the list. If no such object exists, the list should be "wrapped" using the Collections.synchronizedList method. This is best done at creation time, to prevent accidental unsynchronized access to the list:
List list = Collections.synchronizedList(new ArrayList(...));
The iterators returned by this class's iterator and listIterator methods are fail-fast: if the list is structurally modified at any time after the iterator is created, in any way except through the iterator's own remove or add methods, the iterator will throw a ConcurrentModificationException. Thus, in the face of concurrent modification, the iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future.
Note that the fail-fast behavior of an iterator cannot be guaranteed as it is, generally speaking, impossible to make any hard guarantees in the presence of unsynchronized concurrent modification. Fail-fast iterators throw ConcurrentModificationException on a best-effort basis. Therefore, it would be wrong to write a program that depended on this exception for its correctness: the fail-fast behavior of iterators should be used only to detect bugs.
This class is a member of the Java Collections Framework.
Implementations§
source§impl<'mc> JavaArrayList<'mc>
impl<'mc> JavaArrayList<'mc>
pub fn new_with_int( jni: &SharedJNIEnv<'mc>, arg0: Option<i32> ) -> Result<JavaArrayList<'mc>, Box<dyn Error>>
pub fn add_with_int( &self, arg0: i32, arg1: Option<JObject<'mc>> ) -> Result<(), Box<dyn Error>>
pub fn remove_with_int(&self, arg0: i32) -> Result<JObject<'mc>, Box<dyn Error>>
pub fn get(&self, arg0: i32) -> Result<JObject<'mc>, Box<dyn Error>>
pub fn equals(&self, arg0: JObject<'mc>) -> Result<bool, Box<dyn Error>>
pub fn hash_code(&self) -> Result<i32, Box<dyn Error>>
pub fn clone(&self) -> Result<JObject<'mc>, Box<dyn Error>>
pub fn index_of(&self, arg0: JObject<'mc>) -> Result<i32, Box<dyn Error>>
pub fn clear(&self) -> Result<(), Box<dyn Error>>
pub fn last_index_of(&self, arg0: JObject<'mc>) -> Result<i32, Box<dyn Error>>
pub fn is_empty(&self) -> Result<bool, Box<dyn Error>>
pub fn replace_all( &self, arg0: impl Into<JavaUnaryOperator<'mc>> ) -> Result<(), Box<dyn Error>>
pub fn size(&self) -> Result<i32, Box<dyn Error>>
pub fn sub_list( &self, arg0: i32, arg1: i32 ) -> Result<JavaList<'mc>, Box<dyn Error>>
pub fn iterator(&self) -> Result<JavaIterator<'mc>, Box<dyn Error>>
pub fn contains(&self, arg0: JObject<'mc>) -> Result<bool, Box<dyn Error>>
pub fn add_all_with_int( &self, arg0: i32, arg1: Option<impl Into<JavaCollection<'mc>>> ) -> Result<bool, Box<dyn Error>>
pub fn set( &self, arg0: i32, arg1: JObject<'mc> ) -> Result<JObject<'mc>, Box<dyn Error>>
pub fn for_each( &self, arg0: impl Into<JavaConsumer<'mc>> ) -> Result<(), Box<dyn Error>>
pub fn ensure_capacity(&self, arg0: i32) -> Result<(), Box<dyn Error>>
pub fn trim_to_size(&self) -> Result<(), Box<dyn Error>>
pub fn remove_if( &self, arg0: impl Into<JavaPredicate<'mc>> ) -> Result<bool, Box<dyn Error>>
pub fn sort( &self, arg0: impl Into<JavaComparator<'mc>> ) -> Result<(), Box<dyn Error>>
pub fn remove_all( &self, arg0: impl Into<JavaCollection<'mc>> ) -> Result<bool, Box<dyn Error>>
pub fn retain_all( &self, arg0: impl Into<JavaCollection<'mc>> ) -> Result<bool, Box<dyn Error>>
pub fn list_iterator_with_int( &self, arg0: Option<i32> ) -> Result<JavaListIterator<'mc>, Box<dyn Error>>
pub fn contains_all( &self, arg0: impl Into<JavaCollection<'mc>> ) -> Result<bool, Box<dyn Error>>
pub fn wait_with_long( &self, arg0: Option<i64>, arg1: Option<i32> ) -> Result<(), Box<dyn Error>>
pub fn notify(&self) -> Result<(), Box<dyn Error>>
pub fn notify_all(&self) -> Result<(), Box<dyn Error>>
pub fn instance_of<A>(&self, other: A) -> boolwhere A: JNIProvidesClassName,
Trait Implementations§
source§impl<'mc> Into<JavaAbstractList<'mc>> for JavaArrayList<'mc>
impl<'mc> Into<JavaAbstractList<'mc>> for JavaArrayList<'mc>
source§fn into(self) -> JavaAbstractList<'mc>
fn into(self) -> JavaAbstractList<'mc>
source§impl<'mc> Into<JavaList<'mc>> for JavaArrayList<'mc>
impl<'mc> Into<JavaList<'mc>> for JavaArrayList<'mc>
source§impl<'mc> Into<JavaRandomAccess<'mc>> for JavaArrayList<'mc>
impl<'mc> Into<JavaRandomAccess<'mc>> for JavaArrayList<'mc>
source§fn into(self) -> JavaRandomAccess<'mc>
fn into(self) -> JavaRandomAccess<'mc>
source§impl<'mc> JNIInstantiatable<'mc> for JavaArrayList<'mc>
impl<'mc> JNIInstantiatable<'mc> for JavaArrayList<'mc>
source§impl<'mc> JNIRaw<'mc> for JavaArrayList<'mc>
impl<'mc> JNIRaw<'mc> for JavaArrayList<'mc>
fn jni_ref(&self) -> SharedJNIEnv<'mc>
fn jni_object(&self) -> JObject<'mc>
Auto Trait Implementations§
impl<'mc> !RefUnwindSafe for JavaArrayList<'mc>
impl<'mc> !Send for JavaArrayList<'mc>
impl<'mc> !Sync for JavaArrayList<'mc>
impl<'mc> Unpin for JavaArrayList<'mc>
impl<'mc> UnwindSafe for JavaArrayList<'mc>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where C: Color,
§fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
fn on_yellow<'a>(&'a self) -> BgColorDisplay<'a, Yellow, Self>
§fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
fn magenta<'a>(&'a self) -> FgColorDisplay<'a, Magenta, Self>
§fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_magenta<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
fn on_purple<'a>(&'a self) -> BgColorDisplay<'a, Magenta, Self>
§fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
fn default_color<'a>(&'a self) -> FgColorDisplay<'a, Default, Self>
§fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
fn on_default_color<'a>(&'a self) -> BgColorDisplay<'a, Default, Self>
§fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
fn bright_black<'a>(&'a self) -> FgColorDisplay<'a, BrightBlack, Self>
§fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
fn on_bright_black<'a>(&'a self) -> BgColorDisplay<'a, BrightBlack, Self>
§fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
fn bright_red<'a>(&'a self) -> FgColorDisplay<'a, BrightRed, Self>
§fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
fn on_bright_red<'a>(&'a self) -> BgColorDisplay<'a, BrightRed, Self>
§fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
fn bright_green<'a>(&'a self) -> FgColorDisplay<'a, BrightGreen, Self>
§fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
fn on_bright_green<'a>(&'a self) -> BgColorDisplay<'a, BrightGreen, Self>
§fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
fn bright_yellow<'a>(&'a self) -> FgColorDisplay<'a, BrightYellow, Self>
§fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
fn on_bright_yellow<'a>(&'a self) -> BgColorDisplay<'a, BrightYellow, Self>
§fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
fn bright_blue<'a>(&'a self) -> FgColorDisplay<'a, BrightBlue, Self>
§fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
fn on_bright_blue<'a>(&'a self) -> BgColorDisplay<'a, BrightBlue, Self>
§fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_magenta<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_magenta<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
fn bright_purple<'a>(&'a self) -> FgColorDisplay<'a, BrightMagenta, Self>
§fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
fn on_bright_purple<'a>(&'a self) -> BgColorDisplay<'a, BrightMagenta, Self>
§fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
fn bright_cyan<'a>(&'a self) -> FgColorDisplay<'a, BrightCyan, Self>
§fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
fn on_bright_cyan<'a>(&'a self) -> BgColorDisplay<'a, BrightCyan, Self>
§fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
fn bright_white<'a>(&'a self) -> FgColorDisplay<'a, BrightWhite, Self>
§fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
fn on_bright_white<'a>(&'a self) -> BgColorDisplay<'a, BrightWhite, Self>
§fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
fn blink_fast<'a>(&'a self) -> BlinkFastDisplay<'a, Self>
§fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
fn strikethrough<'a>(&'a self) -> StrikeThroughDisplay<'a, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more