diff --git a/headers/private/kernel/util/DoublyLinkedList.h b/headers/private/kernel/util/DoublyLinkedList.h index 50e5fa1281..23216894d3 100644 --- a/headers/private/kernel/util/DoublyLinkedList.h +++ b/headers/private/kernel/util/DoublyLinkedList.h @@ -359,6 +359,9 @@ public: inline Element* GetPrevious(Element* element) const; inline Element* GetNext(Element* element) const; + inline bool Contains(Element* element) const; + // O(n)! + inline int32 Count() const; // O(n)! @@ -617,6 +620,20 @@ DOUBLY_LINKED_LIST_CLASS_NAME::GetNext(Element* element) const return result; } + +DOUBLY_LINKED_LIST_TEMPLATE_LIST +bool +DOUBLY_LINKED_LIST_CLASS_NAME::Contains(Element* _element) const +{ + for (Element* element = First(); element; element = GetNext(element)) { + if (element == _element) + return true; + } + + return false; +} + + // Count DOUBLY_LINKED_LIST_TEMPLATE_LIST int32