         return result
     }
     
+    /// Returns the first index in which an element of the collection satisfies the given predicate.
+    ///
+    /// - Parameter predicate: A closure that takes an element as its argument and returns a Boolean value that indicates whether the passed element represents a match.
+    /// - Returns: The index of the first element for which predicate returns true. If no elements in the collection satisfy the given predicate, returns nil.
+    func index(where predicate: (Element) -> Bool) -> Int? {
+        var result: Int?
+        queue.sync { result = self.array.index(where: predicate) }
+        return result
+    }
+    
     /// Returns the elements of the collection, sorted using the given predicate as the comparison between elements.
     ///
     /// - Parameter areInIncreasingOrder: A predicate that returns true if its first argument should be ordered before its second argument; otherwise, false.

        queue.sync { result = self.array.contains(element) }
        return result
    }
}

    func remove(at index: Int, completion: ((Element) -> Void)? = nil) {
        queue.async(flags: .barrier) {
            let element = self.array.remove(at: index)
            DispatchQueue.main.async { completion?(element) }
        }
    }
    
    /// Removes and returns the element at the specified position.
    ///
    /// - Parameters:
    ///   - predicate: A closure that takes an element of the sequence as its argument and returns a Boolean value indicating whether the element is a match.
    ///   - completion: The handler with the removed element.
    func remove(where predicate: @escaping (Element) -> Bool, completion: ((Element?) -> Void)? = nil) {
        queue.async(flags: .barrier) {
            var element: Element? = nil
            defer { DispatchQueue.main.async { completion?(element) } }
            guard let index = self.array.index(where: predicate) else { return }
            element = self.array.remove(at: index)
        }
    }

