Find
A find operation searches a collection for the first element or entry matching a value or predicate and returns it, or indicates that no match exists.
Secrets of the JavaScript Ninja, Second Edition
An Array method that returns the first element passing a callback test, or undefined if none does.
- How it is used
- Finds the first array item that satisfies a callback condition.
- How deep it goes
- Explains callback-based matching and the `undefined` no-match result, without detailing implementation internals.
- Examples
- Finds the ninja wielding a wakizashi and checks for a katana match that yields `undefined`.
- What you can do after
- Apply `find` with a callback to retrieve the first matching array item or detect that none matches.
Read how Secrets of the JavaScript Ninja, Second Edition explains find →
C++ Concurrency in Action, Second Edition
`std::find` is a C++ standard library algorithm that returns the first element in a range equal to a specified value, or the end of the range if none is found.
- How it is used
- Uses early completion to guide the design of parallel search.
- How deep it goes
- Explains early completion and atomic cancellation through a parallel implementation.
- Examples
- Uses an attic photograph search and a four-thread comparison to illustrate early completion.
- What you can do after
- Evaluate when parallel search can lose to serial search and use a flag to signal a found match.
Read how C++ Concurrency in Action, Second Edition explains find →
Clojure: The Essential Reference
find is a Clojure function that searches an associative collection for a key and returns the corresponding key-value entry or nil.
- How it is used
- Searches associative collections when the complete key-value entry, rather than only its value, is needed.
- How deep it goes
- Defines inputs, outputs, supported collections, edge cases, and entry extraction, but does not develop implementation internals.
- Examples
- Demonstrates map entries, vector indexes, subvectors, missing keys, and filtering records with keep.
- What you can do after
- Apply it via Clojure to locate entries, extract keys or values, and retain matching records without exceptions for absent keys.
The Well-Grounded Rubyist, Fourth Edition
find, also known as detect, is an Enumerable method that returns the first element for which its block evaluates truthily, or nil when no element matches.
- How it is used
- Searches an enumerable collection for one matching element using a block-defined selection criterion.
- How deep it goes
- Explains block evaluation, early termination, nil ambiguity, fallback Procs, and contrasts with multi-result selectors.
- Examples
- Uses a numeric array search, a nil-element search, a fallback lambda, and a custom Rainbow enumerable.
- What you can do after
- Apply it to return the first matching element, detect absence through nil, or provide a fallback Proc.
Read how The Well-Grounded Rubyist, Fourth Edition explains find →
Related concepts
- containsalternative to · Contains is a membership-query operation that reports whether a specified value, key, element, or substring occurs in a container or collection.
- get methodalternative to · A lookup operation on a mapping or associative collection that returns the value associated with a key or index, often with a null-like result or supplied default when no entry exists.
- missing valueproduces · A missing value is a marker or condition indicating that an expected data value or reference is absent, unavailable, unknown, or inapplicable.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



