Does anyone know of a source for performance characteristics on the "contains" method within the different flavors of Scala Lists? The scala language docs cover the primary operations like head, tail, append, and so forth, but don't seem to cover the performance of 'contains.' (Or at least I didn't find anything as such.)
FWIW, I need the fastest structure that will effectively tell me whether an element exists within its listing. That listing, once initially compiled, will not undergo any further a/m/d operations.
This is for Scala version 2.10.0
EDIT: in case it should make any difference, this is a listing of text segments (~16 to 48 characters each.) And, to clarify, the docs did contain one small table that showed look-up performance - but for only a small set of the list/map implementations.
Listwhich is a classic, functional (Lisp-like) cons-cell-based list. Scala'sListis a concrete type while Java'sListis abstract. What Java callsListScala callsSeq, an abstract type for all collections that maintain a specific order of their entries identical to or the opposite of the order in which entries were added. As others have pointed out, what you want is aSet, whose precise purpose is to support fast tests for the presence or absence of a particular value.