liveBook · Manning

Contains

Contains is a membership-query operation that reports whether a specified value, key, element, or substring occurs in a container or collection.

How 2 Manning books explain it

Clojure: The Essential Reference

.contains is a Java Collection or String method that tests whether a collection contains an element or a string contains a substring.

How it is used
Tests vector value membership or string substring presence where Clojure’s `contains?` would answer a different question.
How deep it goes
Shows calls and results, including an unsupported map call, without detailing Java method implementations.
Examples
Compares value and index checks on a vector, then tests a string substring and an unsupported map call.
What you can do after
Apply it via Java interop to check vector values or string substrings without confusing the result with `contains?`.

Read how Clojure: The Essential Reference explains contains →

100 Java Mistakes and How to Avoid Them

Collection.contains is the Java Collection interface method that tests whether a collection contains an object equal to a specified value.

How it is used
Tests collection membership while exposing type-mismatch and null-handling mistakes that often produce silent failures.
How deep it goes
Explains the Object parameter, varargs inference, semantic type mismatches, null policies, and static-analysis support.
Examples
Uses primitive arrays, File-versus-Path collections, nullable searches, and List.of or Set.of migrations.
What you can do after
Diagnose false membership results, guard nullable arguments, expose inferred types, and interpret relevant analyzer warnings.

Read how 100 Java Mistakes and How to Avoid Them explains contains →

Related concepts

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.