Struct blackboxmc_java::JavaDeque
source · pub struct JavaDeque<'mc>(_, _);Expand description
A linear collection that supports element insertion and removal at both ends. The name deque is short for “double ended queue” and is usually pronounced “deck”. Most Deque implementations place no fixed limits on the number of elements they may contain, but this interface supports capacity-restricted deques as well as those with no fixed size limit.
This interface defines methods to access the elements at both ends of the deque. Methods are provided to insert, remove, and examine the element. Each of these methods exists in two forms: one throws an exception if the operation fails, the other returns a special value (either null or false, depending on the operation). The latter form of the insert operation is designed specifically for use with capacity-restricted Deque implementations; in most implementations, insert operations cannot fail.
The twelve methods described above are summarized in the following table:
| First Element (Head) | Last Element (Tail) | |||
| Throws exception | Special value | Throws exception | Special value | |
| Insert | addFirst(e) |
offerFirst(e) |
addLast(e) |
offerLast(e) |
| Remove | removeFirst() |
pollFirst() |
removeLast() |
pollLast() |
| Examine | getFirst() |
peekFirst() |
getLast() |
peekLast() |
This interface extends the Queue interface. When a deque is used as a queue, FIFO (First-In-First-Out) behavior results. Elements are added at the end of the deque and removed from the beginning. The methods inherited from the Queue interface are precisely equivalent to Deque methods as indicated in the following table:
Queue Method |
Equivalent Deque Method |
add(e) |
addLast(e) |
offer(e) |
offerLast(e) |
remove() |
removeFirst() |
poll() |
pollFirst() |
element() |
getFirst() |
peek() |
peekFirst() |
Deques can also be used as LIFO (Last-In-First-Out) stacks. This interface should be used in preference to the legacy Stack class. When a deque is used as a stack, elements are pushed and popped from the beginning of the deque. Stack methods are precisely equivalent to Deque methods as indicated in the table below:
| Stack Method | Equivalent Deque Method |
push(e) |
addFirst(e) |
pop() |
removeFirst() |
peek() |
peekFirst() |
Note that the peek method works equally well when a deque is used as a queue or a stack; in either case, elements are drawn from the beginning of the deque.
This interface provides two methods to remove interior elements, removeFirstOccurrence and removeLastOccurrence.
Unlike the List interface, this interface does not provide support for indexed access to elements.
While Deque implementations are not strictly required to prohibit the insertion of null elements, they are strongly encouraged to do so. Users of any Deque implementations that do allow null elements are strongly encouraged not to take advantage of the ability to insert nulls. This is so because null is used as a special return value by various methods to indicated that the deque is empty.
Deque implementations generally do not define element-based versions of the equals and hashCode methods, but instead inherit the identity-based versions from class Object.
This interface is a member of the Java Collections Framework.
This is a representation of an abstract class.
Implementations§
source§impl<'mc> JavaDeque<'mc>
impl<'mc> JavaDeque<'mc>
pub fn from_raw( env: &SharedJNIEnv<'mc>, obj: JObject<'mc> ) -> Result<Self, Box<dyn Error>>
pub unsafe fn push(&mut self, arg0: JObject<'mc>) -> Result<(), Box<dyn Error>>
pub fn pop(&mut self) -> Result<JObject<'mc>, Box<dyn Error>>
pub unsafe fn add_first( &mut self, arg0: JObject<'mc> ) -> Result<(), Box<dyn Error>>
pub unsafe fn add_last( &mut self, arg0: JObject<'mc> ) -> Result<(), Box<dyn Error>>
pub fn poll_first(&mut self) -> Result<JObject<'mc>, Box<dyn Error>>
pub fn poll_last(&mut self) -> Result<JObject<'mc>, Box<dyn Error>>
pub unsafe fn offer_last( &mut self, arg0: JObject<'mc> ) -> Result<bool, Box<dyn Error>>
pub fn remove_first(&mut self) -> Result<JObject<'mc>, Box<dyn Error>>
pub fn first(&mut self) -> Result<JObject<'mc>, Box<dyn Error>>
pub fn peek_first(&mut self) -> Result<JObject<'mc>, Box<dyn Error>>
pub unsafe fn remove_first_occurrence( &mut self, arg0: JObject<'mc> ) -> Result<bool, Box<dyn Error>>
pub unsafe fn offer_first( &mut self, arg0: JObject<'mc> ) -> Result<bool, Box<dyn Error>>
pub fn remove_last(&mut self) -> Result<JObject<'mc>, Box<dyn Error>>
pub fn last(&mut self) -> Result<JObject<'mc>, Box<dyn Error>>
pub fn peek_last(&mut self) -> Result<JObject<'mc>, Box<dyn Error>>
pub unsafe fn remove_last_occurrence( &mut self, arg0: JObject<'mc> ) -> Result<bool, Box<dyn Error>>
pub unsafe fn offer( &mut self, arg0: JObject<'mc> ) -> Result<bool, Box<dyn Error>>
pub fn descending_iterator(&mut self) -> Result<JObject<'mc>, Box<dyn Error>>
pub unsafe fn add(&mut self, arg0: JObject<'mc>) -> Result<bool, Box<dyn Error>>
pub unsafe fn remove( &mut self, arg0: Option<JObject<'mc>> ) -> Result<bool, Box<dyn Error>>
pub fn size(&mut self) -> Result<i32, Box<dyn Error>>
pub fn iterator(&mut self) -> Result<JObject<'mc>, Box<dyn Error>>
pub unsafe fn contains( &mut self, arg0: JObject<'mc> ) -> Result<bool, Box<dyn Error>>
pub unsafe fn add_all( &mut self, arg0: JObject<'mc> ) -> Result<bool, Box<dyn Error>>
pub fn poll(&mut self) -> Result<JObject<'mc>, Box<dyn Error>>
pub fn peek(&mut self) -> Result<JObject<'mc>, Box<dyn Error>>
pub fn element(&mut self) -> Result<JObject<'mc>, Box<dyn Error>>
pub unsafe fn equals( &mut self, arg0: JObject<'mc> ) -> Result<bool, Box<dyn Error>>
pub fn hash_code(&mut self) -> Result<i32, Box<dyn Error>>
pub fn clear(&mut self) -> Result<(), Box<dyn Error>>
pub fn is_empty(&mut self) -> Result<bool, Box<dyn Error>>
pub fn stream(&mut self) -> Result<JObject<'mc>, Box<dyn Error>>
pub fn spliterator(&mut self) -> Result<JObject<'mc>, Box<dyn Error>>
pub unsafe fn remove_if( &mut self, arg0: JObject<'mc> ) -> Result<bool, Box<dyn Error>>
pub unsafe fn remove_all( &mut self, arg0: JObject<'mc> ) -> Result<bool, Box<dyn Error>>
pub unsafe fn retain_all( &mut self, arg0: JObject<'mc> ) -> Result<bool, Box<dyn Error>>
pub unsafe fn contains_all( &mut self, arg0: JObject<'mc> ) -> Result<bool, Box<dyn Error>>
pub fn parallel_stream(&mut self) -> Result<JObject<'mc>, Box<dyn Error>>
pub unsafe fn for_each( &mut self, arg0: JObject<'mc> ) -> Result<(), Box<dyn Error>>
Trait Implementations§
Auto Trait Implementations§
impl<'mc> !RefUnwindSafe for JavaDeque<'mc>
impl<'mc> !Send for JavaDeque<'mc>
impl<'mc> !Sync for JavaDeque<'mc>
impl<'mc> Unpin for JavaDeque<'mc>
impl<'mc> UnwindSafe for JavaDeque<'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