Implements the loneElement
syntax of trait LoneElement
.
Implements the loneElement
syntax of trait LoneElement
.
Returns the lone element contained in a collection, wrapped in a Some
, or None
if the collection contains either no elements or more than one element.
a collection about which an assertion is being made
Some[E]
if the collection contains one and only one element, None
otherwise.
Returns the size of the passed collection
.
Returns the size of the passed collection
.
a collection
to check the size of
the size of the passed collection
Supertrait for typeclasses that enable
loneElement
matcher syntax for collections.A
Collecting[E, C]
provides access to the "collecting nature" of typeC
in such a way thatloneElement
syntax can be used with typeC
. AC
can be any type of "collecting", a type that in some way collects or brings together elements of typeE
. ScalaTest provides implicit implementations for several types. You can enable thecontain
matcher syntax on your own typeU
by defining anCollecting[U, E]
for the type and making it available implicitly.ScalaTest provides implicit
Collecting
instances forscala.collection.GenTraversable
,Array
,java.util.Collection
andjava.util.Map
in theCollecting
companion object.