feat: get first or last element of OneToManyUniqueBTreeMap
This commit is contained in:
@@ -42,6 +42,14 @@ where
|
|||||||
self.right_to_left.get(right)
|
self.right_to_left.get(right)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn first_left_and_rights(&self) -> Option<(&Left, &BTreeSet<Right>)> {
|
||||||
|
self.left_to_rights.first_key_value()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn last_left_and_rights(&self) -> Option<(&Left, &BTreeSet<Right>)> {
|
||||||
|
self.left_to_rights.last_key_value()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn remove_left(&mut self, left: &Left) -> Option<(Left, BTreeSet<Right>)> {
|
pub fn remove_left(&mut self, left: &Left) -> Option<(Left, BTreeSet<Right>)> {
|
||||||
let (left, rights) = self.left_to_rights.remove_entry(left)?;
|
let (left, rights) = self.left_to_rights.remove_entry(left)?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user