Thanks, corrected the title from include() to contains() though I never fully understood the third-person singular simple-present “s” used only for predicates…
Good to know someone already considered for it. Any pointers to the previous discussions would be appreciated.
To me, a method without the “s” sounds like an imperative form, so it’d be funny for that to be a predicate. If I saw a method name .include(), I’d think that it either takes some value and includes that into the object, or includes the object to… somewhere else.
I like the low level part of algorithms, and there only the programmer knows when it’s efficient.
Remember that linear search (here called “inefficient”) is the efficient thing to do when your dataset is small. For example, Rust’s BTreeMap uses linear search inside a node.