From c6bcd0dfe487c4da5d742fb1bc476431c9a5ec7a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 5 Jan 2022 17:02:40 +0100 Subject: [PATCH] LibGUI: Use HashTable::remove_all_matching() in GUI::ModelSelection --- Userland/Libraries/LibGUI/ModelSelection.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Userland/Libraries/LibGUI/ModelSelection.cpp b/Userland/Libraries/LibGUI/ModelSelection.cpp index 1afc597343..5bc4a1b1a7 100644 --- a/Userland/Libraries/LibGUI/ModelSelection.cpp +++ b/Userland/Libraries/LibGUI/ModelSelection.cpp @@ -12,16 +12,8 @@ namespace GUI { void ModelSelection::remove_matching(Function filter) { - Vector to_remove; - for (auto& index : m_indices) { - if (filter(index)) - to_remove.append(index); - } - if (!to_remove.is_empty()) { - for (auto& index : to_remove) - m_indices.remove(index); + if (m_indices.remove_all_matching([&](ModelIndex const& index) { return filter(index); })) notify_selection_changed(); - } } void ModelSelection::set(const ModelIndex& index)